[svn-commits] mmichelson: branch 1.8 r381281 - /branches/1.8/main/rtp_engine.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Feb 12 14:16:27 CST 2013


Author: mmichelson
Date: Tue Feb 12 14:16:24 2013
New Revision: 381281

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381281
Log:
Do not allow native RTP bridging if packetization of media streams differs.

The RTP engine will no longer allow for local and remote native RTP bridges
if packetization of streams differs. Allowing native bridging in this scenario
has been known to cause FAX failures.

(closes ASTERISK-20650)
Reported by: Maciej Krajewski
Patches:
	ASTERISK-20659.patch uploaded by Mark Michelson (License #5049)

Review: https://reviewboard.asterisk.org/r/2319


Modified:
    branches/1.8/main/rtp_engine.c

Modified: branches/1.8/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/rtp_engine.c?view=diff&rev=381281&r1=381280&r2=381281
==============================================================================
--- branches/1.8/main/rtp_engine.c (original)
+++ branches/1.8/main/rtp_engine.c Tue Feb 12 14:16:24 2013
@@ -1273,6 +1273,7 @@
 	enum ast_rtp_dtmf_mode dmode;
 	format_t codec0 = 0, codec1 = 0;
 	int unlock_chans = 1;
+	int read_ptime0, read_ptime1, write_ptime0, write_ptime1;
 
 	/* Lock both channels so we can look for the glue that binds them together */
 	ast_channel_lock(c0);
@@ -1348,6 +1349,18 @@
 	codec1 = glue1->get_codec ? glue1->get_codec(c1) : 0;
 	if (codec0 && codec1 && !(codec0 & codec1)) {
 		ast_debug(1, "Channel codec0 = %s is not codec1 = %s, cannot native bridge in RTP.\n", ast_getformatname(codec0), ast_getformatname(codec1));
+		res = AST_BRIDGE_FAILED_NOWARN;
+		goto done;
+	}
+
+	read_ptime0 = (ast_codec_pref_getsize(&instance0->codecs.pref, c0->rawreadformat)).cur_ms;
+	read_ptime1 = (ast_codec_pref_getsize(&instance1->codecs.pref, c1->rawreadformat)).cur_ms;
+	write_ptime0 = (ast_codec_pref_getsize(&instance0->codecs.pref, c0->rawwriteformat)).cur_ms;
+	write_ptime1 = (ast_codec_pref_getsize(&instance1->codecs.pref, c1->rawwriteformat)).cur_ms;
+
+	if (read_ptime0 != write_ptime1 || read_ptime1 != write_ptime0) {
+		ast_debug(1, "Packetization differs between RTP streams (%d != %d or %d != %d). Cannot native bridge in RTP\n",
+				read_ptime0, write_ptime1, read_ptime1, write_ptime0);
 		res = AST_BRIDGE_FAILED_NOWARN;
 		goto done;
 	}




More information about the svn-commits mailing list