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

Git pushed a commit to branch master
in repository ffmpeg.

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

    avcodec/decode: use frame sample rate for calculations related to discarded 
samples
    
    Signed-off-by: James Almer <[email protected]>
---
 libavcodec/decode.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index c9ec6a49e2..2696f8f916 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -333,9 +333,9 @@ static int discard_samples(AVCodecContext *avctx, AVFrame 
*frame, int64_t *disca
     if (side && side->size >= 10) {
         int skip_samples = AV_RL32(side->data);
         if (skip_samples)
-            avci->skip_samples = skip_samples;
+            avci->skip_samples = av_rescale(skip_samples, frame->sample_rate, 
avctx->sample_rate);
         avci->skip_samples = FFMAX(0, avci->skip_samples);
-        discard_padding = AV_RL32(side->data + 4);
+        discard_padding = av_rescale(AV_RL32(side->data + 4), 
frame->sample_rate, avctx->sample_rate);
         av_log(avctx, AV_LOG_DEBUG, "skip %d / discard %d samples due to side 
data\n",
                avci->skip_samples, (int)discard_padding);
         skip_reason = AV_RL8(side->data + 8);
@@ -374,9 +374,9 @@ static int discard_samples(AVCodecContext *avctx, AVFrame 
*frame, int64_t *disca
         } else {
             av_samples_copy(frame->extended_data, frame->extended_data, 0, 
avci->skip_samples,
                             frame->nb_samples - avci->skip_samples, 
avctx->ch_layout.nb_channels, frame->format);
-            if (avctx->pkt_timebase.num && avctx->sample_rate) {
+            if (avctx->pkt_timebase.num && frame->sample_rate) {
                 int64_t diff_ts = av_rescale_q(avci->skip_samples,
-                                               (AVRational){1, 
avctx->sample_rate},
+                                               (AVRational){1, 
frame->sample_rate},
                                                avctx->pkt_timebase);
                 if (diff_ts != AV_NOPTS_VALUE) {
                     if (frame->pts != AV_NOPTS_VALUE)
@@ -411,7 +411,7 @@ static int discard_samples(AVCodecContext *avctx, AVFrame 
*frame, int64_t *disca
         } else {
             if (avctx->pkt_timebase.num && avctx->sample_rate) {
                 int64_t diff_ts = av_rescale_q(frame->nb_samples - 
discard_padding,
-                                               (AVRational){1, 
avctx->sample_rate},
+                                               (AVRational){1, 
frame->sample_rate},
                                                avctx->pkt_timebase);
                 frame->duration = diff_ts == AV_NOPTS_VALUE ? 0 : diff_ts;
             } else

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