From: Andre Noll Date: Thu, 25 Nov 2021 19:25:43 +0000 (+0100) Subject: audiod: Avoid delay in status transition from standby to on. X-Git-Tag: v0.7.0~7 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=30f67968151619955b2e998c5ce1d4183055fcfa audiod: Avoid delay in status transition from standby to on. In close_receiver() we invalidate the current audio format value to prevent the receiver from re-starting too quickly. See commit 2d61a8005c74 (audiod: Invalidate current audio format on close) from seven years ago for details. This invalidation happens in particular when the receiver is closed because audiod was told to enter standby mode. If audiod is switched back on shortly thereafter, no receiver can't be started because we forgot the current audio format and must wait up to one minute until the next status item dump arrives from the server which re-initializes the current audio format value. Fix this flaw by only invalidating the current audio format when audiod operates in "on" mode. Fixes: 2d61a8005c74 --- diff --git a/audiod.c b/audiod.c index 88599c3f..7293285e 100644 --- a/audiod.c +++ b/audiod.c @@ -445,7 +445,8 @@ static void close_receiver(int slot_num) task_reap(&s->receiver_node->task); free(s->receiver_node); s->receiver_node = NULL; - stat_task->current_audio_format_num = -1; + if (audiod_status == AUDIOD_ON) + stat_task->current_audio_format_num = -1; tv_add(now, &(struct timeval)EMBRACE(0, 200 * 1000), &a->restart_barrier); }