From 12a49f3988eae5868d89b79b7ad2da0c90c29d1d Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 9 Mar 2019 22:00:40 +0100 Subject: [PATCH] Add a failsafe for interrupted FFmpeg streams. --- nageru/ffmpeg_capture.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nageru/ffmpeg_capture.cpp b/nageru/ffmpeg_capture.cpp index 1c7a30f..722d313 100644 --- a/nageru/ffmpeg_capture.cpp +++ b/nageru/ffmpeg_capture.cpp @@ -451,6 +451,10 @@ bool FFmpegCapture::play_video(const string &pathname) if (process_queued_commands(format_ctx.get(), pathname, last_modified, /*rewound=*/nullptr)) { return true; } + if (should_interrupt.load()) { + // Check as a failsafe, so that we don't need to rely on avio if we don't have to. + return false; + } UniqueFrame audio_frame = audio_frame_allocator->alloc_frame(); AudioFormat audio_format; -- 2.39.2