Skip to content
Permalink
Browse files
Regression(r283217) : [ iOS 15 ] media/track/track-forced-subtitles-i…
…n-band.html is failing

https://bugs.webkit.org/show_bug.cgi?id=231333
rdar://83955154

Reviewed by Jer Noble.

* LayoutTests/media/track/track-forced-subtitles-in-band-expected.txt: Update.
* LayoutTests/media/track/track-forced-subtitles-in-band.html: Ditto.
* LayoutTests/media/video-test.js: Make waitForEventWithTimeout return a Promise
  rejection when it times out so failures can be caught.
* LayoutTests/platform/ios-wk2/TestExpectations: Remove updated test.
* LayoutTests/platform/mac/TestExpectations: Ditto.

* Source/WebCore/html/track/TextTrackCueGeneric.cpp: Add more logging to help future debugging.

* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Ditto.

Canonical link: https://commits.webkit.org/251432@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295426 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eric-carlson committed Jun 9, 2022
1 parent b5884ef commit cc655700c9f57b76b26e9abf89eb1bad1df9f893
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 42 deletions.
@@ -9,7 +9,7 @@ RUN(internals.setCaptionDisplayMode('ForcedOnly'))
EVENT(canplaythrough)

** Forced tracks should be in .textTracks, but not in the menu
EXPECTED (video.textTracks.length == '9') OK
EXPECTED (video.textTracks.length == '11') OK

** Only the 'fr' forced track should be showing
EXPECTED (video.textTracks[0].language == 'en') OK
@@ -48,11 +48,19 @@ EXPECTED (video.textTracks[8].language == 'en') OK
EXPECTED (video.textTracks[8].kind == 'captions') OK
EXPECTED (video.textTracks[8].mode == 'disabled') OK

RUN(video.currentTime = 9.5)
EXPECTED (video.textTracks[9].language == 'es') OK
EXPECTED (video.textTracks[9].kind == 'chapters') OK
EXPECTED (video.textTracks[9].mode == 'hidden') OK

EXPECTED (video.textTracks[10].language == 'en') OK
EXPECTED (video.textTracks[10].kind == 'chapters') OK
EXPECTED (video.textTracks[10].mode == 'hidden') OK

** A cue should become active when current time is within its active range
RUN(video.currentTime = 9.5)
EVENT(seeked)
EVENT(cuechange)
EXPECTED (video.textTracks[3].activeCues.length == '1') OK
EXPECTED (video.textTracks[3].activeCues.length === 1 == 'true') OK

END OF TEST

@@ -3,25 +3,26 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script src=../trackmenu-test.js></script>
<script src=../video-test.js></script>
<script>

function testVisibleCue()
async function testTracks()
{
consoleWrite("");
consoleWrite("EVENT(seeked)");
consoleWrite("EVENT(cuechange)");
testExpected("video.textTracks[3].activeCues.length", 1);
consoleWrite("");
findMediaElement();

if (window.internals) {
run("internals.settings.setShouldDisplayTrackKind('Captions', false)");
run("internals.settings.setShouldDisplayTrackKind('Subtitles', true)");
run("internals.setUserPreferredLanguages(['en'])");
run("internals.setPrimaryAudioTrackLanguageOverride('fr')");
run("internals.setCaptionDisplayMode('ForcedOnly')");
}
video.src = '../content/CC+Subtitles.mov';

await waitFor(video, 'canplaythrough');

endTest();
}

function testTracks()
{
consoleWrite("<br><i>** Forced tracks should be in .textTracks, but not in the menu<" + "/i>");
testExpected("video.textTracks.length", 9);
testExpected("video.textTracks.length", 11);

consoleWrite("<br><i>** Only the 'fr' forced track should be showing<" + "/i>");
testExpected("video.textTracks[0].language", "en");
@@ -69,29 +70,44 @@
testExpected("video.textTracks[8].mode", "disabled");
consoleWrite("");

waitForEventsAndCall([[video, 'seeked'], [video.textTracks[3], 'cuechange']], testVisibleCue);
testExpected("video.textTracks[9].language", "es");
testExpected("video.textTracks[9].kind", "chapters");
testExpected("video.textTracks[9].mode", "hidden");
consoleWrite("");

testExpected("video.textTracks[10].language", "en");
testExpected("video.textTracks[10].kind", "chapters");
testExpected("video.textTracks[10].mode", "hidden");
consoleWrite("");

consoleWrite("<i>** A cue should become active when current time is within its active range<" + "/i>");
run("video.currentTime = 9.5");
}
let result = await Promise.race([
Promise.all([
waitFor(video, 'seeked', true),
waitFor(video.textTracks[3], 'cuechange', true)
]),
new Promise((resolve, reject) => { setTimeout(resolve, 5000, 'timeout'); })
]);

