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

Git pushed a commit to branch master
in repository ffmpeg.

commit 5cb7e42bf726a0ce64ae4bfe93de117008797bb7
Author:     James Almer <[email protected]>
AuthorDate: Wed Nov 4 10:29:14 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Sat Nov 7 14:09:45 2026 +0000

    libavcodec/opus/dec: don't override sample rate if it's set
    
    While the decoded output will always be 48000Hz, input parameters may be 
inherited
    from the source audio used during encoding, including sample rate, 
timestamps, and
    priming/trailing samples to discard.
    
    Signed-off-by: James Almer <[email protected]>
---
 libavcodec/opus/dec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/opus/dec.c b/libavcodec/opus/dec.c
index 712a0351b6..c284f7a03b 100644
--- a/libavcodec/opus/dec.c
+++ b/libavcodec/opus/dec.c
@@ -507,6 +507,7 @@ static int opus_decode_packet(AVCodecContext *avctx, 
AVFrame *frame,
         c->streams[0].silk_samplerate = get_silk_samplerate(pkt->config);
     }
 
+    frame->sample_rate = 48000;
     frame->nb_samples = coded_samples + delayed_samples;
 
     /* no input or buffered data => nothing to do */
@@ -685,7 +686,8 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
     int ret;
 
     avctx->sample_fmt  = AV_SAMPLE_FMT_FLTP;
-    avctx->sample_rate = 48000;
+    if (!avctx->sample_rate)
+        avctx->sample_rate = 48000;
 
     c->fdsp = avpriv_float_dsp_alloc(0);
     if (!c->fdsp)
@@ -731,7 +733,7 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
         av_opt_set_int(s->swr, "out_sample_fmt",     avctx->sample_fmt,  0);
         av_opt_set_chlayout(s->swr, "in_chlayout",   &layout,            0);
         av_opt_set_chlayout(s->swr, "out_chlayout",  &layout,            0);
-        av_opt_set_int(s->swr, "out_sample_rate",    avctx->sample_rate, 0);
+        av_opt_set_int(s->swr, "out_sample_rate",    48000,              0);
         av_opt_set_int(s->swr, "filter_size",        16,                 0);
 
         ret = ff_silk_init(avctx, &s->silk, s->output_channels);

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to