diff mbox series

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

Message ID 20200618004743.95896-5-rcombs@rcombs.me
State New
Headers show
Series [FFmpeg-devel,1/5] lavf: matroska subtitle muxer | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

rcombs June 18, 2020, 12:47 a.m. UTC
The WebVTT spec expects this behavior and it fixes some files
---
 libavformat/webvttdec.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

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;