[FFmpeg-devel] [PATCH 3/4] avcodec/opus/dec: Don't call function multiple times in FFMAX

Andreas Rheinhardt ffmpegagent at gmail.com
Fri Jul 4 13:35:20 EEST 2025


From: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/opus/dec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/opus/dec.c b/libavcodec/opus/dec.c
index 05f7a12d8e..b0e149e636 100644
--- a/libavcodec/opus/dec.c
+++ b/libavcodec/opus/dec.c
@@ -490,8 +490,9 @@ static int opus_decode_packet(AVCodecContext *avctx, AVFrame *frame,
         OpusStreamContext *s = &c->streams[i];
         s->out[0] =
         s->out[1] = NULL;
+        int fifo_samples = av_audio_fifo_size(s->sync_buffer);
         delayed_samples = FFMAX(delayed_samples,
-                                s->delayed_samples + av_audio_fifo_size(s->sync_buffer));
+                                s->delayed_samples + fifo_samples);
     }
 
     /* decode the header of the first sub-packet to find out the sample count */
-- 
ffmpeg-codebot



More information about the ffmpeg-devel mailing list