Commit 0876afaf authored by Simon Morlat's avatar Simon Morlat
Browse files

update ticker synchronizer only when new samples are read from soundcard.

This will allow the ticker to continue to run even if the soundcard is blocked for whatever reason.
parent 212ca580
...@@ -602,21 +602,20 @@ static void au_read_postprocess(MSFilter *f){ ...@@ -602,21 +602,20 @@ static void au_read_postprocess(MSFilter *f){
static void au_read_process(MSFilter *f){ static void au_read_process(MSFilter *f){
au_filter_read_data_t *d=(au_filter_read_data_t*)f->data; au_filter_read_data_t *d=(au_filter_read_data_t*)f->data;
mblk_t *m; mblk_t *m;
bool_t read_something = FALSE;
if (!(d->base.card->read_started=d->base.card->io_unit_started)) { if (!(d->base.card->read_started=d->base.card->io_unit_started)) {
//make sure audio unit is started //make sure audio unit is started
start_audio_unit((au_filter_base_t*)d,f->ticker->time); start_audio_unit((au_filter_base_t*)d,f->ticker->time);
} }
do { ms_mutex_lock(&d->mutex);
ms_mutex_lock(&d->mutex); while((m = getq(&d->rq)) != NULL){
m=getq(&d->rq); d->read_samples += (msgdsize(m) / 2) / d->base.card->nchannels;
ms_mutex_unlock(&d->mutex); ms_queue_put(f->outputs[0],m);
if (m != NULL) { read_something = TRUE;
d->read_samples += (msgdsize(m) / 2) / d->base.card->nchannels; }
ms_queue_put(f->outputs[0],m); ms_mutex_unlock(&d->mutex);
if (read_something) ms_ticker_synchronizer_update(d->ticker_synchronizer, d->read_samples, d->base.card->rate);
ms_ticker_synchronizer_update(d->ticker_synchronizer, d->read_samples, d->base.card->rate);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment