]> git.sesse.net Git - nageru/commitdiff
Fix a bug when looping FFmpeg inputs that have no audio.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 17 Mar 2018 15:14:41 +0000 (16:14 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 17 Mar 2018 15:14:41 +0000 (16:14 +0100)
bmusb
ffmpeg_capture.cpp

diff --git a/bmusb b/bmusb
index 6a012a41c5422092cdac1f18a9019f37c0b85368..e85d7ee1c0541900c57dd505454289dfaab9e782 160000 (submodule)
--- a/bmusb
+++ b/bmusb
@@ -1 +1 @@
-Subproject commit 6a012a41c5422092cdac1f18a9019f37c0b85368
+Subproject commit e85d7ee1c0541900c57dd505454289dfaab9e782
index 1ffa9d5418dc8d16cf215fb84892346c89084cb8..42bdb2f765d65b18e69a2543793a08ad38590cfc 100644 (file)
@@ -381,8 +381,9 @@ bool FFmpegCapture::play_video(const string &pathname)
                video_codec_ctx.get(), avcodec_close);
 
        // Open audio decoder, if we have audio.
-       AVCodecContextWithDeleter audio_codec_ctx = avcodec_alloc_context3_unique(nullptr);
+       AVCodecContextWithDeleter audio_codec_ctx;
        if (audio_stream_index != -1) {
+               audio_codec_ctx = avcodec_alloc_context3_unique(nullptr);
                const AVCodecParameters *audio_codecpar = format_ctx->streams[audio_stream_index]->codecpar;
                audio_timebase = format_ctx->streams[audio_stream_index]->time_base;
                if (avcodec_parameters_to_context(audio_codec_ctx.get(), audio_codecpar) < 0) {