[asterisk-commits] russell: trunk r203962 - /trunk/main/app.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jun 27 05:04:58 CDT 2009


Author: russell
Date: Sat Jun 27 05:04:51 2009
New Revision: 203962

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=203962
Log:
Only update total silence counter after a counter reset.

(closes issue #2264)
Reported by: pfn
Patches:
      silent-vm-1.6.2-fix2.txt uploaded by pfn (license 810)
Tested by: pfn

Modified:
    trunk/main/app.c

Modified: trunk/main/app.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/app.c?view=diff&rev=203962&r1=203961&r2=203962
==============================================================================
--- trunk/main/app.c (original)
+++ trunk/main/app.c Sat Jun 27 05:04:51 2009
@@ -700,6 +700,7 @@
 	struct ast_dsp *sildet = NULL;   /* silence detector dsp */
 	int totalsilence = 0;
 	int dspsilence = 0;
+	int olddspsilence = 0;
 	int rfmt = 0;
 	struct ast_silence_generator *silgen = NULL;
 	char prependfile[80];
@@ -826,7 +827,10 @@
 				if (maxsilence > 0) {
 					dspsilence = 0;
 					ast_dsp_silence(sildet, f, &dspsilence);
-					totalsilence += dspsilence;
+					if (olddspsilence > dspsilence) {
+						totalsilence += olddspsilence;
+					}
+					olddspsilence = dspsilence;
 
 					if (dspsilence > maxsilence) {
 						/* Ended happily with silence */
@@ -906,6 +910,10 @@
 
 	if (!prepend) {
 		/* Reduce duration by a total silence amount */
+		if (olddspsilence <= dspsilence) {
+			totalsilence += dspsilence;
+		}
+
         	if (totalsilence > 0)
 			*duration -= (totalsilence - 200) / 1000;
 		if (*duration < 0) {




More information about the asterisk-commits mailing list