>From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Hebert Bernardo <[email protected]>
Date: Tue, 19 May 2026 10:02:38 +0000
Subject: [PATCH] avcodec/aac/aacdec_usac: skip unimplemented loudnessInfoV1
 extension instead of failing

USAC files containing a loudnessInfoSetExtension with type
UNIDRCLOUDEXT_EQ (loudnessInfoV1) currently fail to open entirely.
decode_loudness_set() returns AVERROR_PATCHWELCOME on this extension
type, which propagates fatally through ff_aac_usac_config_decode(),
causing avformat_find_stream_info() to report "unspecified number of
channels" and abort codec initialization entirely.

loudnessInfoV1 is non-essential DRC loudness metadata. The bit_size of
the extension payload is already parsed from the bitstream before the
switch(), so the unimplemented extension can be safely skipped using
skip_bits_long(). This is consistent with the behaviour of the default:
case in the same switch, and with how unrecognised config extensions are
handled in ff_aac_usac_config_decode() itself.

Replace the fatal return with skip_bits_long() to consume the extension
payload and break, allowing codec initialization to proceed normally.
The avpriv_report_missing_feature() call is retained so the user still
sees that this feature is not implemented.

Fixes decoding of USAC files produced by Fraunhofer tools that include
loudnessInfoV1 metadata (AudioObjectType 42, UNIDRCLOUDEXT_EQ).

Reproduction:
  ffmpeg -i sample.mp4 -f null -

Before this patch:
  [aac] loudnessInfoV1 is not implemented. [...]
  Could not find codec parameters for stream 1 [...]:
    unspecified number of channels
  Error while opening decoder: Not yet implemented in FFmpeg

After this patch: file opens and decodes correctly.

Sample: https://files.catbox.moe/82k7yo.mp4

Signed-off-by: Hebert Bernardo <[email protected]>
---
 libavcodec/aac/aacdec_usac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c
index 4856c1786b7..aabbccddee0 100644
--- a/libavcodec/aac/aacdec_usac.c
+++ b/libavcodec/aac/aacdec_usac.c
@@ -136,8 +136,9 @@ static int decode_loudness_set(AACDecContext *ac, 
AACUSACConfig *usac,
     if (get_bits1(gb)) { /* loudnessInfoSetExtPresent */
         enum AACUSACLoudnessExt type;
         while ((type = get_bits(gb, 4)) != UNIDRCLOUDEXT_TERM) {
             uint8_t size_bits = get_bits(gb, 4) + 4;
             uint8_t bit_size = get_bits(gb, size_bits) + 1;
             switch (type) {
             case UNIDRCLOUDEXT_EQ:
                 avpriv_report_missing_feature(ac->avctx, "loudnessInfoV1");
-                return AVERROR_PATCHWELCOME;
+                skip_bits_long(gb, bit_size);
+                break;
             default:
                 skip_bits_long(gb, bit_size);
                 break;
-- 
2.39.0
_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to