From e2ea739fcaa8077975a8559f267a1b1377b7e100 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 13 May 2024 01:20:27 +0200 Subject: Don't bother decoding audio if none of it is mapped (#2809). On a test adding subs from an MKV to an existing DCP this reduces the processing time from ~2h to ~1m because it doesn't resample the audio from the whole of the MKV, only to discard it. --- src/lib/ffmpeg_decoder.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 6130d8e5f..e0d9918b2 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -89,7 +89,7 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr film, shared_ptraudio) { + if (c->audio && !c->audio->mapping().mapped_output_channels().empty()) { audio = make_shared(this, c->audio, fast); } @@ -240,7 +240,7 @@ FFmpegDecoder::pass () decode_and_process_video_packet (packet); } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !only_text()->ignore()) { decode_and_process_subtitle_packet (packet); - } else { + } else if (audio) { decode_and_process_audio_packet (packet); } -- cgit v1.2.3