Make a plausibility check when setting channel layout for TrueHD.

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.
This commit is contained in:
Carl Eugen Hoyos 2011-04-02 00:48:43 +02:00
parent e1cfe04c76
commit 2a0bd2bfc9
1 changed files with 4 additions and 0 deletions

View File

@ -325,6 +325,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 */