Title: [227121] trunk
Revision
227121
Author
[email protected]
Date
2018-01-17 21:55:55 -0800 (Wed, 17 Jan 2018)

Log Message

WebVTT served via HLS never results in cues
https://bugs.webkit.org/show_bug.cgi?id=181773

Reviewed by Eric Carlson.

Source/WebCore:

Test: http/tests/media/hls/hls-webvtt-tracks.html

Three independant errors conspired to keep in-band WebVTT samples from parsing:

- The definition of ISOWebVTTCue::boxTypeName() was incorrect.
- ISOWebVTTCue::parse() didn't call it's superclass's parse() method (leading to an incorrect size and offset).
- Use String::fromUTF8() rather than String.adopt(StringVector&&).

* platform/graphics/iso/ISOVTTCue.cpp:
(WebCore::ISOWebVTTCue::parse):
* platform/graphics/iso/ISOVTTCue.h:
(WebCore::ISOWebVTTCue::boxTypeName):

LayoutTests:

* http/tests/media/hls/hls-webvtt-tracks-expected.txt: Added.
* http/tests/media/hls/hls-webvtt-tracks.html: Added.
* http/tests/media/resources/hls/subtitles/fileSequence0.webvtt: Added.
* http/tests/media/resources/hls/subtitles/prog_index.m3u8: Added.
* http/tests/media/resources/hls/test-webvtt.m3u8: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (227120 => 227121)


--- trunk/LayoutTests/ChangeLog	2018-01-18 05:48:05 UTC (rev 227120)
+++ trunk/LayoutTests/ChangeLog	2018-01-18 05:55:55 UTC (rev 227121)
@@ -1,3 +1,16 @@
+2018-01-17  Jer Noble  <[email protected]>
+
+        WebVTT served via HLS never results in cues
+        https://bugs.webkit.org/show_bug.cgi?id=181773
+
+        Reviewed by Eric Carlson.
+
+        * http/tests/media/hls/hls-webvtt-tracks-expected.txt: Added.
+        * http/tests/media/hls/hls-webvtt-tracks.html: Added.
+        * http/tests/media/resources/hls/subtitles/fileSequence0.webvtt: Added.
+        * http/tests/media/resources/hls/subtitles/prog_index.m3u8: Added.
+        * http/tests/media/resources/hls/test-webvtt.m3u8: Added.
+
 2018-01-17  John Wilander  <[email protected]>
 
         Resource Load Statistics: Block cookies for prevalent resources without user interaction

Added: trunk/LayoutTests/http/tests/media/hls/hls-webvtt-tracks-expected.txt (0 => 227121)


--- trunk/LayoutTests/http/tests/media/hls/hls-webvtt-tracks-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/hls/hls-webvtt-tracks-expected.txt	2018-01-18 05:55:55 UTC (rev 227121)
@@ -0,0 +1,9 @@
+
+EVENT(addtrack)
+EXPECTED (video.textTracks.length == '1') OK
+RUN(video.textTracks[0].mode = 'showing')
+EVENT(cuechange)
+EXPECTED (video.textTracks[0].activeCues.length == '1') OK
+EXPECTED (video.textTracks[0].activeCues[0].text == 'Subtitle Test') OK
+END OF TEST
+

Added: trunk/LayoutTests/http/tests/media/hls/hls-webvtt-tracks.html (0 => 227121)


--- trunk/LayoutTests/http/tests/media/hls/hls-webvtt-tracks.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/hls/hls-webvtt-tracks.html	2018-01-18 05:55:55 UTC (rev 227121)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src=""
+    <script src=""
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function start() {
+            video = document.getElementById('video');
+            video.src = ""
+            video.play();
+            waitForEventOnceOn(video.textTracks, 'addtrack', trackAdded);
+        }
+
+        function trackAdded() {
+            testExpected("video.textTracks.length", "1");
+            run("video.textTracks[0].mode = 'showing'");
+            waitForEventOnceOn(video.textTracks[0], 'cuechange', cueChanged);
+        }
+
+        function cueChanged() {
+            testExpected("video.textTracks[0].activeCues.length", "1");
+            testExpected("video.textTracks[0].activeCues[0].text", "Subtitle Test");
+            endTest();
+        }
+    </script>
+</head>
+<body _onload_="start()">
+    <video id="video"></video>
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/media/resources/hls/subtitles/fileSequence0.webvtt (0 => 227121)


--- trunk/LayoutTests/http/tests/media/resources/hls/subtitles/fileSequence0.webvtt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/resources/hls/subtitles/fileSequence0.webvtt	2018-01-18 05:55:55 UTC (rev 227121)
@@ -0,0 +1,5 @@
+WEBVTT
+X-TIMESTAMP-MAP=MPEGTS:900000,LOCAL:00:00:00.000
+
+00:00:00.000 --> 00:00:10.000
+Subtitle Test

