[asterisk-commits] mmichelson: branch 1.4 r114106 - /branches/1.4/main/channel.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 14 09:58:03 CDT 2008
Author: mmichelson
Date: Mon Apr 14 09:58:02 2008
New Revision: 114106
URL: http://svn.digium.com/view/asterisk?view=rev&rev=114106
Log:
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:
branches/1.4/main/channel.c
Modified: branches/1.4/main/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/channel.c?view=diff&rev=114106&r1=114105&r2=114106
==============================================================================
--- branches/1.4/main/channel.c (original)
+++ branches/1.4/main/channel.c Mon Apr 14 09:58:02 2008
@@ -1887,6 +1887,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;
if (chan->timingfunc) {
@@ -1896,6 +1897,9 @@
}
chan->generatordata = NULL; /* reset, to let writes go through */
+ 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
* call ast_write() in their generate callback.
@@ -1905,7 +1909,7 @@
* avoidance not to work in deeper functions
*/
ast_channel_unlock(chan);
- res = chan->generator->generate(chan, tmp, f->datalen, f->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