diff options
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/src/pjmedia/sdp_neg.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pjmedia/src/pjmedia/sdp_neg.c b/pjmedia/src/pjmedia/sdp_neg.c index 6ce097e3..c7341386 100644 --- a/pjmedia/src/pjmedia/sdp_neg.c +++ b/pjmedia/src/pjmedia/sdp_neg.c @@ -911,6 +911,11 @@ static pj_status_t process_m_answer( pj_pool_t *pool, } } + if (0 == offer->desc.fmt_count) { + /* No common codec in the answer! */ + return PJMEDIA_SDPNEG_EANSNOMEDIA; + } + /* Arrange format in the offer so the order match the priority * in the answer */ @@ -924,6 +929,28 @@ static pj_status_t process_m_answer( pj_pool_t *pool, break; } } + + /* If this answer format has no matching format, let's remove it + * from the answer. + */ + if (j >= offer->desc.fmt_count) { + pjmedia_sdp_attr *a; + + /* Remove rtpmap associated with this format */ + a = pjmedia_sdp_media_find_attr2(answer, "rtpmap", fmt); + if (a) + pjmedia_sdp_media_remove_attr(answer, a); + + /* Remove fmtp associated with this format */ + a = pjmedia_sdp_media_find_attr2(answer, "fmtp", fmt); + if (a) + pjmedia_sdp_media_remove_attr(answer, a); + + /* Remove this format from answer's array */ + pj_array_erase(answer->desc.fmt, sizeof(answer->desc.fmt[0]), + answer->desc.fmt_count, i); + --answer->desc.fmt_count; + } } } |