[asterisk-commits] irroot: branch irroot/t38gateway-1.8 r320945 - /team/irroot/t38gateway-1.8/ch...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 26 04:34:02 CDT 2011


Author: irroot
Date: Thu May 26 04:33:50 2011
New Revision: 320945

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=320945
Log:
Merge codec fixup lock sanity

Modified:
    team/irroot/t38gateway-1.8/channels/chan_local.c

Modified: team/irroot/t38gateway-1.8/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/t38gateway-1.8/channels/chan_local.c?view=diff&rev=320945&r1=320944&r2=320945
==============================================================================
--- team/irroot/t38gateway-1.8/channels/chan_local.c (original)
+++ team/irroot/t38gateway-1.8/channels/chan_local.c Thu May 26 04:33:50 2011
@@ -532,19 +532,25 @@
 	}
 	ao2_ref(p, 1); /* ref for local_queue_frame */
 
-	/* fixup formats nativeformat has changed we must adjust */
-	if ((bridge = ast_bridged_channel(p->owner)) && (!(bridge->nativeformats &  p->owner->nativeformats))) {
-		p->chan->nativeformats = bridge->nativeformats;
-		p->owner->nativeformats = bridge->nativeformats;
-		ast_set_read_format(p->owner, p->owner->readformat);
-		ast_set_write_format(p->owner, p->owner->writeformat);
-		ast_set_read_format(p->chan, p->chan->readformat);
-		ast_set_write_format(p->chan, p->chan->writeformat);
-	}
-
 	isoutbound = IS_OUTBOUND(ast, p);
-	if (isoutbound && f && (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_VIDEO))
+	if (isoutbound && f && (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_VIDEO)) {
 		check_bridge(p);
+	} else if (!isoutbound) {
+		/* fixup formats nativeformat has changed we must adjust
+		 * ast is p->owner and is locked here*/
+		bridge = ast_bridged_channel(ast);
+		if (!(bridge->nativeformats & ast->nativeformats)) {
+			ast->nativeformats = bridge->nativeformats;
+			ast_set_read_format(ast, ast->readformat);
+			ast_set_write_format(ast, ast->writeformat);
+			ast_channel_lock(p->chan);
+			p->chan->nativeformats = bridge->nativeformats;
+			ast_set_read_format(p->chan, p->chan->readformat);
+			ast_set_write_format(p->chan, p->chan->writeformat);
+			ast_channel_unlock(p->chan);
+		}
+	}
+
 	if (!ast_test_flag(p, LOCAL_ALREADY_MASQED))
 		res = local_queue_frame(p, isoutbound, f, ast, 1);
 	else {




More information about the asterisk-commits mailing list