From 6f832724ef942f133f6f8d0a06d7377beea8f7a6 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 19 May 2021 22:54:19 +0200 Subject: [PATCH] Don't assert on a non-existant codec (#1999). --- src/lib/ffmpeg_examiner.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index 632508e0e..a793c7b98 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -69,7 +69,8 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr c, shared_ptrnb_streams; ++i) { auto s = _format_context->streams[i]; - if (s->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { + auto codec = _codec_context[i]->codec; + if (s->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && codec) { /* This is a hack; sometimes it seems that _audio_codec_context->channel_layout isn't set up, so bodge it here. No idea why we should have to do this. @@ -79,10 +80,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr c, shared_ptrcodecpar->channel_layout = av_get_default_channel_layout (s->codecpar->channels); } - auto codec = _codec_context[i]->codec; - DCPOMATIC_ASSERT (_format_context->duration != AV_NOPTS_VALUE); - DCPOMATIC_ASSERT (codec); DCPOMATIC_ASSERT (codec->name); _audio_streams.push_back ( -- 2.30.2