[asterisk-commits] irroot: branch irroot/distrotech-customers r318996 - /team/irroot/distrotech-...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat May 14 11:53:39 CDT 2011
Author: irroot
Date: Sat May 14 11:53:36 2011
New Revision: 318996
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=318996
Log:
Set audio format when format changes
RB:1137
Modified:
team/irroot/distrotech-customers/channels/chan_local.c
Modified: team/irroot/distrotech-customers/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers/channels/chan_local.c?view=diff&rev=318996&r1=318995&r2=318996
==============================================================================
--- team/irroot/distrotech-customers/channels/chan_local.c (original)
+++ team/irroot/distrotech-customers/channels/chan_local.c Sat May 14 11:53:36 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