aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authorroot <root@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-11 22:06:47 +0000
committerroot <root@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-11 22:06:47 +0000
commitf66d8e4940272ba97f7a785fbe18df3cd74fdbdd (patch)
treec24cf0399b9336a7ce52c38e5ed236c11e068981 /channel.c
parent4ceeb9b099c9637dbd326cd549a102f83536918a (diff)
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@19391 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rw-r--r--channel.c77
1 files changed, 35 insertions, 42 deletions
diff --git a/channel.c b/channel.c
index 011bdaef3..ae4c747e4 100644
--- a/channel.c
+++ b/channel.c
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
*
@@ -1135,7 +1135,6 @@ static void queue_frame_to_spies(struct ast_channel *chan, struct ast_frame *f,
struct ast_frame *translated_frame = NULL;
struct ast_channel_spy *spy;
struct ast_channel_spy_queue *queue;
- struct ast_channel_spy_queue *other_queue;
struct channel_spy_trans *trans;
struct ast_frame *last;
@@ -1197,48 +1196,42 @@ static void queue_frame_to_spies(struct ast_channel *chan, struct ast_frame *f,
if (queue->samples > SPY_QUEUE_SAMPLE_LIMIT) {
if (ast_test_flag(spy, CHANSPY_TRIGGER_MODE) != CHANSPY_TRIGGER_NONE) {
- other_queue = (dir == SPY_WRITE) ? &spy->read_queue : &spy->write_queue;
-
- if (other_queue->samples == 0) {
- switch (ast_test_flag(spy, CHANSPY_TRIGGER_MODE)) {
- case CHANSPY_TRIGGER_READ:
- if (dir == SPY_WRITE) {
- ast_set_flag(spy, CHANSPY_TRIGGER_WRITE);
- ast_clear_flag(spy, CHANSPY_TRIGGER_READ);
- if (option_debug)
- ast_log(LOG_DEBUG, "Switching spy '%s' on '%s' to write-trigger mode\n",
- spy->type, chan->name);
- }
- break;
- case CHANSPY_TRIGGER_WRITE:
- if (dir == SPY_READ) {
- ast_set_flag(spy, CHANSPY_TRIGGER_READ);
- ast_clear_flag(spy, CHANSPY_TRIGGER_WRITE);
- if (option_debug)
- ast_log(LOG_DEBUG, "Switching spy '%s' on '%s' to read-trigger mode\n",
- spy->type, chan->name);
- }
- break;
+ switch (ast_test_flag(spy, CHANSPY_TRIGGER_MODE)) {
+ case CHANSPY_TRIGGER_READ:
+ if (dir == SPY_WRITE) {
+ ast_set_flag(spy, CHANSPY_TRIGGER_WRITE);
+ ast_clear_flag(spy, CHANSPY_TRIGGER_READ);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Switching spy '%s' on '%s' to write-trigger mode\n",
+ spy->type, chan->name);
}
- if (option_debug)
- ast_log(LOG_DEBUG, "Triggering queue flush for spy '%s' on '%s'\n",
- spy->type, chan->name);
- ast_set_flag(spy, CHANSPY_TRIGGER_FLUSH);
- ast_cond_signal(&spy->trigger);
- ast_mutex_unlock(&spy->lock);
- continue;
+ break;
+ case CHANSPY_TRIGGER_WRITE:
+ if (dir == SPY_READ) {
+ ast_set_flag(spy, CHANSPY_TRIGGER_READ);
+ ast_clear_flag(spy, CHANSPY_TRIGGER_WRITE);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Switching spy '%s' on '%s' to read-trigger mode\n",
+ spy->type, chan->name);
+ }
+ break;
+ }
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Triggering queue flush for spy '%s' on '%s'\n",
+ spy->type, chan->name);
+ ast_set_flag(spy, CHANSPY_TRIGGER_FLUSH);
+ ast_cond_signal(&spy->trigger);
+ } else {
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Spy '%s' on channel '%s' %s queue too long, dropping frames\n",
+ spy->type, chan->name, (dir == SPY_READ) ? "read" : "write");
+ while (queue->samples > SPY_QUEUE_SAMPLE_LIMIT) {
+ struct ast_frame *drop = queue->head;
+
+ queue->samples -= drop->samples;
+ queue->head = drop->next;
+ ast_frfree(drop);
}
- }
-
- if (option_debug)
- ast_log(LOG_DEBUG, "Spy '%s' on channel '%s' %s queue too long, dropping frames\n",
- spy->type, chan->name, (dir == SPY_READ) ? "read" : "write");
- while (queue->samples > SPY_QUEUE_SAMPLE_LIMIT) {
- struct ast_frame *drop = queue->head;
-
- queue->samples -= drop->samples;
- queue->head = drop->next;
- ast_frfree(drop);
}
} else {
switch (ast_test_flag(spy, CHANSPY_TRIGGER_MODE)) {