From cd95e10cd5e1bffa8bc3c6df228ed3d103dad052 Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Sat, 15 Aug 2026 11:52:47 +0800 Subject: [PATCH] Backport a fix to not stall sub2video on stream EOF Signed-off-by: nyanmisaka --- ...to-not-stall-sub2video-on-stream-eof.patch | 40 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 41 insertions(+) create mode 100644 debian/patches/0098-backport-a-fix-to-not-stall-sub2video-on-stream-eof.patch diff --git a/debian/patches/0098-backport-a-fix-to-not-stall-sub2video-on-stream-eof.patch b/debian/patches/0098-backport-a-fix-to-not-stall-sub2video-on-stream-eof.patch new file mode 100644 index 000000000..99eac1b24 --- /dev/null +++ b/debian/patches/0098-backport-a-fix-to-not-stall-sub2video-on-stream-eof.patch @@ -0,0 +1,40 @@ +Index: FFmpeg/fftools/ffmpeg_filter.c +=================================================================== +--- FFmpeg.orig/fftools/ffmpeg_filter.c ++++ FFmpeg/fftools/ffmpeg_filter.c +@@ -2209,7 +2209,7 @@ static int configure_filtergraph(FilterG + 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) +@@ -2983,16 +2983,17 @@ static int sub2video_frame(InputFilter * + int ret; + + if (buffer) { +- AVFrame *tmp; +- +- if (!frame) +- return 0; ++ // 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) { ++ 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) { diff --git a/debian/patches/series b/debian/patches/series index dbdd5eb87..6c4be37d2 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -95,3 +95,4 @@ 0095-add-scale-d3d11-p010-shader-fallback.patch 0096-fix-full-range-input-for-mjpeg-vaapi-encoder.patch 0097-add-misc-enhancements-to-mfenc-hw-encoder.patch +0098-backport-a-fix-to-not-stall-sub2video-on-stream-eof.patch