[FFmpeg-devel] [PATCH] lavc/ac3: set channel_layout when downmixing.

Michael Niedermayer michaelni at gmx.at
Wed Aug 7 20:45:11 CEST 2013


On Wed, Aug 07, 2013 at 05:21:52PM +0200, Nicolas George wrote:
> Fix a "Guessed Channel Layout" warning.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavcodec/aac_ac3_parser.c |    1 +
>  libavcodec/ac3dec.c         |    1 +
>  2 files changed, 2 insertions(+)
> 
> 
> FATE passes.
> Note that this instance of av_get_default_channel_layout is only called with
> channels = 1 or 2.
> 
> 
> diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
> index 6f1e188..ec52fb7 100644
> --- a/libavcodec/aac_ac3_parser.c
> +++ b/libavcodec/aac_ac3_parser.c
> @@ -90,6 +90,7 @@ get_next:
>                  (avctx->codec_id == AV_CODEC_ID_AC3 ||
>                   avctx->codec_id == AV_CODEC_ID_EAC3)))) {
>              avctx->channels = avctx->request_channels;
> +            avctx->channel_layout = av_get_default_channel_layout(avctx->channels);
>          } else {
>              avctx->channels = s->channels;
>              avctx->channel_layout = s->channel_layout;

iam not sure if setting this from the parser is completely safe
the parser could even be used with a binary decoder which might behave
differently


> diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
> index fc15a41..da7a273 100644
> --- a/libavcodec/ac3dec.c
> +++ b/libavcodec/ac3dec.c
> @@ -182,6 +182,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
>              avctx->request_channels < avctx->channels &&
>              avctx->request_channels <= 2) {
>          avctx->channels = avctx->request_channels;
> +        avctx->channel_layout = av_get_default_channel_layout(avctx->channels);
>      }
>      s->downmixed = 1;


should be ok

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- 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/20130807/a1d6af6a/attachment.asc>


More information about the ffmpeg-devel mailing list