PR #22939 opened by Macdu
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22939
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22939.patch

Replaces #22930 
The atrac9 decoder by default tries to decode a whole superframe at a time. If 
the input size is not big enough for it, it will instead try to decode only 
some frames.
However, right now, it will always return that it consumed a whole superframe, 
even if only a single frame was decoded. 
This PR makes it so that `atrac9_decode_frame` correctly returns how much of 
the input buffer it actually consumed.

I did not include the second commit of #22930 because it is now unrelated to 
this change. Also there is no nice way to get the superframe sample size in 
`get_audio_frame_duration`.


>From e397d732430b2fa4ebb1c66089f768a98ac85027 Mon Sep 17 00:00:00 2001
From: Macdu <[email protected]>
Date: Mon, 27 Apr 2026 22:35:38 +0200
Subject: [PATCH] avcodec/atrac9dec: improve output of atrac9_decode_frame

---
 libavcodec/atrac9dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
index 3c18ae8b42..2f2f86bc58 100644
--- a/libavcodec/atrac9dec.c
+++ b/libavcodec/atrac9dec.c
@@ -817,7 +817,7 @@ static int atrac9_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 
     *got_frame_ptr = 1;
 
-    return avctx->block_align;
+    return frames < s->frame_count ? (get_bits_count(&gb) >> 3) : 
avctx->block_align;
 }
 
 static av_cold void atrac9_decode_flush(AVCodecContext *avctx)
-- 
2.52.0

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

Reply via email to