[asterisk-commits] dhubbard: branch 1.4 r257686 - /branches/1.4/apps/app_mixmonitor.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 16 16:15:48 CDT 2010


Author: dhubbard
Date: Fri Apr 16 16:15:43 2010
New Revision: 257686

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=257686
Log:
Make the mixmonitor thread process audio frames faster

Mantis issue 17078 reports MixMonitor recordings have shorter durations than 
the call duration.  This was because the mixmonitor thread was not processing 
frames from the audiohook fast enough.  The mixmonitor thread would slowly fall 
behind the most recent audio frame and when the channel hangs up, the mixmonitor 
thread would exit without processing the same number of frames as the channel; 
leaving the mixmonitor recording shorter than actual call duration.

This revision fixes this issue by moving the ast_audiohook_trigger_wait() and 
the subsequent audiohook.status check into the block where the 
ast_audiohook_read_frame() function returns NULL.

(closes issue #17078)
Reported by: geoff2010
Patches:
      dw-M17078.patch uploaded by dhubbard (license 733)
Tested by: dhubbard, geoff2010

Review: https://reviewboard.asterisk.org/r/611/

Modified:
    branches/1.4/apps/app_mixmonitor.c

Modified: branches/1.4/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/apps/app_mixmonitor.c?view=diff&rev=257686&r1=257685&r2=257686
==============================================================================
--- branches/1.4/apps/app_mixmonitor.c (original)
+++ branches/1.4/apps/app_mixmonitor.c Fri Apr 16 16:15:43 2010
@@ -256,13 +256,14 @@
 	while (mixmonitor->audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING && !mixmonitor->mixmonitor_ds->fs_quit) {
 		struct ast_frame *fr = NULL;
 
-		ast_audiohook_trigger_wait(&mixmonitor->audiohook);
-
-		if (mixmonitor->audiohook.status != AST_AUDIOHOOK_STATUS_RUNNING)
-			break;
-
-		if (!(fr = ast_audiohook_read_frame(&mixmonitor->audiohook, SAMPLES_PER_FRAME, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR)))
+		if (!(fr = ast_audiohook_read_frame(&mixmonitor->audiohook, SAMPLES_PER_FRAME, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR))) {
+			ast_audiohook_trigger_wait(&mixmonitor->audiohook);
+
+			if (mixmonitor->audiohook.status != AST_AUDIOHOOK_STATUS_RUNNING) {
+				break;
+			}
 			continue;
+		}
 
 		/* audiohook lock is not required for the next block.
 		 * Unlock it, but remember to lock it before looping or exiting */




More information about the asterisk-commits mailing list