PR #23512 opened by Valerii Zapodovnikov (Balling)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23512
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23512.patch

Fixes #11578.

Found-by: Paul B Mahol
Signed-off-by: Valerii Zapodovnikov <[email protected]>

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From c15e6aa4c013be3027875a1f5300690b552643fd Mon Sep 17 00:00:00 2001
From: Valerii Zapodovnikov <[email protected]>
Date: Wed, 17 Jun 2026 06:20:34 +0300
Subject: [PATCH] avcodec/ac3dec: fix corrupted frame in some Atmos samples

Fixes #11578.

Found-by: Paul B Mahol
Signed-off-by: Valerii Zapodovnikov <[email protected]>
---
 libavcodec/ac3dec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 6f7306ea59..4c718fc1b3 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -85,10 +85,12 @@ static void ac3_downmix(AVCodecContext *avctx)
         !av_channel_layout_compare(&s->downmix_layout, &mono)) {
         av_channel_layout_uninit(&avctx->ch_layout);
         avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
+               s->downmixed = 1;
     } else if (avctx->ch_layout.nb_channels > 2 &&
              !av_channel_layout_compare(&s->downmix_layout, &stereo)) {
         av_channel_layout_uninit(&avctx->ch_layout);
         avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
+               s->downmixed = 1;
     }
 }
 
@@ -130,7 +132,6 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
         avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
 
     ac3_downmix(avctx);
-    s->downmixed = 1;
 
     for (i = 0; i < AC3_MAX_CHANNELS; i++) {
         s->xcfptr[i] = s->transform_coeffs[i];
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to