[svn-commits] trunk r19349 - in /trunk: ./ channel.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Apr 11 14:50:49 MST 2006


Author: kpfleming
Date: Tue Apr 11 16:50:48 2006
New Revision: 19349

URL: http://svn.digium.com/view/asterisk?rev=19349&view=rev
Log:
Merged revisions 19347 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r19347 | kpfleming | 2006-04-11 16:35:52 -0500 (Tue, 11 Apr 2006) | 2 lines

simplify spy queue flushing logic, and always force a flush when one side gets full, even if the other side is not empty (issue #6457)

........

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

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

Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=19349&r1=19348&r2=19349&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Tue Apr 11 16:50:48 2006
@@ -1271,7 +1271,6 @@
 	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;
 
@@ -1333,48 +1332,42 @@
 
 		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, "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, "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);
+				}
 			}
 		} else {
 			switch (ast_test_flag(spy, CHANSPY_TRIGGER_MODE)) {



More information about the svn-commits mailing list