diff mbox series

[FFmpeg-devel,2/2] avcodec/aacdec_fixed: also clip samples on the second channel for stereo HE-AAC

Message ID 20220730140821.3518-2-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] avcodec/aacdec_fixed: add missing priv_class | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

James Almer July 30, 2022, 2:08 p.m. UTC
Fixes outputting silence on the second channel when decoding Parametic Stereo
HE-AAC.

Closes ticekt #3361.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/aacdec_template.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 4266d89c6d..cec0e4eb2f 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -3095,7 +3095,8 @@  static void spectral_to_sample(AACContext *ac, int samples)
                     /* preparation for resampler */
                     for(j = 0; j<samples; j++){
                         che->ch[0].ret[j] = (int32_t)av_clip64((int64_t)che->ch[0].ret[j]*128, INT32_MIN, INT32_MAX-0x8000)+0x8000;
-                        if(type == TYPE_CPE)
+                        if(type == TYPE_CPE ||
+                           (type == TYPE_SCE && ac->oc[1].m4ac.ps == 1))
                             che->ch[1].ret[j] = (int32_t)av_clip64((int64_t)che->ch[1].ret[j]*128, INT32_MIN, INT32_MAX-0x8000)+0x8000;
                     }
                 }