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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat May 14 11:56:52 CDT 2011


Author: irroot
Date: Sat May 14 11:56:48 2011
New Revision: 318997

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=318997
Log:
Set audio format when format changes 

RB:1137


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=318997&r1=318996&r2=318997
==============================================================================
--- team/irroot/t38gateway-1.8/channels/chan_local.c (original)
+++ team/irroot/t38gateway-1.8/channels/chan_local.c Sat May 14 11:56:48 2011
@@ -519,6 +519,7 @@
 static int local_write(struct ast_channel *ast, struct ast_frame *f)
 {
 	struct local_pvt *p = ast->tech_pvt;
+	struct ast_channel *bridge;
 	int res = -1;
 	int isoutbound;
 
@@ -526,8 +527,21 @@
 		return -1;
 
 	/* Just queue for delivery to the other side */
-	ao2_lock(p);
+	while(ao2_trylock(p)) {
+		CHANNEL_DEADLOCK_AVOIDANCE(ast);
+	}
 	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))
 		check_bridge(p);




More information about the asterisk-commits mailing list