[asterisk-commits] file: trunk r58437 - in /trunk: ./ main/rtp.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Mar 8 11:05:55 MST 2007


Author: file
Date: Thu Mar  8 12:05:54 2007
New Revision: 58437

URL: http://svn.digium.com/view/asterisk?view=rev&rev=58437
Log:
Merged revisions 58436 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r58436 | file | 2007-03-08 13:01:00 -0500 (Thu, 08 Mar 2007) | 2 lines

Make early SDP seeding even smarter! We have to check codecs in the make_compatible function too. (issue #9221 reported by marcelbarbulescu)

........

Modified:
    trunk/   (props changed)
    trunk/main/rtp.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/main/rtp.c?view=diff&rev=58437&r1=58436&r2=58437
==============================================================================
--- trunk/main/rtp.c (original)
+++ trunk/main/rtp.c Thu Mar  8 12:05:54 2007
@@ -1627,7 +1627,7 @@
 	struct ast_rtp_protocol *destpr = NULL, *srcpr = NULL;
 	enum ast_rtp_get_result audio_dest_res = AST_RTP_GET_FAILED, video_dest_res = AST_RTP_GET_FAILED, text_dest_res = AST_RTP_GET_FAILED;
 	enum ast_rtp_get_result audio_src_res = AST_RTP_GET_FAILED, video_src_res = AST_RTP_GET_FAILED, text_src_res = AST_RTP_GET_FAILED; 
-	int srccodec;
+	int srccodec, destcodec;
 
 	/* Lock channels */
 	ast_channel_lock(dest);
@@ -1661,8 +1661,18 @@
 	video_src_res = srcpr->get_vrtp_info ? srcpr->get_vrtp_info(src, &vsrcp) : AST_RTP_GET_FAILED;
 	text_src_res = srcpr->get_trtp_info ? srcpr->get_trtp_info(src, &tsrcp) : AST_RTP_GET_FAILED;
 
+	/* Ensure we have at least one matching codec */
+	if (srcpr->get_codec)
+		srccodec = srcpr->get_codec(src);
+	else
+		srccodec = 0;
+	if (destpr->get_codec)
+		destcodec = destpr->get_codec(dest);
+	else
+		destcodec = 0;
+
 	/* Check if bridge is still possible (In SIP canreinvite=no stops this, like NAT) */
-	if (audio_dest_res != AST_RTP_TRY_NATIVE || audio_src_res != AST_RTP_TRY_NATIVE) {
+	if (audio_dest_res != AST_RTP_TRY_NATIVE || audio_src_res != AST_RTP_TRY_NATIVE || !(srccodec & destcodec)) {
 		/* Somebody doesn't want to play... */
 		ast_channel_unlock(dest);
 		ast_channel_unlock(src);
@@ -1673,10 +1683,6 @@
 		ast_rtp_pt_copy(vdestp, vsrcp);
 	if (tdestp && tsrcp)
 		ast_rtp_pt_copy(tdestp, tsrcp);
-	if (srcpr->get_codec)
-		srccodec = srcpr->get_codec(src);
-	else
-		srccodec = 0;
 	if (media) {
 		/* Bridge early */
 		if (destpr->set_rtp_peer(dest, srcp, vsrcp, tsrcp, srccodec, ast_test_flag(srcp, FLAG_NAT_ACTIVE)))



More information about the asterisk-commits mailing list