[asterisk-commits] branch bweschke/bug_5374 - r7680 /team/bweschke/bug_5374/channel.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Dec 30 11:45:22 CST 2005


Author: bweschke
Date: Fri Dec 30 11:45:21 2005
New Revision: 7680

URL: http://svn.digium.com/view/asterisk?rev=7680&view=rev
Log:
 Bring changes in to channel.c from original app_meetme optimizations from /trunk r7547


Modified:
    team/bweschke/bug_5374/channel.c

Modified: team/bweschke/bug_5374/channel.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/channel.c?rev=7680&r1=7679&r2=7680&view=diff
==============================================================================
--- team/bweschke/bug_5374/channel.c (original)
+++ team/bweschke/bug_5374/channel.c Fri Dec 30 11:45:21 2005
@@ -1769,7 +1769,7 @@
 	return ret;
 }
 
-struct ast_frame *ast_read(struct ast_channel *chan)
+static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
 {
 	struct ast_frame *f = NULL;
 	int blah;
@@ -1893,7 +1893,10 @@
 
 
 	if (f && (f->frametype == AST_FRAME_VOICE)) {
-		if (!(f->subclass & chan->nativeformats)) {
+		if (dropaudio) {
+			ast_frfree(f);
+			f = &null_frame;
+		} else if (!(f->subclass & chan->nativeformats)) {
 			/* This frame can't be from the current native formats -- drop it on the
 			   floor */
 			ast_log(LOG_NOTICE, "Dropping incompatible voice frame on %s of format %s since our native format has changed to %s\n", chan->name, ast_getformatname(f->subclass), ast_getformatname(chan->nativeformats));
@@ -1982,6 +1985,15 @@
 		chan->fin++;
 	ast_mutex_unlock(&chan->lock);
 	return f;
+}
+
+struct ast_frame *ast_read(struct ast_channel *chan)
+{
+	return __ast_read(chan, 0);
+}
+
+struct ast_frame *ast_read_noaudio(struct ast_channel *chan)
+	return __ast_read(chan, 1);
 }
 
 int ast_indicate(struct ast_channel *chan, int condition)
@@ -2233,7 +2245,12 @@
 		break;
 	default:
 		if (chan->tech->write) {
-			f = (chan->writetrans) ? ast_translate(chan->writetrans, fr, 0) : fr;
+			/* Bypass translator if we're writing format in the raw write format. This
+			   allows mixing of native / non-native formats */
+			if (fr->subclass == chan->rawwriteformat)
+				f = fr;
+			else
+				f = (chan->writetrans) ? ast_translate(chan->writetrans, fr, 0) : fr;
 			if (f) {
 				if (f->frametype == AST_FRAME_VOICE && chan->spies)
 					queue_frame_to_spies(chan, f, SPY_WRITE);



More information about the asterisk-commits mailing list