X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffmpeg_capture.cpp;h=42bdb2f765d65b18e69a2543793a08ad38590cfc;hb=b9feb66845bf24465b7671ac9ff7a52b88f6032b;hp=1ffa9d5418dc8d16cf215fb84892346c89084cb8;hpb=8f86bc5c54efd2763deb5e34e69512db650e5658;p=nageru 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) {