diff options
author | Joshua Colp <jcolp@digium.com> | 2016-11-01 11:56:24 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2016-11-01 11:56:24 +0000 |
commit | 69196a8db4367116144bae6ac7e43f5df573ec11 (patch) | |
tree | f3c4ea40114db14698b50bbb6e2a473fabe3ac8e /res | |
parent | 201f21e0e567c53c51601d5903999f538ce84178 (diff) |
res_pjsip_sdp_rtp: Limit number of formats to defined maximum.
The res_pjsip_sdp_rtp module did not restrict the number of
formats added to a media stream in the SDP to the defined
limit. If allow=all was used with additional loaded codecs this
could result in the next media stream being overwritten some.
This change restricts the module to limit it to the defined
maximum and also increases the maximum in our bundled pjproject.
ASTERISK-26541 #close
Change-Id: I0dc5f59d3891246cafa2f3df5ec406f088559ee8
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip_sdp_rtp.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index aad6bb88f..d8b94df9f 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -1180,10 +1180,14 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as max_packet_size = ast_format_get_maximum_ms(format); } ao2_ref(format, -1); + + if (media->desc.fmt_count == PJMEDIA_MAX_SDP_FMT) { + break; + } } /* Add non-codec formats */ - if (media_type != AST_MEDIA_TYPE_VIDEO) { + if (media_type != AST_MEDIA_TYPE_VIDEO && media->desc.fmt_count < PJMEDIA_MAX_SDP_FMT) { for (index = 1LL; index <= AST_RTP_MAX; index <<= 1) { if (!(noncodec & index)) { continue; @@ -1205,6 +1209,10 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as attr = pjmedia_sdp_attr_create(pool, "fmtp", pj_cstr(&stmp, tmp)); media->attr[media->attr_count++] = attr; } + + if (media->desc.fmt_count == PJMEDIA_MAX_SDP_FMT) { + break; + } } } |