From 72253f423319c8ff727acf3324617c206b984ae1 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 5 May 2019 22:23:40 +0000 Subject: [PATCH] Stop video filters emitting frames from the old position just after a seek. If this happens, we get sequences like 1. emit some video at time 60s 2. seek to 40s 3. video frame emitted from filter at 60.1s; this sets _last_video_time in player so that frames emitted between 40s and 60s are discarded; hence the audio buffers overflow. Should fix #1551. --- src/lib/ffmpeg_decoder.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index ce20997c8..edc0b08d1 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -377,6 +377,14 @@ FFmpegDecoder::seek (ContentTime time, bool accurate) AVSEEK_FLAG_BACKWARD ); + { + /* Force re-creation of filter graphs to reset them and hence to make sure + they don't have any pre-seek frames knocking about. + */ + boost::mutex::scoped_lock lm (_filter_graphs_mutex); + _filter_graphs.clear (); + } + if (video_codec_context ()) { avcodec_flush_buffers (video_codec_context()); } -- 2.30.2