X-Git-Url: https://git.sesse.net/?p=nageru;a=blobdiff_plain;f=ffmpeg_capture.cpp;h=9a151b60d044c9eb038cdcc7a8c74b5a98e7bbd5;hp=1a6703eb5c8d36d19984608fca7212254e35ba93;hb=804bfa72263942d9beebe749ef0c8dc07a811413;hpb=1865abf9f8180e466513913c9433eb0e206c77f3 diff --git a/ffmpeg_capture.cpp b/ffmpeg_capture.cpp index 1a6703e..9a151b6 100644 --- a/ffmpeg_capture.cpp +++ b/ffmpeg_capture.cpp @@ -425,6 +425,12 @@ bool FFmpegCapture::play_video(const string &pathname) fprintf(stderr, "%s: Rewind failed, not looping.\n", pathname.c_str()); return true; } + if (video_codec_ctx != nullptr) { + avcodec_flush_buffers(video_codec_ctx.get()); + } + if (audio_codec_ctx != nullptr) { + avcodec_flush_buffers(audio_codec_ctx.get()); + } // If the file has changed since last time, return to get it reloaded. // Note that depending on how you move the file into place, you might // end up corrupting the one you're already playing, so this path