Quoting James Almer (2022-01-13 03:02:28)
> From: Anton Khirnov <an...@khirnov.net>
> 
> Signed-off-by: James Almer <jamr...@gmail.com>
> ---
>  libavcodec/audiotoolboxdec.c | 27 +++++-----
>  libavcodec/audiotoolboxenc.c | 95 ++++++++++++++++--------------------
>  2 files changed, 57 insertions(+), 65 deletions(-)
> 
> diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
> index 9939fef218..8edf9bd463 100644
> --- a/libavcodec/audiotoolboxdec.c
> +++ b/libavcodec/audiotoolboxdec.c
> @@ -166,8 +166,8 @@ static int ffat_update_ctx(AVCodecContext *avctx)
>                                     &size, &format)) {
>          if (format.mSampleRate)
>              avctx->sample_rate = format.mSampleRate;
> -        avctx->channels = format.mChannelsPerFrame;
> -        avctx->channel_layout = 
> av_get_default_channel_layout(avctx->channels);
> +        av_channel_layout_uninit(&avctx->ch_layout);
> +        av_get_default_channel_layout(&avctx->ch_layout, 
> format.mChannelsPerFrame);

Looks wrong

> @@ -364,11 +365,11 @@ static av_cold int ffat_create_decoder(AVCodecContext 
> *avctx,
>  #endif
>      } else {
>          in_format.mSampleRate = avctx->sample_rate ? avctx->sample_rate : 
> 44100;
> -        in_format.mChannelsPerFrame = avctx->channels ? avctx->channels : 1;
> +        in_format.mChannelsPerFrame = avctx->ch_layout.nb_channels ? 
> avctx->ch_layout.nb_channels : 1;
>      }
>  
>      avctx->sample_rate = out_format.mSampleRate = in_format.mSampleRate;
> -    avctx->channels = out_format.mChannelsPerFrame = 
> in_format.mChannelsPerFrame;
> +    avctx->ch_layout.nb_channels = out_format.mChannelsPerFrame = 
> in_format.mChannelsPerFrame;

Should probably uninit+set order.

> diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c
> index 9245aa9dc4..aeda1c36fd 100644
> --- a/libavcodec/audiotoolboxenc.c
> +++ b/libavcodec/audiotoolboxenc.c
> @@ -278,10 +272,7 @@ static av_cold int ffat_init_encoder(AVCodecContext 
> *avctx)
>          return AVERROR_UNKNOWN;
>      }
>  
> -    if (!avctx->channel_layout)
> -        avctx->channel_layout = 
> av_get_default_channel_layout(avctx->channels);

I suspect this will break unspec channel layouts that previously worked.

-- 
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to