PR #24158 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24158
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24158.patch

This is bascially fairies suggested change

Fixes: issue #20353
Regressed-by: d119ae2fd8 ("fftools/ffmpeg_filter: convert to the scheduler")


>From c095c385ab39cc964997f982388ea86dcbd9572e Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Sat, 15 Aug 2026 03:43:11 +0200
Subject: [PATCH 1/2] fftools/ffmpeg_filter: check sub2video_frame() return
 value when flushing the queue

---
 fftools/ffmpeg_filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 114a694c0c..43c477406e 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -2291,7 +2291,7 @@ static int configure_filtergraph(FilterGraph *fg, 
FilterGraphThread *fgt)
         AVFrame *tmp;
         while (av_fifo_read(ifp->frame_queue, &tmp, 1) >= 0) {
             if (ifp->type_src == AVMEDIA_TYPE_SUBTITLE) {
-                sub2video_frame(&ifp->ifilter, tmp, !fgt->graph);
+                ret = sub2video_frame(&ifp->ifilter, tmp, !fgt->graph);
             } else {
                 if (ifp->type_src == AVMEDIA_TYPE_VIDEO) {
                     if (ifp->displaymatrix_applied)
-- 
2.52.0


>From c2a9735e4bc4689c36f45b3bd48a8d02dd597458 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Sat, 15 Aug 2026 03:43:22 +0200
Subject: [PATCH 2/2] fftools/ffmpeg_filter: do not drop subtitle EOF received
 before graph configuration

This is bascially fairies suggested change

Fixes: issue #20353
Regressed-by: d119ae2fd82 ("fftools/ffmpeg_filter: convert to the scheduler")
---
 fftools/ffmpeg_filter.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 43c477406e..7c8e9ed968 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -3060,16 +3060,17 @@ static int sub2video_frame(InputFilter *ifilter, 
AVFrame *frame, int buffer)
     int ret;
 
     if (buffer) {
-        AVFrame *tmp;
+        // queue a NULL entry for EOF, so it is not lost when
+        // the queue is replayed after configuring the graph
+        AVFrame *tmp = NULL;
 
-        if (!frame)
-            return 0;
+        if (frame) {
+            tmp = av_frame_alloc();
+            if (!tmp)
+                return AVERROR(ENOMEM);
 
-        tmp = av_frame_alloc();
-        if (!tmp)
-            return AVERROR(ENOMEM);
-
-        av_frame_move_ref(tmp, frame);
+            av_frame_move_ref(tmp, frame);
+        }
 
         ret = av_fifo_write(ifp->frame_queue, &tmp, 1);
         if (ret < 0) {
-- 
2.52.0

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

Reply via email to