function setup()
{
findMediaElement();
run("internals.settings.setShouldDisplayTrackKind('Captions', false)");
run("internals.settings.setShouldDisplayTrackKind('Subtitles', true)");
run("internals.setUserPreferredLanguages(['en'])");
run("internals.setPrimaryAudioTrackLanguageOverride('fr')");
run("internals.setCaptionDisplayMode('ForcedOnly')");
video.src = '../content/CC+Subtitles.mov';
if (result === 'timeout') {
consoleWrite('');
failTest('Test timed out.');
}

waitForEvent('canplaythrough', testTracks);
}
consoleWrite('EVENT(seeked)');
consoleWrite('EVENT(cuechange)');

testExpected('video.textTracks[3].activeCues.length === 1', true);
consoleWrite('');

endTest();
}
</script>
</head>
<body onload="setup()">
<body onload='testTracks()'>
<p>Tests that forced subtitles are enable automatically.</p>
<video width="640" height="360" controls>
<video width=640 height=360 controls>
</video>
</body>
</html>
@@ -207,10 +207,8 @@ function waitForEventWithTimeout(element, type, time, message) {
listener,
timeout,
]).then(result => {
if (result === 'timeout') {
Promise.reject(new Error(message));
return;
}
if (result === 'timeout')
return Promise.reject(new Error(message));

consoleWrite(`EVENT(${result.type})`);
return Promise.resolve(result);
@@ -1834,8 +1834,6 @@ webkit.org/b/231295 http/tests/app-privacy-report/user-attribution-ping-load.htm

webkit.org/b/212219 media/track/track-cue-missing.html [ Pass Failure ]

webkit.org/b/231333 media/track/track-forced-subtitles-in-band.html [ Pass Timeout Failure ]

webkit.org/b/228364 media/track/track-in-band-duplicate-tracks-when-source-changes.html [ Pass Timeout ]

webkit.org/b/230070 media/track/track-cue-css.html [ Pass ImageOnlyFailure Timeout ]
@@ -801,8 +801,6 @@ webkit.org/b/122021 media/track/track-in-band-mode.html [ Failure ]

# --- End media tests ---

webkit.org/b/137505 media/track/track-forced-subtitles-in-band.html [ Failure Pass Timeout ]

# FIXME: Needs bugzilla (<rdar://problem/16040720>)
fast/canvas/canvas-scale-strokePath-shadow.html [ Pass Failure ]

@@ -254,6 +254,8 @@ bool TextTrackCueGeneric::isPositionedAbove(const TextTrackCue* that) const

void TextTrackCueGeneric::toJSON(JSON::Object& object) const
{
VTTCue::toJSON(object);

if (m_foregroundColor.isValid())
object.setString("foregroundColor"_s, serializationForHTML(m_foregroundColor));
if (m_backgroundColor.isValid())
@@ -2995,7 +2995,7 @@ void determineChangedTracksFromNewTracksAndOldItems(MediaSelectionGroupAVFObjC*
{
AVMediaSelectionGroup *legibleGroup = safeMediaSelectionGroupForLegibleMedia();
if (!legibleGroup) {
INFO_LOG(LOGIDENTIFIER, "no mediaSelectionGroup");
ALWAYS_LOG(LOGIDENTIFIER, "no mediaSelectionGroup");
return;
}

@@ -3061,8 +3061,10 @@ void determineChangedTracksFromNewTracksAndOldItems(MediaSelectionGroupAVFObjC*
{
ASSERT(time >= MediaTime::zeroTime());

if (!m_currentTextTrack)
if (!m_currentTextTrack) {
ALWAYS_LOG(LOGIDENTIFIER, "no current text track");
return;
}

m_currentTextTrack->processCue((__bridge CFArrayRef)attributedStrings, (__bridge CFArrayRef)nativeSamples, time);
}
@@ -3082,7 +3084,7 @@ void determineChangedTracksFromNewTracksAndOldItems(MediaSelectionGroupAVFObjC*
if (m_currentTextTrack == track)
return;

INFO_LOG(LOGIDENTIFIER, "selecting track with language ", track ? track->language() : emptyAtom());
ALWAYS_LOG(LOGIDENTIFIER, "selecting track with language ", track ? track->language() : emptyAtom());

m_currentTextTrack = track;

0 comments on commit cc65570

Please sign in to comment.