From 86f911c2fdcf5bacf47326baf525a61b28074db8 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Fri, 23 May 2014 16:55:28 +0100 Subject: [PATCH] ignore silent frames substituted for missing frames. --- player.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/player.c b/player.c index 1f9c5fe9..cf1c2428 100644 --- a/player.c +++ b/player.c @@ -463,6 +463,7 @@ static abuf_t *buffer_get_frame(void) { // debug(1, "missing frame %04X. Supplying a silent frame.", read); missing_packets++; memset(curframe->data, 0, FRAME_BYTES(frame_size)); + curframe->timestamp=0; } curframe->ready = 0; pthread_mutex_unlock(&ab_mutex); @@ -668,11 +669,14 @@ static void *player_thread_func(void *arg) { } // this is the actual delay, which will fluctuate a good bit about a potentially rising or falling trend. int64_t delay = td_in_frames+rt-(nt-current_delay); + + int64_t sync_error = delay-config.latency; - if ((! please_stop) && (abs(delay-config.latency)>441*3)) { // 30 ms - debug(1,"Lost sync with source -- flushing and resyncing. Error of %lld frames.",delay-config.latency); - player_flush(nt); - } + // timestamp of zero means an inserted silent frame in place of a missing frame + if ((inframe->timestamp!=0) && (! please_stop) && (abs(sync_error)>441*3)) { // 30 ms + debug(1,"Lost sync with source -- flushing and resyncing. Error of %lld frames.",sync_error); + player_flush(nt); + } // if ((play_number<(10)) || (play_number%500==0)) // if ((play_number<(10)))