From: Steinar H. Gunderson Date: Sat, 17 Mar 2018 15:14:41 +0000 (+0100) Subject: Fix a bug when looping FFmpeg inputs that have no audio. X-Git-Tag: 1.7.1~19 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=54171389c54dea3caf19ffb3abec1e72ae0531e2 Fix a bug when looping FFmpeg inputs that have no audio. --- diff --git a/bmusb b/bmusb index 6a012a4..e85d7ee 160000 --- a/bmusb +++ b/bmusb @@ -1 +1 @@ -Subproject commit 6a012a41c5422092cdac1f18a9019f37c0b85368 +Subproject commit e85d7ee1c0541900c57dd505454289dfaab9e782 diff --git a/ffmpeg_capture.cpp b/ffmpeg_capture.cpp index 1ffa9d5..42bdb2f 100644 --- a/ffmpeg_capture.cpp +++ b/ffmpeg_capture.cpp @@ -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) {