From 8b899dbc55d696027cd612075f1d4fe39809ce27 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 15 Feb 2022 15:32:09 +0100 Subject: [PATCH] alsa: make sure we always trigger a timeout If we get an error from get_status() make sure program the timer for one period or else we would just end up with silence. --- spa/plugins/alsa/alsa-pcm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index a30be6cb3..a0d84bebe 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -2320,8 +2320,11 @@ static void alsa_on_timeout_event(struct spa_source *source) current_time = state->next_time; - if (SPA_UNLIKELY(get_status(state, current_time, &delay, &target) < 0)) - return; + if (SPA_UNLIKELY(get_status(state, current_time, &delay, &target) < 0)) { + spa_log_error(state->log, "get_status error"); + state->next_time += state->threshold * 1e9 / state->rate; + goto done; + } #ifndef FASTPATH if (SPA_UNLIKELY(spa_log_level_enabled(state->log, SPA_LOG_LEVEL_TRACE))) { @@ -2341,6 +2344,7 @@ static void alsa_on_timeout_event(struct spa_source *source) else handle_capture(state, current_time, delay, target); +done: set_timeout(state, state->next_time); }