[svn-commits] rmudgett: trunk r421980 - in /trunk: ./ res/res_musiconhold.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Aug 25 11:16:55 CDT 2014
Author: rmudgett
Date: Mon Aug 25 11:16:52 2014
New Revision: 421980
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=421980
Log:
res_musiconhold: Fix MOH restarting where it left off from the last hold.
Restore code removed by https://reviewboard.asterisk.org/r/3536/ that
introduced a regression that prevents MOH from restarting were it left off
the last time.
ASTERISK-24019 #close
Reported by: Jason Richards
Patches:
jira_asterisk_24019_v1.8.patch (license #5621) patch uploaded by rmudgett
Review: https://reviewboard.asterisk.org/r/3928/
........
Merged revisions 421976 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 421977 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 421978 from http://svn.asterisk.org/svn/asterisk/branches/12
........
Merged revisions 421979 from http://svn.asterisk.org/svn/asterisk/branches/13
Modified:
trunk/ (props changed)
trunk/res/res_musiconhold.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.
Modified: trunk/res/res_musiconhold.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_musiconhold.c?view=diff&rev=421980&r1=421979&r2=421980
==============================================================================
--- trunk/res/res_musiconhold.c (original)
+++ trunk/res/res_musiconhold.c Mon Aug 25 11:16:52 2014
@@ -138,6 +138,8 @@
int sample_queue;
int pos;
int save_pos;
+ int save_total;
+ char name[MAX_MUSICCLASS];
char save_pos_filename[PATH_MAX];
};
@@ -474,11 +476,9 @@
}
}
- /* class is reffed, so we can safely compare it against the (possibly
- * recently unreffed) state->class. The unref was done after the ref
- * of class, so we're sure that they won't point to the same memory
- * by accident. */
- if (state->class != class) {
+ /* Resume MOH from where we left off last time or start from scratch? */
+ if (state->save_total != class->total_files || strcmp(state->name, class->name) != 0) {
+ /* Start MOH from scratch. */
memset(state, 0, sizeof(*state));
if (ast_test_flag(class, MOH_RANDOMIZE) && class->total_files) {
state->pos = ast_random() % class->total_files;
@@ -489,6 +489,9 @@
/* it's possible state is not a new allocation, don't leak old refs */
ao2_replace(state->origwfmt, ast_channel_writeformat(chan));
ao2_replace(state->mohwfmt, ast_channel_writeformat(chan));
+ /* For comparison on restart of MOH (see above) */
+ ast_copy_string(state->name, class->name, sizeof(state->name));
+ state->save_total = class->total_files;
moh_post_start(chan, class->name);
More information about the svn-commits
mailing list