summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2016-11-21 01:38:04 +0000
committerLiong Sauw Ming <ming@teluu.com>2016-11-21 01:38:04 +0000
commit50feb32cf2bb9fe39137c6f35a772ac050e0b9e7 (patch)
tree77a151ff06a4334fb6792f64daf2632e6d16cb5f
parent0189daf2f6e511a9aacef2a18fd005bb5f454c06 (diff)
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
-rw-r--r--pjsip/src/pjsua-lib/pjsua_media.c15
1 files 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;
}