-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick c8652ac. rdar://122842659
REGRESSION (271599@main): espn.com: Closed captions aren't displaying in videos https://bugs.webkit.org/show_bug.cgi?id=269847 rdar://122842659 Reviewed by Eric Carlson. In this video, we had 2 text tracks, all with a track id of 0. The reasons for this is that it contained a InbandMetadataTextTrack and a InbandTextTrack and the MediaPlayerPrivateAVFoundation weren't assigning them unique trackID which would confuse the search in the hash table trying to match a TrackID to a track. A TrackID for an inband text track is an abstract concept, it doesn't reflect anything relevant to the user (Except that it must be unique). We only need that TrackID to be unique between all the tracks in a given MediaPlayer. So we assign them a unique TrackID at creation. Add a HLS file that contains both a metadata and a subtitle track and ensure that cues are added to the proper one. * LayoutTests/http/tests/media/hls/track-webvtt-multitracks-expected.txt: Added. * LayoutTests/http/tests/media/hls/track-webvtt-multitracks.html: Added. * LayoutTests/http/tests/media/resources/hls/test-webvtt-multitracks.m3u8: Added. * Source/WebCore/platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp: (WebCore::InbandMetadataTextTrackPrivateAVF::create): (WebCore::InbandMetadataTextTrackPrivateAVF::InbandMetadataTextTrackPrivateAVF): * Source/WebCore/platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.h: * Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::InbandTextTrackPrivateAVF::InbandTextTrackPrivateAVF): * Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h: * Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.h: (WebCore::InbandTextTrackPrivateAVFObjC::create): * Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm: (WebCore::InbandTextTrackPrivateAVFObjC::InbandTextTrackPrivateAVFObjC): (WebCore::InbandTextTrackPrivateAVFObjC::id const): Deleted. * Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::processMediaSelectionOptions): (WebCore::MediaPlayerPrivateAVFoundationObjC::processMetadataTrack): * Source/WebCore/platform/graphics/avfoundation/objc/OutOfBandTextTrackPrivateAVF.h: (WebCore::OutOfBandTextTrackPrivateAVF::create): (WebCore::OutOfBandTextTrackPrivateAVF::OutOfBandTextTrackPrivateAVF): Canonical link: https://commits.webkit.org/275201@main Identifier: 272448.624@safari-7618-branch
- Loading branch information
Showing
11 changed files
with
61 additions
and
29 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
LayoutTests/http/tests/media/hls/track-webvtt-multitracks-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
EXPECTED (video.textTracks.length == '2') OK | ||
RUN(video.textTracks[1].mode = "showing") | ||
EVENT(cuechange) | ||
EXPECTED (video.textTracks[1].cues.length >= '1') OK | ||
END OF TEST | ||
|
26 changes: 26 additions & 0 deletions
26
LayoutTests/http/tests/media/hls/track-webvtt-multitracks.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src=../../media-resources/video-test.js></script> | ||
<script> | ||
window.addEventListener('load', async event => { | ||
video = document.getElementById('video'); | ||
waitForAndFail(video, 'error'); | ||
video.src = "../resources/hls/test-webvtt-multitracks.m3u8"; | ||
await Promise.all([ | ||
video.play(), | ||
waitFor(video.textTracks, 'addtrack', true), | ||
testExpectedEventually('video.textTracks.length', 2, '==', 5000), | ||
]); | ||
run('video.textTracks[1].mode = "showing"'); | ||
await waitFor(video.textTracks[1], 'cuechange'); | ||
testExpected("video.textTracks[1].cues.length", 1, '>='); | ||
|
||
endTest(); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<video id="video" muted loop></video> | ||
</body> | ||
</html> |
5 changes: 5 additions & 0 deletions
5
LayoutTests/http/tests/media/resources/hls/test-webvtt-multitracks.m3u8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#EXTM3U | ||
|
||
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitles",LANGUAGE="en-US",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="subtitles/prog_style.m3u8" | ||
#EXT-X-STREAM-INF:BANDWIDTH=634451,CODECS="mp4a.40.2, avc1.4d401e",RESOLUTION=640x480,SUBTITLES="subtitles" | ||
metadata/prog_index.m3u8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters