Skip to content
Permalink
Browse files
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.


Canonical link: https://commits.webkit.org/197614@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227121 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
jernoble committed Jan 18, 2018
1 parent eaf5601 commit 085e261e4b07482215cbd47ef1710fb714ab899f
@@ -1,3 +1,16 @@
2018-01-17 Jer Noble <jer.noble@apple.com>

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 <wilander@apple.com>

Resource Load Statistics: Block cookies for prevalent resources without user interaction
@@ -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

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<script src=../../media-resources/video-test.js></script>
<script src=../../media-resources/media-controls.js></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}

function start() {
video = document.getElementById('video');
video.src = "../resources/hls/test-webvtt.m3u8";
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>
@@ -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
@@ -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
@@ -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
@@ -1,3 +1,23 @@
2018-01-17 Jer Noble <jer.noble@apple.com>

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 <wilander@apple.com>

Resource Load Statistics: Block cookies for prevalent resources without user interaction
@@ -58,7 +58,7 @@ class ISOStringBox : public ISOBox {
return true;
}

StringVector<LChar> characters;
Vector<LChar> characters;
characters.reserveInitialCapacity((size_t)characterCount);
while (characterCount--) {
int8_t character = 0;
@@ -67,7 +67,7 @@ class ISOStringBox : public ISOBox {
characters.uncheckedAppend(character);
}

m_contents.adopt(WTFMove(characters));
m_contents = String::fromUTF8(characters);
offset = localOffset;
return true;
}
@@ -88,6 +88,9 @@ ISOWebVTTCue::ISOWebVTTCue(const MediaTime& presentationTime, const MediaTime& d

bool ISOWebVTTCue::parse(DataView& view, unsigned& offset)
{
if (!ISOBox::parse(view, offset))
return false;

ISOStringBox stringBox;

while (stringBox.read(view, offset)) {
@@ -42,7 +42,7 @@ class ISOWebVTTCue : public ISOBox {
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; }

0 comments on commit 085e261

Please sign in to comment.