From 50feb32cf2bb9fe39137c6f35a772ac050e0b9e7 Mon Sep 17 00:00:00 2001 From: Liong Sauw Ming Date: Mon, 21 Nov 2016 01:38:04 +0000 Subject: Fixed #1980: Assertion if remote removes some media lines in previous SDP negotiations git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5487 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsua-lib/pjsua_media.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c index 8bca8700..43b70baa 100644 --- a/pjsip/src/pjsua-lib/pjsua_media.c +++ b/pjsip/src/pjsua-lib/pjsua_media.c @@ -2311,9 +2311,18 @@ pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id, const pjmedia_sdp_session *s_; pjmedia_sdp_neg_get_active_local(call->inv->neg, &s_); - pj_assert(mi < s_->media_count); - m = pjmedia_sdp_media_clone(pool, s_->media[mi]); - m->desc.port = 0; + if (mi < s_->media_count) { + m = pjmedia_sdp_media_clone(pool, s_->media[mi]); + m->desc.port = 0; + } else { + /* Remote may have removed some media lines in + * previous negotiations. However, since our + * media count may never decrease (as per + * the RFC), we'll just offer unknown media here. + */ + m->desc.media = pj_str("unknown"); + m->desc.fmt[0] = pj_str("0"); + } } break; } -- cgit v1.2.3