From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Thu, 13 May 2021 19:10:38 +0000 (+0100) Subject: fix flush of a large sync error, hopefully. X-Git-Tag: 4.0-dev~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb226a41844dafd052dfb41894f37019da1f9e52;p=thirdparty%2Fshairport-sync.git fix flush of a large sync error, hopefully. --- diff --git a/player.c b/player.c index c8eca4de..1a4d855e 100644 --- a/player.c +++ b/player.c @@ -2305,15 +2305,8 @@ void *player_thread_func(void *arg) { debug(1, "Large positive sync error of: %" PRId64 " frames (%f seconds).", sync_error, (sync_error * 1.0) / config.output_rate); int64_t local_frames_to_drop = sync_error / conn->output_sample_ratio; - uint32_t frames_to_drop_sized = local_frames_to_drop; - - debug_mutex_lock(&conn->flush_mutex, 1000, 1); - conn->flush_rtp_timestamp = - inframe->given_timestamp + - frames_to_drop_sized; // flush all packets up to (and including?) this - reset_input_flow_metrics(conn); - debug_mutex_unlock(&conn->flush_mutex, 3); - + uint32_t frames_to_drop_sized = local_frames_to_drop; + do_flush(inframe->given_timestamp + frames_to_drop_sized, conn); } else if ((sync_error < 0) && ((-sync_error) > filler_length)) { debug(1, "Large negative sync error of: %" PRId64