[svn-commits] irroot: branch irroot/distrotech-customers-10 r333484 - /team/irroot/distrote...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Aug 27 03:49:14 CDT 2011


Author: irroot
Date: Sat Aug 27 03:49:10 2011
New Revision: 333484

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=333484
Log:
Adjust formats of chan_local when channel we proxying changes RB1137

Modified:
    team/irroot/distrotech-customers-10/channels/chan_local.c

Modified: team/irroot/distrotech-customers-10/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-10/channels/chan_local.c?view=diff&rev=333484&r1=333483&r2=333484
==============================================================================
--- team/irroot/distrotech-customers-10/channels/chan_local.c (original)
+++ team/irroot/distrotech-customers-10/channels/chan_local.c Sat Aug 27 03:49:10 2011
@@ -587,6 +587,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;
 
@@ -601,6 +602,20 @@
 
 	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 && !ast_format_cap_identical(bridge->nativeformats, ast->nativeformats)) {
+			ast_format_cap_copy(bridge->nativeformats, p->owner->nativeformats);
+			ast_set_read_format(ast, &ast->readformat);
+			ast_set_write_format(ast, &ast->writeformat);
+			ast_channel_lock(p->chan);
+			ast_format_cap_copy(bridge->nativeformats, p->chan->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)) {




More information about the svn-commits mailing list