Skip to content

Commit

Permalink
AvFormatDecoder::DecoderWillDownmix: don't use av_opt_find
Browse files Browse the repository at this point in the history
since it was causing segmentation faults in FFmpeg.

Restore the prior switch case with two additions that also support
the "downmix" option:
MLP (Meridian Lossless Packing)
DTS Coherent Acoustics (DCA, also just referred to as DTS)

This should also be faster, since it doesn't have to iterate over
any lists (arrays) of `AVOption`s.
  • Loading branch information
ulmus-scott committed Sep 9, 2022
1 parent 4a2f296 commit 330c922
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
Expand Up @@ -5240,7 +5240,20 @@ inline bool AvFormatDecoder::DecoderWillDownmix(const AVCodecContext *ctx)
if (m_audio->CanDownmix() && AudioOutputUtil::has_optimized_SIMD())
return false;
// use ffmpeg only for dolby codecs if we have to
return av_opt_find(ctx->priv_data, "downmix", nullptr, 0, 0);
//return av_opt_find(ctx->priv_data, "downmix", nullptr, 0, 0);
// av_opt_find was causing segmentation faults, so explicitly list the
// compatible decoders
switch (ctx->codec_id)
{
case AV_CODEC_ID_AC3:
case AV_CODEC_ID_TRUEHD:
case AV_CODEC_ID_EAC3:
case AV_CODEC_ID_MLP:
case AV_CODEC_ID_DTS:
return true;
default:
return false;
}
}

bool AvFormatDecoder::DoPassThrough(const AVCodecParameters *par, bool withProfile)
Expand Down

0 comments on commit 330c922

Please sign in to comment.