[asterisk-commits] mmichelson: trunk r114107 - in /trunk: ./ main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 14 10:01:36 CDT 2008


Author: mmichelson
Date: Mon Apr 14 10:01:36 2008
New Revision: 114107

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114107
Log:
Merged revisions 114106 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114106 | mmichelson | 2008-04-14 09:58:02 -0500 (Mon, 14 Apr 2008) | 5 lines

Save a local copy of the generate callback prior to unlocking the channel in
case the generate callback goes NULL on us after the channel is unlocked. Thanks
to Russell for pointing this need out to me.


........

Modified:
    trunk/   (props changed)
    trunk/main/channel.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=114107&r1=114106&r2=114107
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Mon Apr 14 10:01:36 2008
@@ -2255,6 +2255,7 @@
 {
 	if (chan->generatordata &&  !ast_internal_timing_enabled(chan)) {
 		void *tmp = chan->generatordata;
+		int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples) = NULL;
 		int res;
 		int samples;
 
@@ -2272,6 +2273,10 @@
 			samples = (int) ( ((float) f->samples) * factor );
 		} else {
 			samples = f->samples;
+		}
+		
+		if (chan->generator->generate) {
+			generate = chan->generator->generate;
 		}
 		/* This unlock is here based on two assumptions that hold true at this point in the
 		 * code. 1) this function is only called from within __ast_read() and 2) all generators
@@ -2282,7 +2287,7 @@
 		 * avoidance not to work in deeper functions
 		 */
 		ast_channel_unlock(chan);
-		res = chan->generator->generate(chan, tmp, f->datalen, samples);
+		res = generate(chan, tmp, f->datalen, f->samples);
 		ast_channel_lock(chan);
 		chan->generatordata = tmp;
 		if (res) {




More information about the asterisk-commits mailing list