PR #26089 opened by Baptiste Coudurier (bcoudurier)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26089
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26089.patch

Publish the ALAC cookie’s frameLength in AVCodecContext.frame_size so stream 
probing can copy the nominal sample count into AVCodecParameters. Apple defines 
frameLength as the default for packets that omit an explicit sample count.

Tested the decoder change with Apple-generated MP4, MOV and 3GP files. In all 
three, avformat_find_stream_info() and avcodec_parameters_copy() preserved the 
nominal size of 4096. The final packet decoded to 1609 samples. Callers 
calculating discard padding must account for short packets, since 
av_get_audio_frame_duration2() can return the nominal size for them.



From 4c5d519d5a54f7e97181a9eafceb78e76acd1eb4 Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier <[email protected]>
Date: Sun, 15 Nov 2026 18:22:28 -0800
Subject: [PATCH] avcodec/alac: set frame_size from the magic cookie

---
 libavcodec/alac.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index f91288e97c8..5a5d45e70c2 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -536,6 +536,7 @@ static int alac_set_info(ALACContext *alac)
                alac->max_samples_per_frame);
         return AVERROR_INVALIDDATA;
     }
+    alac->avctx->frame_size = alac->max_samples_per_frame;
     bytestream2_skipu(&gb, 1);  // compatible version
     alac->sample_size          = bytestream2_get_byteu(&gb);
     alac->rice_history_mult    = bytestream2_get_byteu(&gb);
-- 
2.54.0

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

Reply via email to