[FFmpeg-devel] [PATCH] ffmpeg: prevent premature EOF in sub2video with nullptr AVSubtitles

Jan Ekström jeebjp at gmail.com
Thu Mar 29 00:53:18 EEST 2018


From: Jan Ekström <jan.ekstrom at aminocom.com>

With some streams multiple nullptr AVSubtitles can get pushed
into sub2video_update() in a row.

This causes end_pts, and on the next round pts, to become
INT64_MAX, latter of which signals EOF in framesync, leading to
complete loss of subtitles from that point on.

Thus, utilize the previous sub2video.end_pts as both the pts and
end_pts in case a nullptr AVSubtitle is received. This lets further
incoming subtitle packets be properly processed, as EOF is not hit
in framesync.

Signed-off-by: Jan Ekström <jan.ekstrom at aminocom.com>
---
 fftools/ffmpeg.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 1b2e37b8d8..398ed278d7 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -248,8 +248,7 @@ void sub2video_update(InputStream *ist, AVSubtitle *sub)
                                  AV_TIME_BASE_Q, ist->st->time_base);
         num_rects = sub->num_rects;
     } else {
-        pts       = ist->sub2video.end_pts;
-        end_pts   = INT64_MAX;
+        pts       = end_pts = ist->sub2video.end_pts;
         num_rects = 0;
     }
     if (sub2video_get_blank_frame(ist) < 0) {
-- 
2.14.3



More information about the ffmpeg-devel mailing list