[asterisk-commits] russell: branch russell/video_on_hold r142674 - /team/russell/video_on_hold/res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 11 21:15:24 CDT 2008
Author: russell
Date: Thu Sep 11 21:15:23 2008
New Revision: 142674
URL: http://svn.digium.com/view/asterisk?view=rev&rev=142674
Log:
track video stream "samples" separately from the audio
Modified:
team/russell/video_on_hold/res/res_musiconhold.c
Modified: team/russell/video_on_hold/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/team/russell/video_on_hold/res/res_musiconhold.c?view=diff&rev=142674&r1=142673&r2=142674
==============================================================================
--- team/russell/video_on_hold/res/res_musiconhold.c (original)
+++ team/russell/video_on_hold/res/res_musiconhold.c Thu Sep 11 21:15:23 2008
@@ -123,6 +123,8 @@
int origwfmt;
int samples;
int sample_queue;
+ int vsamples;
+ int vsample_queue;
int pos;
int save_pos;
char *save_pos_filename;
@@ -272,12 +274,14 @@
}
state->save_pos = -1;
state->samples = 0;
+ state->vsamples = 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;
+ state->vsamples = 0;
}
if (!ast_openstream_full(chan, state->class->filearray[state->pos], chan->language, 1)) {
@@ -299,6 +303,7 @@
if (chan->vstream) {
/* We can't seek a video stream, so we have to start at the beginning */
state->samples = 0;
+ state->vsamples = 0;
} else {
ast_seekstream(chan->stream, state->samples, SEEK_SET);
}
@@ -354,16 +359,21 @@
int res = 0;
state->sample_queue += samples;
-
- while (state->sample_queue > 0) {
+ state->vsample_queue += samples;
+
+ while (state->sample_queue > 0 || state->vsample_queue > 0) {
frs = moh_files_readframe(chan);
if (frs.f) {
- state->samples += frs.f->samples;
- state->sample_queue -= frs.f->samples;
- res = ast_write(chan, frs.f);
+ if (state->sample_queue > 0) {
+ state->samples += frs.f->samples;
+ state->sample_queue -= frs.f->samples;
+ res = ast_write(chan, frs.f);
+ }
ast_frfree(frs.f);
if (frs.vf) {
- if (!res) {
+ if (!res && state->vsample_queue > 0) {
+ state->vsamples += frs.vf->samples;
+ state->vsample_queue -= frs.vf->samples;
res = ast_write_video(chan, frs.vf);
}
ast_frfree(frs.vf);
More information about the asterisk-commits
mailing list