]> git.sesse.net Git - nageru/commitdiff
Add a failsafe for interrupted FFmpeg streams.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 9 Mar 2019 21:00:40 +0000 (22:00 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 9 Mar 2019 21:00:40 +0000 (22:00 +0100)
nageru/ffmpeg_capture.cpp

index 1c7a30f2e82e1245574174420a145c7fa8b8ee0f..722d313da4d65cdc6efb3c0fab692d70fb763cf5 100644 (file)
@@ -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;