This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 7c877b2e80cfcd43beb539b88109f99dcda0b4e3 Author: James Almer <[email protected]> AuthorDate: Fri Feb 13 13:03:26 2026 -0300 Commit: James Almer <[email protected]> CommitDate: Tue Feb 17 20:17:23 2026 -0300 avcodec/opus/enc: rescale packet duration when calculating discarded samples Signed-off-by: James Almer <[email protected]> --- libavcodec/opus/enc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/opus/enc.c b/libavcodec/opus/enc.c index 65e6a09575..587e4ed69d 100644 --- a/libavcodec/opus/enc.c +++ b/libavcodec/opus/enc.c @@ -548,7 +548,7 @@ static int opus_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { OpusEncContext *s = avctx->priv_data; - int ret, frame_size, alloc_size = 0; + int ret, frame_size, discard_padding, alloc_size = 0; if (frame) { /* Add new frame to queue */ if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) @@ -600,11 +600,13 @@ static int opus_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, /* Remove samples from queue and skip if needed */ ff_af_queue_remove(&s->afq, s->packet.frames*frame_size, &avpkt->pts, &avpkt->duration); - if (s->packet.frames*frame_size > avpkt->duration) { + + discard_padding = s->packet.frames*frame_size - ff_samples_from_time_base(avctx, avpkt->duration); + if (discard_padding > 0) { uint8_t *side = av_packet_new_side_data(avpkt, AV_PKT_DATA_SKIP_SAMPLES, 10); if (!side) return AVERROR(ENOMEM); - AV_WL32(&side[4], s->packet.frames*frame_size - avpkt->duration); + AV_WL32(&side[4], discard_padding); } *got_packet_ptr = 1; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
