summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2010-05-07 07:09:16 +0000
committerNanang Izzuddin <nanang@teluu.com>2010-05-07 07:09:16 +0000
commit2e531381c05553aa5fac07750308f683fa11e5a2 (patch)
tree21e36216d82816861d1c6ced0601fc165525d4c0 /pjmedia
parent165f6a50faef766ca2532b717fe27f8e335e8265 (diff)
Fixed #1066:
- Added check if the negotiation result of local-offer/remote-answer has no matching format. - Added routine to remove any unmatching formats in the remote-answer. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3160 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/src/pjmedia/sdp_neg.c27
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;
+ }
}
}