[FFmpeg-devel] [PATCH]Plausibility check for TrueHD channel_layout

Michael Niedermayer michaelni at gmx.at
Thu Mar 31 21:18:05 CEST 2011


On Thu, Mar 31, 2011 at 06:41:07PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> I believe libavcodec should not set channel_layout to values that must be 
> wrong.
> 
> Please comment, Carl Eugen

>  mlp_parser.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 1d6cc886bfff1b1f5c4a8e4c0957c8acdc8f661a  patchverifylayout.diff
> diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
> index 90b0d00..fa51747 100644
> --- a/libavcodec/mlp_parser.c
> +++ b/libavcodec/mlp_parser.c
> @@ -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_popcount(avctx->channel_layout) != avctx->channels) {
> +                avctx->channel_layout = 0;
> +                av_log_ask_for_sample(avctx, "Unknown channel layout.");
> +            }
>          }

i think this shoulds be a if() level further outside

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110331/993861b4/attachment.asc>


More information about the ffmpeg-devel mailing list