Backport a fix to not stall sub2video on stream EOF

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
This commit is contained in:
nyanmisaka
2026-08-18 03:28:50 +08:00
parent a445e0788e
commit cd95e10cd5
2 changed files with 41 additions and 0 deletions
@@ -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) {
+1
View File
@@ -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