Stop video filters emitting frames from the old position just
authorCarl Hetherington <cth@carlh.net>
Sun, 5 May 2019 22:23:40 +0000 (22:23 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 5 May 2019 22:23:40 +0000 (22:23 +0000)
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

index ce20997..edc0b08 100644 (file)
@@ -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());
        }