This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit c3aea7628c179dc512b2da18ac6cd4c4260618e2
Author:     James Almer <[email protected]>
AuthorDate: Sat Jan 24 14:02:58 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Thu Jan 29 21:09:02 2026 -0300

    avcodec/opus/enc: set avctx->frame_size to a better guess based on encoder 
configuration
    
    Signed-off-by: James Almer <[email protected]>
---
 libavcodec/opus/enc.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavcodec/opus/enc.c b/libavcodec/opus/enc.c
index 8d20b6c192..1bbeb4bf6e 100644
--- a/libavcodec/opus/enc.c
+++ b/libavcodec/opus/enc.c
@@ -638,12 +638,8 @@ static av_cold int opus_encode_init(AVCodecContext *avctx)
     s->avctx = avctx;
     s->channels = avctx->ch_layout.nb_channels;
 
-    /* Opus allows us to change the framesize on each packet (and each packet 
may
-     * have multiple frames in it) but we can't change the codec's frame size 
on
-     * runtime, so fix it to the lowest possible number of samples and use a 
queue
-     * to accumulate AVFrames until we have enough to encode whatever the 
encoder
-     * decides is the best */
-    avctx->frame_size = 120;
+    int max_delay_samples = (s->options.max_delay_ms * s->avctx->sample_rate) 
/ 1000;
+    avctx->frame_size = 
OPUS_BLOCK_SIZE(FFMIN(OPUS_SAMPLES_TO_BLOCK_SIZE(max_delay_samples), 
CELT_BLOCK_960));
     /* Initial padding will change if SILK is ever supported */
     avctx->initial_padding = 120;
 

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

Reply via email to