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

Git pushed a commit to branch master
in repository ffmpeg.

commit 4133db39b2bd1491e41457e819ed3ca96ef555ff
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Wed Jul 8 17:24:49 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Sat Jul 11 21:53:00 2026 +0000

    avcodec/bsf/dts2pts: fix removal of 2nd field nodes
    
    alloc_and_insert_node() inserts the nodes for 2nd fields with
    duration / poc_diff added to the timestamp, but the removal loop
    compared all nodes of a frame against the unadjusted first timestamp,
    so 2nd field nodes never matched and stayed in the tree until close.
    Advance the compared timestamp the same way the insertion does.
    
    Fixes: tree nodes leaking on every field coded frame
    
    Co-Authored-By: Fable-5
---
 libavcodec/bsf/dts2pts.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/bsf/dts2pts.c b/libavcodec/bsf/dts2pts.c
index de44eaaedd..b0b6b0ec23 100644
--- a/libavcodec/bsf/dts2pts.c
+++ b/libavcodec/bsf/dts2pts.c
@@ -680,10 +680,14 @@ static int dts2pts_filter(AVBSFContext *ctx, AVPacket 
*out)
         if (!s->eof) {
             // Remove the found entry from the tree
             DTS2PTSFrame dup = (DTS2PTSFrame) { NULL, frame.poc + 1, 
frame.poc_diff, frame.gop };
+            int64_t dts = out->pts;
             for (; dup.poc_diff > 0; dup.poc++, dup.poc_diff--) {
                 struct AVTreeNode *node = NULL;
-                if (!poc_node || poc_node->dts != out->pts)
+                if (!poc_node || poc_node->dts != dts)
                     continue;
+                // 2nd field nodes were inserted with this offset added
+                if (dts != AV_NOPTS_VALUE)
+                    dts += poc_node->duration / frame.poc_diff;
                 av_tree_insert(&s->root, poc_node, cmp_insert, &node);
                 av_refstruct_unref(&poc_node);
                 av_free(node);

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

Reply via email to