diff options
author | matteo <matteo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-03-17 18:11:33 +0000 |
---|---|---|
committer | matteo <matteo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-03-17 18:11:33 +0000 |
commit | a35985c2424dcc63dd5ce8289fb4b5a69c5f9eb1 (patch) | |
tree | 5df8a3af7419e5c1d78c484fdb5963b786b5311e /res | |
parent | 022ff5277e248d54419f53afb75cd14d734a082a (diff) |
lun mar 17 19:11:15 CET 2003
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@649 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rwxr-xr-x | res/res_musiconhold.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 5c59e2e19..ab347f9d4 100755 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -84,7 +84,6 @@ struct mohclass { struct mohdata { int pipe[2]; - int origrfmt; int origwfmt; struct mohclass *parent; struct mohdata *next; @@ -348,12 +347,10 @@ static void moh_release(struct ast_channel *chan, void *data) ast_pthread_mutex_unlock(&moh_lock); close(moh->pipe[0]); close(moh->pipe[1]); - oldrfmt = moh->origrfmt; oldwfmt = moh->origwfmt; free(moh); if (chan) { - if (ast_set_write_format(chan, oldwfmt) || - ast_set_read_format(chan, oldrfmt)) + if (ast_set_write_format(chan, oldwfmt)) ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %d/%d\n", chan->name, oldwfmt, oldrfmt); if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Stopped music on hold on %s\n", chan->name); @@ -375,16 +372,11 @@ static void *moh_alloc(struct ast_channel *chan, void *params) } ast_pthread_mutex_unlock(&moh_lock); if (res) { - res->origrfmt = chan->readformat; res->origwfmt = chan->writeformat; if (ast_set_write_format(chan, AST_FORMAT_SLINEAR)) { ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format\n", chan->name); moh_release(NULL, res); res = NULL; - } else if (ast_set_read_format(chan, AST_FORMAT_SLINEAR)) { - ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format\n", chan->name); - moh_release(NULL, res); - res = NULL; } #if 0 /* Allow writes to interrupt */ @@ -402,6 +394,8 @@ static int moh_generate(struct ast_channel *chan, void *data, int len, int sampl struct mohdata *moh = data; short buf[640 + AST_FRIENDLY_OFFSET / 2]; int res; + + len = samples * 2; if (len > sizeof(buf)) { ast_log(LOG_WARNING, "Only doing %d of %d requested bytes on %s\n", sizeof(buf), len, chan->name); len = sizeof(buf); |