audiod: Set the audio format restart barrier also when closing the receiver.
authorAndre Noll <maan@systemlinux.org>
Sun, 4 Jul 2010 21:27:37 +0000 (23:27 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 4 Jul 2010 21:27:37 +0000 (23:27 +0200)
When the current audio file changes, it may happen that para_audiod's receiver
detects the EOF condition before the status has been updated to reflect the file
change. In this case, para_audiod might restart the old receiver even if a
different audio format is about to be streamed next.

This patch adds a per audio format 200ms delay which starts at receiver close time.
During this time interval the receiver for this audio format will not be started again.

audiod.c

index 5c17e6eab1337d8b23584faa67f443cd4f11a200..668b0f744cf316d3c1b8ad916845831f3c88b2d0 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -358,6 +358,8 @@ static void close_receiver(int slot_num)
        btr_free_node(s->receiver_node->btrn);
        free(s->receiver_node);
        s->receiver_node = NULL;
        btr_free_node(s->receiver_node->btrn);
        free(s->receiver_node);
        s->receiver_node = NULL;
+       tv_add(now, &(struct timeval)EMBRACE(0, 200 * 1000),
+               &a->restart_barrier);
 }
 
 static void writer_cleanup(struct writer_node *wn)
 }
 
 static void writer_cleanup(struct writer_node *wn)