[asterisk-commits] dvossel: branch dvossel/hd_confbridge r311361 - /team/dvossel/hd_confbridge/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 18 11:21:19 CDT 2011


Author: dvossel
Date: Fri Mar 18 11:21:11 2011
New Revision: 311361

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311361
Log:
Fixes some MOH issues.

I encountered some MOH bugs while testing ConfBridge.  These issues
only relate to TRUNK an will get merged with the ConfBridge branch.

Modified:
    team/dvossel/hd_confbridge/res/res_musiconhold.c

Modified: team/dvossel/hd_confbridge/res/res_musiconhold.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/res/res_musiconhold.c?view=diff&rev=311361&r1=311360&r2=311361
==============================================================================
--- team/dvossel/hd_confbridge/res/res_musiconhold.c (original)
+++ team/dvossel/hd_confbridge/res/res_musiconhold.c Fri Mar 18 11:21:11 2011
@@ -375,6 +375,12 @@
 			ast_channel_unlock(chan);
 			state->samples += f->samples;
 			state->sample_queue -= f->samples;
+			/* It is possible that while MOH is playing that the internal write format will change on a channel.
+			 * This must be detected, stored off, and restored once MOH is released */
+			if (ast_format_cmp(&chan->writeformat, &f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
+				ast_format_copy(&state->origwfmt, &chan->writeformat);
+				ast_set_write_format(chan, &f->subclass.format);
+			}
 			res = ast_write(chan, f);
 			ast_frfree(f);
 			if (res < 0) {
@@ -418,7 +424,7 @@
 	}
 
 	state->class = mohclass_ref(class, "Reffing music class for channel");
-	state->origwfmt = chan->writeformat;
+	ast_format_copy(&state->origwfmt, &chan->writeformat);
 	/* For comparison on restart of MOH (see above) */
 	ast_copy_string(state->name, class->name, sizeof(state->name));
 	state->save_total = class->total_files;
@@ -929,7 +935,7 @@
 	}
 
 	if ((res = mohalloc(class))) {
-		res->origwfmt = chan->writeformat;
+		ast_format_copy(&res->origwfmt, &chan->writeformat);
 		if (ast_set_write_format(chan, &class->format)) {
 			ast_log(LOG_WARNING, "Unable to set channel '%s' to format '%s'\n", chan->name, ast_codec2str(&class->format));
 			moh_release(NULL, res);




More information about the asterisk-commits mailing list