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

Git pushed a commit to branch master
in repository ffmpeg.

commit 8f3cccbca4a5f1f81ab7b990ce1acc4cb7b91abc
Author:     Romain Beauxis <[email protected]>
AuthorDate: Sat Nov 21 10:24:32 2026 -0500
Commit:     James Almer <[email protected]>
CommitDate: Sat Nov 21 23:30:36 2026 +0000

    avcodec/opus/parser: report the duration in units of the sample rate
    
    The parser duration is documented in units of AVCodecContext.sample_rate,
    but the Opus parser reported it at 48 kHz whatever the rate. A demuxer
    declaring another rate then gave packets a wrong duration.
---
 libavcodec/opus/parser.c               | 3 ++-
 tests/ref/fate/matroska-opus-rate44100 | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/opus/parser.c b/libavcodec/opus/parser.c
index 975acf2dfe..cfd2d22c40 100644
--- a/libavcodec/opus/parser.c
+++ b/libavcodec/opus/parser.c
@@ -91,7 +91,8 @@ static int set_frame_duration(AVCodecParserContext *ctx, 
AVCodecContext *avctx,
         return AVERROR_INVALIDDATA;
     }
 
-    ctx->duration = s->pkt.frame_count * s->pkt.frame_duration;
+    ctx->duration = av_rescale(s->pkt.frame_count * s->pkt.frame_duration,
+                               avctx->sample_rate, OPUS_TIMESTAMP_RATE);
 
     return 0;
 }
diff --git a/tests/ref/fate/matroska-opus-rate44100 
b/tests/ref/fate/matroska-opus-rate44100
index 3f88d91c8a..d4329d9c88 100644
--- a/tests/ref/fate/matroska-opus-rate44100
+++ b/tests/ref/fate/matroska-opus-rate44100
@@ -1,3 +1,3 @@
-packet|pts=-287|duration=960
-packet|pts=673|duration=960
+packet|pts=-287|duration=882
+packet|pts=595|duration=882
 packet|pts=1477|duration=375

-- 
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