From: Andre Noll Date: Fri, 1 Apr 2016 23:12:08 +0000 (+0200) Subject: audiod: Improve get_time_string(). X-Git-Tag: v0.5.6~21^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=087487f7d8ed1f0f32d0f28538127d9bee3d50f8 audiod: Improve get_time_string(). 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. --- diff --git a/audiod.c b/audiod.c index 7be40de0..5909859b 100644 --- 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