Commit 5cad41a6ae for ffmpeg
commit 5cad41a6aed750394cb48380e8c3b66dca0777b9
Author: Sylvestre Ledru <sylvestre@debian.org>
Date: Mon Nov 9 14:56:17 2026 +0100
avcodec/mpeg4audio: fix frame length for USAC 4:1 SBR
coreSbrFrameLengthIndex 4 (ISO/IEC 23003-3, Table 70) is a 1024 sample
core with 4:1 SBR, giving 4096 output samples per frame. It is mapped to
sbrRatioIndex 1, as in the spec, but the 4:1 branch tested sbr_ratio == 4,
a value that is never produced, so frame_length was reported as 1024.
Test for sbr_ratio == 1 instead.
The branch was copied from the USAC decoder in 0c29837dac
("avcodec/mpeg4audio: add a frame_length field to MPEG4AudioConfig").
Found by Coverity (Firefox CID 1701842):
Logically dead code (DEADCODE)
dead_error_begin: Execution cannot reach this statement: ratio_mult = 4;.
diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
index 46d238d3c6..d93912548f 100644
--- a/libavcodec/mpeg4audio.c
+++ b/libavcodec/mpeg4audio.c
@@ -184,7 +184,7 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb,
} else if (sbr_ratio == 3) {
ratio_mult = 2;
ratio_dec = 1;
- } else if (sbr_ratio == 4) {
+ } else if (sbr_ratio == 1) {
ratio_mult = 4;
ratio_dec = 1;
} else {