aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_mixmonitor.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-03 23:30:37 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-03 23:30:37 +0000
commitc345657f48f506680d121ac479fe46af663d2ba3 (patch)
treeb469e85436e1552e41576dfd5a3045a35456e1bc /apps/app_mixmonitor.c
parent96aba6e67cfa62a6b6052d74e154f02434ecf929 (diff)
Make the difference clear about what the responsibilities of the core and a spy are when it comes to spying on a channel. The core is responsible for adding a spy to a channel, feeding frames into the spy, removing the spy from the channel, and notifying the spy that is has been detached. The spy is responsible for reading frames in, and cleaning itself up. Each side will not try to do the other's job.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@41959 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_mixmonitor.c')
-rw-r--r--apps/app_mixmonitor.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c
index aa7602f65..5038776a3 100644
--- a/apps/app_mixmonitor.c
+++ b/apps/app_mixmonitor.c
@@ -122,23 +122,6 @@ AST_APP_OPTIONS(mixmonitor_opts, {
AST_APP_OPTION_ARG('W', MUXFLAG_VOLUME, OPT_ARG_VOLUME),
});
-static void stopmon(struct ast_channel_spy *spy)
-{
- struct ast_channel *chan = spy->chan;
-
- /* If our status has changed to DONE, then the channel we're spying on is gone....
- DON'T TOUCH IT!!! RUN AWAY!!! */
- if (spy->status == CHANSPY_DONE)
- return;
-
- if (!chan)
- return;
-
- ast_channel_lock(chan);
- ast_channel_spy_remove(chan, spy);
- ast_channel_unlock(chan);
-}
-
static int startmon(struct ast_channel *chan, struct ast_channel_spy *spy)
{
struct ast_channel *peer;
@@ -176,9 +159,8 @@ static void *mixmonitor_thread(void *obj)
ast_channel_spy_trigger_wait(&mixmonitor->spy);
- if (!mixmonitor->spy.chan || mixmonitor->spy.status != CHANSPY_RUNNING) {
+ if (!mixmonitor->spy.chan || mixmonitor->spy.status != CHANSPY_RUNNING)
break;
- }
while (1) {
if (!(f = ast_channel_spy_read_frame(&mixmonitor->spy, SAMPLES_PER_FRAME)))
@@ -194,15 +176,15 @@ static void *mixmonitor_thread(void *obj)
next = AST_LIST_NEXT(f, frame_list);
if (write)
ast_writestream(mixmonitor->fs, f);
- ast_frfree(f);
+ ast_frame_free(f, 0);
}
}
}
ast_mutex_unlock(&mixmonitor->spy.lock);
-
- stopmon(&mixmonitor->spy);
+ ast_channel_spy_free(&mixmonitor->spy);
+
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "End MixMonitor Recording %s\n", mixmonitor->name);
@@ -211,8 +193,6 @@ static void *mixmonitor_thread(void *obj)
ast_verbose(VERBOSE_PREFIX_2 "Executing [%s]\n", mixmonitor->post_process);
ast_safe_system(mixmonitor->post_process);
}
-
- ast_mutex_destroy(&mixmonitor->spy.lock);
ast_closestream(mixmonitor->fs);