From: Carl Eugen Hoyos <[email protected]> TrueHD supports more channels than FFmpeg, so a valid sample could set the channel layout to a value that represents less channels than the sample actually consists of.
Signed-off-by: Anton Khirnov <[email protected]> --- libavcodec/mlp_parser.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c index e85eb72..7f694d9 100644 --- a/libavcodec/mlp_parser.c +++ b/libavcodec/mlp_parser.c @@ -326,6 +326,10 @@ static int mlp_parse(AVCodecParserContext *s, avctx->channels = truehd_channels(mh.channels_thd_stream1); avctx->channel_layout = truehd_layout(mh.channels_thd_stream1); } + if (av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) { + avctx->channel_layout = 0; + av_log_ask_for_sample(avctx, "Unknown channel layout."); + } } if (!mh.is_vbr) /* Stream is CBR */ -- 1.7.5.3 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
