]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
audiod: Improve get_time_string().
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 1 Apr 2016 23:12:08 +0000 (01:12 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 10 Apr 2016 12:43:19 +0000 (14:43 +0200)
If the stream start time announced by para_server is newer than the
time para_audiod started the receiver, we assume that para_audiod
was started in the middle of an audio stream and adjust the play
time accordingly.

However, the server stream time can also be newer due to clock
differences or network hiccups. This patch changes audiod to apply
the adjustment only if the time difference is large.

audiod.c

index 7be40de04dc9f9ef6fbd1f89bbf43838dc955c69..5909859be6384604513185afebbe35e7152e27be 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -363,7 +363,8 @@ char *get_time_string(void)
        if (s->receiver_node->btrn) {
                btr_get_node_start(s->receiver_node->btrn, &rstime);
                ret = tv_diff(&rstime, &sss, &rskip);
-               if (ret > 0) { /* audiod was started in the middle of the stream */
+               if (ret > 0 && rskip.tv_sec > 2) {
+                       /* audiod was started in the middle of the stream */
                        tv_add(&wtime, &rskip, &sum);
                        seconds += sum.tv_sec;
                } else