From cfe58ccc065175438ad85f71ed2e3592481f8d82 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 26 Jan 2024 14:48:55 -0700 Subject: [PATCH] Improve sync when seeking --- src/player.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/player.rs b/src/player.rs index 4add82a..e36a832 100644 --- a/src/player.rs +++ b/src/player.rs @@ -588,9 +588,18 @@ fn ffmpeg_thread>( ictx.seek(timestamp, timestamp..)?; } - //TODO: improve sync when seeking // Clear audio sync time sync_time_opt = None; + // Clear audio and video queues + { + let mut audio_queue = audio_queue_lock.lock().unwrap(); + audio_queue.data.clear(); + } + { + //TODO: clear pending data stuck in channels + let mut video_queue = video_queue_lock.lock().unwrap(); + video_queue.data.clear(); + } } } }