]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
audiod: Avoid delay in status transition from standby to on.
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 25 Nov 2021 19:25:43 +0000 (20:25 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 14 Feb 2022 15:29:25 +0000 (16:29 +0100)
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
audiod.c

index 88599c3fa297337b6a3f598b31f92d6e6b4b0993..7293285ef9687ee1c35fd46bfb735a73f6870ec0 100644 (file)
--- 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);
 }