[svn-commits] file: branch 1.6.0 r110037 - in /branches/1.6.0: ./ res/res_musiconhold.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Mar 19 14:14:56 CDT 2008
Author: file
Date: Wed Mar 19 14:14:56 2008
New Revision: 110037
URL: http://svn.digium.com/view/asterisk?view=rev&rev=110037
Log:
Merged revisions 110036 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r110036 | file | 2008-03-19 16:13:39 -0300 (Wed, 19 Mar 2008) | 12 lines
Merged revisions 110035 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r110035 | file | 2008-03-19 16:11:33 -0300 (Wed, 19 Mar 2008) | 4 lines
Add sanity checking for position resuming. We *have* to make sure that the position does not exceed the total number of files present, and we have to make sure that the position's filename is the same as previous. These values can change if a music class is reloaded and give unpredictable behavior.
(closes issue #11663)
Reported by: junky
........
................
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/res/res_musiconhold.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/res_musiconhold.c?view=diff&rev=110037&r1=110036&r2=110037
==============================================================================
--- branches/1.6.0/res/res_musiconhold.c (original)
+++ branches/1.6.0/res/res_musiconhold.c Wed Mar 19 14:14:56 2008
@@ -122,6 +122,7 @@
int sample_queue;
int pos;
int save_pos;
+ char *save_pos_filename;
};
#define MOH_QUIET (1 << 0)
@@ -248,8 +249,8 @@
return -1;
}
- /* If a specific file has been saved, use it */
- if (state->save_pos >= 0) {
+ /* If a specific file has been saved confirm it still exists and that it is still valid */
+ if (state->save_pos >= 0 && state->save_pos < state->class->total_files && state->class->filearray[state->save_pos] == state->save_pos_filename) {
state->pos = state->save_pos;
state->save_pos = -1;
} else if (ast_test_flag(state->class, MOH_RANDOMIZE)) {
@@ -259,11 +260,13 @@
if (ast_fileexists(state->class->filearray[state->pos], NULL, NULL) > 0)
break;
}
+ state->save_pos = -1;
state->samples = 0;
} else {
/* This is easy, just increment our position and make sure we don't exceed the total file count */
state->pos++;
state->pos %= state->class->total_files;
+ state->save_pos = -1;
state->samples = 0;
}
@@ -273,6 +276,9 @@
state->pos %= state->class->total_files;
return -1;
}
+
+ /* Record the pointer to the filename for position resuming later */
+ state->save_pos_filename = state->class->filearray[state->pos];
ast_debug(1, "%s Opened file %d '%s'\n", chan->name, state->pos, state->class->filearray[state->pos]);
More information about the svn-commits
mailing list