[asterisk-commits] russell: branch 1.4 r81042 - /branches/1.4/res/res_musiconhold.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 27 11:16:26 CDT 2007


Author: russell
Date: Mon Aug 27 11:16:25 2007
New Revision: 81042

URL: http://svn.digium.com/view/asterisk?view=rev&rev=81042
Log:
(closes issue #10419)
Reported by: mustardman
Patches:
      asterisk-mohposition.diff.txt uploaded by jamesgolovich (license 176)

This patch fixes a few problems with music on hold.
 * Fix issues with starting at the beginning of a file when it shouldn't.
 * Fix the inuse counter to be decremented even if the class had not been
   set to be deleted when not in use anymore
 * Don't arbitrarily limit the number of MOH files to 255

Modified:
    branches/1.4/res/res_musiconhold.c

Modified: branches/1.4/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_musiconhold.c?view=diff&rev=81042&r1=81041&r2=81042
==============================================================================
--- branches/1.4/res/res_musiconhold.c (original)
+++ branches/1.4/res/res_musiconhold.c Mon Aug 27 11:16:25 2007
@@ -118,8 +118,8 @@
 	int origwfmt;
 	int samples;
 	int sample_queue;
-	unsigned char pos;
-	unsigned char save_pos;
+	int pos;
+	int save_pos;
 };
 
 #define MOH_QUIET		(1 << 0)
@@ -215,7 +215,7 @@
 		}
 		state->save_pos = state->pos;
 	}
-	if (state->class->delete && ast_atomic_dec_and_test(&state->class->inuse))
+	if (ast_atomic_dec_and_test(&state->class->inuse) && state->class->delete)
 		ast_moh_destroy_one(state->class);
 }
 
@@ -232,9 +232,9 @@
 	}
 
 	/* If a specific file has been saved, use it */
-	if (state->save_pos) {
+	if (state->save_pos >= 0) {
 		state->pos = state->save_pos;
-		state->save_pos = 0;
+		state->save_pos = -1;
 	} else if (ast_test_flag(state->class, MOH_RANDOMIZE)) {
 		/* Get a random file and ensure we can open it */
 		for (tries = 0; tries < 20; tries++) {




More information about the asterisk-commits mailing list