Added: trunk/LayoutTests/http/tests/media/resources/hls/subtitles/prog_index.m3u8 (0 => 227121)


--- trunk/LayoutTests/http/tests/media/resources/hls/subtitles/prog_index.m3u8	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/resources/hls/subtitles/prog_index.m3u8	2018-01-18 05:55:55 UTC (rev 227121)
@@ -0,0 +1,8 @@
+#EXTM3U
+#EXT-X-TARGETDURATION:30
+#EXT-X-VERSION:3
+#EXT-X-MEDIA-SEQUENCE:0
+#EXT-X-PLAYLIST-TYPE:VOD
+#EXTINF:10,
+fileSequence0.webvtt
+#EXT-X-ENDLIST

Added: trunk/LayoutTests/http/tests/media/resources/hls/test-webvtt.m3u8 (0 => 227121)


--- trunk/LayoutTests/http/tests/media/resources/hls/test-webvtt.m3u8	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/resources/hls/test-webvtt.m3u8	2018-01-18 05:55:55 UTC (rev 227121)
@@ -0,0 +1,6 @@
+#EXTM3U
+
+#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitles",LANGUAGE="en-US"NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="subtitles/prog_index.m3u8"
+
+#EXT-X-STREAM-INF:BANDWIDTH=634451,CODECS="mp4a.40.2, avc1.4d401e",RESOLUTION=640x480,SUBTITLES="subtitles"
+bipbop/prog_index.m3u8

Modified: trunk/Source/WebCore/ChangeLog (227120 => 227121)


--- trunk/Source/WebCore/ChangeLog	2018-01-18 05:48:05 UTC (rev 227120)
+++ trunk/Source/WebCore/ChangeLog	2018-01-18 05:55:55 UTC (rev 227121)
@@ -1,3 +1,23 @@
+2018-01-17  Jer Noble  <[email protected]>
+
+        WebVTT served via HLS never results in cues
+        https://bugs.webkit.org/show_bug.cgi?id=181773
+
+        Reviewed by Eric Carlson.
+
+        Test: http/tests/media/hls/hls-webvtt-tracks.html
+
+        Three independant errors conspired to keep in-band WebVTT samples from parsing:
+
+        - The definition of ISOWebVTTCue::boxTypeName() was incorrect.
+        - ISOWebVTTCue::parse() didn't call it's superclass's parse() method (leading to an incorrect size and offset).
+        - Use String::fromUTF8() rather than String.adopt(StringVector&&).
+
+        * platform/graphics/iso/ISOVTTCue.cpp:
+        (WebCore::ISOWebVTTCue::parse):
+        * platform/graphics/iso/ISOVTTCue.h:
+        (WebCore::ISOWebVTTCue::boxTypeName):
+
 2018-01-17  John Wilander  <[email protected]>
 
         Resource Load Statistics: Block cookies for prevalent resources without user interaction

Modified: trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.cpp (227120 => 227121)


--- trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.cpp	2018-01-18 05:48:05 UTC (rev 227120)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.cpp	2018-01-18 05:55:55 UTC (rev 227121)
@@ -58,7 +58,7 @@
             return true;
         }
 
-        StringVector<LChar> characters;
+        Vector<LChar> characters;
         characters.reserveInitialCapacity((size_t)characterCount);
         while (characterCount--) {
             int8_t character = 0;
@@ -67,7 +67,7 @@
             characters.uncheckedAppend(character);
         }
 
-        m_contents.adopt(WTFMove(characters));
+        m_contents = String::fromUTF8(characters);
         offset = localOffset;
         return true;
     }
@@ -88,6 +88,9 @@
 
 bool ISOWebVTTCue::parse(DataView& view, unsigned& offset)
 {
+    if (!ISOBox::parse(view, offset))
+        return false;
+
     ISOStringBox stringBox;
 
     while (stringBox.read(view, offset)) {

Modified: trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.h (227120 => 227121)


--- trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.h	2018-01-18 05:48:05 UTC (rev 227120)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.h	2018-01-18 05:55:55 UTC (rev 227121)
@@ -42,7 +42,7 @@
 public:
     ISOWebVTTCue(const MediaTime& presentationTime, const MediaTime& duration);
 
-    static FourCC boxTypeName() { return "vtcc"; }
+    static FourCC boxTypeName() { return "vttc"; }
 
     const MediaTime& presentationTime() const { return m_presentationTime; }
     const MediaTime& duration() const { return m_duration; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to