[FFmpeg-devel] [PATCH 5/5] lavf/webvttdec: ignore unrecognized blocks

rcombs rcombs at rcombs.me
Thu Jun 18 03:47:43 EEST 2020


The WebVTT spec expects this behavior and it fixes some files
---
 libavformat/webvttdec.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c
index 38c281fe00..2e832b86eb 100644
--- a/libavformat/webvttdec.c
+++ b/libavformat/webvttdec.c
@@ -78,7 +78,7 @@ static int webvtt_read_header(AVFormatContext *s)
         int i;
         int64_t pos;
         AVPacket *sub;
-        const char *p, *identifier, *settings;
+        const char *p, *identifier, *settings, *arrow;
         int identifier_len, settings_len;
         int64_t ts_start, ts_end;
 
@@ -120,12 +120,13 @@ static int webvtt_read_header(AVFormatContext *s)
                 p++;
         }
 
+        if (!(arrow = strstr(p, "-->")))
+            continue;
+
         /* cue timestamps */
         if ((ts_start = read_ts(p)) == AV_NOPTS_VALUE)
             break;
-        if (!(p = strstr(p, "-->")))
-            break;
-        p += 2;
+        p = arrow + 2;
         do p++; while (*p == ' ' || *p == '\t');
         if ((ts_end = read_ts(p)) == AV_NOPTS_VALUE)
             break;
-- 
2.26.2



More information about the ffmpeg-devel mailing list