Diff
Modified: branches/safari-612-branch/LayoutTests/ChangeLog (285445 => 285446)
--- branches/safari-612-branch/LayoutTests/ChangeLog 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/LayoutTests/ChangeLog 2021-11-09 00:44:55 UTC (rev 285446)
@@ -1,3 +1,44 @@
+2021-11-08 Alan Coon <[email protected]>
+
+ Apply patch. rdar://problem/83438282
+
+ 2021-11-08 Jean-Yves Avenard <[email protected]>
+
+ Cherry-pick r284741. rdar://83438282
+
+ video appears blank with only audio playing if video element isn't appended to the dom tree
+ https://bugs.webkit.org/show_bug.cgi?id=232124
+ rdar://83438282
+
+ Reviewed by Eric Carlson.
+
+ * TestExpectations:
+ * media/remove-video-element-in-pip-from-document-expected.txt:
+ * media/remove-video-element-in-pip-from-document.html: update test to improve coverage.
+ * media/video-element-fullscreen-not-in-dom-accelerated-iphone-expected.txt: Added.
+ * media/video-element-fullscreen-not-in-dom-accelerated-iphone.html: Added.
+ * platform/ios/TestExpectations:
+ * platform/ipad/TestExpectations:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284741 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-10-22 Jean-Yves Avenard <[email protected]>
+
+ video appears blank with only audio playing if video element isn't appended to the dom tree
+ https://bugs.webkit.org/show_bug.cgi?id=232124
+ rdar://83438282
+
+ Reviewed by Eric Carlson.
+
+ * TestExpectations:
+ * media/remove-video-element-in-pip-from-document-expected.txt:
+ * media/remove-video-element-in-pip-from-document.html: update test to improve coverage.
+ * media/video-element-fullscreen-not-in-dom-accelerated-iphone-expected.txt: Added.
+ * media/video-element-fullscreen-not-in-dom-accelerated-iphone.html: Added.
+ * platform/ios/TestExpectations:
+ * platform/ipad/TestExpectations:
+
2021-11-04 Russell Epstein <[email protected]>
Cherry-pick r285089. rdar://problem/84522357
@@ -5,7 +46,7 @@
Layer tree should not be stuck in frozen state after explicitly stopping a page load
https://bugs.webkit.org/show_bug.cgi?id=232532
rdar://84522357
-
+
Reviewed by Tim Horton.
Source/WebCore:
Modified: branches/safari-612-branch/LayoutTests/TestExpectations (285445 => 285446)
--- branches/safari-612-branch/LayoutTests/TestExpectations 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/LayoutTests/TestExpectations 2021-11-09 00:44:55 UTC (rev 285446)
@@ -269,6 +269,8 @@
media/picture-in-picture [ Skip ]
media/remove-video-element-in-pip-from-document.html [ Skip ]
+# This test is only relevent on iPhone where videos always play in fullscreen.
+media/video-element-fullscreen-not-in-dom-accelerated-iphone.html [ Skip ]
# Shared Workers are unsupported
imported/w3c/web-platform-tests/secure-contexts/basic-shared-worker.html [ Skip ]
Modified: branches/safari-612-branch/LayoutTests/media/remove-video-element-in-pip-from-document-expected.txt (285445 => 285446)
--- branches/safari-612-branch/LayoutTests/media/remove-video-element-in-pip-from-document-expected.txt 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/LayoutTests/media/remove-video-element-in-pip-from-document-expected.txt 2021-11-09 00:44:55 UTC (rev 285446)
@@ -4,6 +4,7 @@
RUN(internals.setMockVideoPresentationModeEnabled(true))
EVENT(canplaythrough)
EVENT(enterpictureinpicture)
+EXPECTED (window.internals.mediaPlayerRenderingCanBeAccelerated(video) == 'true') OK
EXPECTED (pipWindow.width > '0') OK
EXPECTED (pipWindow.height > '0') OK
The video element has been removed from DOM.
Modified: branches/safari-612-branch/LayoutTests/media/remove-video-element-in-pip-from-document.html (285445 => 285446)
--- branches/safari-612-branch/LayoutTests/media/remove-video-element-in-pip-from-document.html 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/LayoutTests/media/remove-video-element-in-pip-from-document.html 2021-11-09 00:44:55 UTC (rev 285446)
@@ -25,6 +25,7 @@
waitForEventOnce('enterpictureinpicture', event => {
window.pipWindow = event.pictureInPictureWindow;
+ testExpected('window.internals.mediaPlayerRenderingCanBeAccelerated(video)', true);
testExpected('pipWindow.width', 0, '>');
testExpected('pipWindow.height', 0, '>');
Added: branches/safari-612-branch/LayoutTests/media/video-element-fullscreen-not-in-dom-accelerated-iphone-expected.txt (0 => 285446)
--- branches/safari-612-branch/LayoutTests/media/video-element-fullscreen-not-in-dom-accelerated-iphone-expected.txt (rev 0)
+++ branches/safari-612-branch/LayoutTests/media/video-element-fullscreen-not-in-dom-accelerated-iphone-expected.txt 2021-11-09 00:44:55 UTC (rev 285446)
@@ -0,0 +1,6 @@
+Test that playing a video in fullscreen is accelerated.
+
+EVENT(webkitbeginfullscreen)
+EXPECTED (window.internals.mediaPlayerRenderingCanBeAccelerated(video) == 'true') OK
+END OF TEST
+
Added: branches/safari-612-branch/LayoutTests/media/video-element-fullscreen-not-in-dom-accelerated-iphone.html (0 => 285446)
--- branches/safari-612-branch/LayoutTests/media/video-element-fullscreen-not-in-dom-accelerated-iphone.html (rev 0)
+++ branches/safari-612-branch/LayoutTests/media/video-element-fullscreen-not-in-dom-accelerated-iphone.html 2021-11-09 00:44:55 UTC (rev 285446)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script src=""
+ <script>
+ var video;
+ window.addEventListener('load', async event => {
+ if (!window.internals) {
+ failTest('This test requires window.internals.');
+ return;
+ }
+
+ internals.settings.setAllowsInlineMediaPlayback(false);
+ internals.settings.setAllowsInlineMediaPlaybackAfterFullscreen(true);
+ consoleWrite('');
+
+ video = document.createElement("video");
+ video.src = "" "content/test");
+
+ video.play();
+
+ // This code can only work on iOS device as webkitEnterFullscreen will error if the video element isn't part of a document.
+ waitForEvent('webkitbeginfullscreen', () => {
+ testExpected('window.internals.mediaPlayerRenderingCanBeAccelerated(video)', true);
+ endTest();
+ }, false, true, video);
+ });
+ </script>
+</head>
+<body>
+ <div>Test that playing a video in fullscreen is accelerated.</div>
+</body>
+</html>
Modified: branches/safari-612-branch/LayoutTests/platform/ios/TestExpectations (285445 => 285446)
--- branches/safari-612-branch/LayoutTests/platform/ios/TestExpectations 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/LayoutTests/platform/ios/TestExpectations 2021-11-09 00:44:55 UTC (rev 285446)
@@ -204,6 +204,8 @@
# This test uses movie matricies, which AVFoundation and QTKit64 do not support.
media/video-size-intrinsic-scale.html [ WontFix ]
+media/video-element-fullscreen-not-in-dom-accelerated-iphone.html [ Pass ]
+
# MediaSource is not currently supported on iOS.
media/media-source
http/tests/media/media-source [ Skip ]
Modified: branches/safari-612-branch/LayoutTests/platform/ipad/TestExpectations (285445 => 285446)
--- branches/safari-612-branch/LayoutTests/platform/ipad/TestExpectations 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/LayoutTests/platform/ipad/TestExpectations 2021-11-09 00:44:55 UTC (rev 285446)
@@ -16,6 +16,9 @@
media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html [ Skip ]
media/modern-media-controls/media-documents/media-document-video-iphone-sizing.html [ Skip ]
+# This test is designed for iPhone and would timeout on iPad
+media/video-element-fullscreen-not-in-dom-accelerated-iphone.html [ Skip ]
+
# This test is iPad-specific
media/modern-media-controls/media-documents/media-document-video-ipad-sizing.html [ Pass ]
Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (285445 => 285446)
--- branches/safari-612-branch/Source/WebCore/ChangeLog 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2021-11-09 00:44:55 UTC (rev 285446)
@@ -1,3 +1,67 @@
+2021-11-08 Alan Coon <[email protected]>
+
+ Apply patch. rdar://problem/83438282
+
+ 2021-11-08 Jean-Yves Avenard <[email protected]>
+
+ Cherry-pick r284741. rdar://83438282
+
+ video appears blank with only audio playing if video element isn't appended to the dom tree
+ https://bugs.webkit.org/show_bug.cgi?id=232124
+ rdar://83438282
+
+ Reviewed by Eric Carlson.
+
+ If the renderer isn't accelerated, the current playback policity is to
+ not have the video tracks visible on screen.
+ The HTMLMediaElement could only check if the renderer was accelerated if
+ it was part of the DOM.
+ On iPhone, for historical reasons, inline playback isn't allowed but
+ will play fullscreen instead.
+
+ This is a temporary workaround until bug 232125 is comlpeted which would provide
+ a more elegant and universal solution.
+
+ Test: media/video-element-fullscreen-not-in-dom-accelerated-iphone.html
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaPlayerRenderingCanBeAccelerated):
+ * html/HTMLMediaElement.h:
+ * testing/Internals.cpp:
+ (WebCore::Internals::mediaPlayerRenderingCanBeAccelerated):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284741 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-10-22 Jean-Yves Avenard <[email protected]>
+
+ video appears blank with only audio playing if video element isn't appended to the dom tree
+ https://bugs.webkit.org/show_bug.cgi?id=232124
+ rdar://83438282
+
+ Reviewed by Eric Carlson.
+
+ If the renderer isn't accelerated, the current playback policity is to
+ not have the video tracks visible on screen.
+ The HTMLMediaElement could only check if the renderer was accelerated if
+ it was part of the DOM.
+ On iPhone, for historical reasons, inline playback isn't allowed but
+ will play fullscreen instead.
+
+ This is a temporary workaround until bug 232125 is comlpeted which would provide
+ a more elegant and universal solution.
+
+ Test: media/video-element-fullscreen-not-in-dom-accelerated-iphone.html
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaPlayerRenderingCanBeAccelerated):
+ * html/HTMLMediaElement.h:
+ * testing/Internals.cpp:
+ (WebCore::Internals::mediaPlayerRenderingCanBeAccelerated):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2021-11-04 Russell Epstein <[email protected]>
Cherry-pick r285239. rdar://problem/80991209
Modified: branches/safari-612-branch/Source/WebCore/html/HTMLMediaElement.cpp (285445 => 285446)
--- branches/safari-612-branch/Source/WebCore/html/HTMLMediaElement.cpp 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/Source/WebCore/html/HTMLMediaElement.cpp 2021-11-09 00:44:55 UTC (rev 285446)
@@ -5048,12 +5048,14 @@
bool HTMLMediaElement::mediaPlayerRenderingCanBeAccelerated()
{
+#if ENABLE(VIDEO_PRESENTATION_MODE)
// This function must return "true" when the video is playing in the
- // picture-in-picture window. Otherwise, the MediaPlayerPrivate* may
- // destroy the video layer.
- if (m_videoFullscreenMode == VideoFullscreenModePictureInPicture)
+ // picture-in-picture window or if it is in fullscreen.
+ // Otherwise, the MediaPlayerPrivate* may destroy the video layer if
+ // the no longer in the DOM.
+ if (m_videoFullscreenLayer)
return true;
-
+#endif
auto* renderer = this->renderer();
return is<RenderVideo>(renderer)
&& downcast<RenderVideo>(*renderer).view().compositor().canAccelerateVideoRendering(downcast<RenderVideo>(*renderer));
Modified: branches/safari-612-branch/Source/WebCore/html/HTMLMediaElement.h (285445 => 285446)
--- branches/safari-612-branch/Source/WebCore/html/HTMLMediaElement.h 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/Source/WebCore/html/HTMLMediaElement.h 2021-11-09 00:44:55 UTC (rev 285446)
@@ -576,6 +576,8 @@
using EventTarget::dispatchEvent;
void dispatchEvent(Event&) override;
+ WEBCORE_EXPORT bool mediaPlayerRenderingCanBeAccelerated() final;
+
protected:
HTMLMediaElement(const QualifiedName&, Document&, bool createdByParser);
virtual ~HTMLMediaElement();
@@ -661,7 +663,6 @@
void mediaPlayerResourceNotSupported() final;
void mediaPlayerRepaint() final;
void mediaPlayerSizeChanged() final;
- bool mediaPlayerRenderingCanBeAccelerated() final;
void mediaPlayerRenderingModeChanged() final;
bool mediaPlayerAcceleratedCompositingEnabled() final;
void mediaPlayerEngineUpdated() final;
Modified: branches/safari-612-branch/Source/WebCore/testing/Internals.cpp (285445 => 285446)
--- branches/safari-612-branch/Source/WebCore/testing/Internals.cpp 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/Source/WebCore/testing/Internals.cpp 2021-11-09 00:44:55 UTC (rev 285446)
@@ -3967,6 +3967,11 @@
player->endSimulatedHDCPError();
}
+ExceptionOr<bool> Internals::mediaPlayerRenderingCanBeAccelerated(HTMLMediaElement& element)
+{
+ return element.mediaPlayerRenderingCanBeAccelerated();
+}
+
bool Internals::elementShouldBufferData(HTMLMediaElement& element)
{
return element.bufferingPolicy() < MediaPlayer::BufferingPolicy::LimitReadAhead;
Modified: branches/safari-612-branch/Source/WebCore/testing/Internals.h (285445 => 285446)
--- branches/safari-612-branch/Source/WebCore/testing/Internals.h 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/Source/WebCore/testing/Internals.h 2021-11-09 00:44:55 UTC (rev 285446)
@@ -659,6 +659,7 @@
ExceptionOr<bool> mediaElementHasCharacteristic(HTMLMediaElement&, const String&);
void beginSimulatedHDCPError(HTMLMediaElement&);
void endSimulatedHDCPError(HTMLMediaElement&);
+ ExceptionOr<bool> mediaPlayerRenderingCanBeAccelerated(HTMLMediaElement&);
bool elementShouldBufferData(HTMLMediaElement&);
String elementBufferingPolicy(HTMLMediaElement&);
Modified: branches/safari-612-branch/Source/WebCore/testing/Internals.idl (285445 => 285446)
--- branches/safari-612-branch/Source/WebCore/testing/Internals.idl 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/Source/WebCore/testing/Internals.idl 2021-11-09 00:44:55 UTC (rev 285446)
@@ -700,6 +700,7 @@
[Conditional=VIDEO] boolean mediaElementHasCharacteristic(HTMLMediaElement element, DOMString characteristic);
[Conditional=VIDEO] undefined beginSimulatedHDCPError(HTMLMediaElement media);
[Conditional=VIDEO] undefined endSimulatedHDCPError(HTMLMediaElement media);
+ [Conditional=VIDEO] boolean mediaPlayerRenderingCanBeAccelerated(HTMLMediaElement media);
[Conditional=VIDEO] boolean elementShouldBufferData(HTMLMediaElement media);
[Conditional=VIDEO] DOMString elementBufferingPolicy(HTMLMediaElement media);
Modified: branches/safari-612-branch/Source/WebKit/ChangeLog (285445 => 285446)
--- branches/safari-612-branch/Source/WebKit/ChangeLog 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/Source/WebKit/ChangeLog 2021-11-09 00:44:55 UTC (rev 285446)
@@ -1,3 +1,52 @@
+2021-11-08 Alan Coon <[email protected]>
+
+ Apply patch. rdar://problem/83438282
+
+ 2021-11-08 Jean-Yves Avenard <[email protected]>
+
+ Cherry-pick r284741. rdar://83438282
+
+ video appears blank with only audio playing if video element isn't appended to the dom tree
+ https://bugs.webkit.org/show_bug.cgi?id=232124
+ rdar://83438282
+
+ Reviewed by Eric Carlson.
+
+ Ensure that we inform the GPU process whenever
+ MediaPlayer::renderingCanBeAccelerated value could have changed.
+
+ * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
+ (WebKit::MediaPlayerPrivateRemote::load):
+ (WebKit::MediaPlayerPrivateRemote::readyStateChanged):
+ (WebKit::MediaPlayerPrivateRemote::checkAcceleratedRenderingState):
+ (WebKit::MediaPlayerPrivateRemote::updateConfiguration):
+ (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenLayer):
+ (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenGravity):
+ * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284741 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-10-22 Jean-Yves Avenard <[email protected]>
+
+ video appears blank with only audio playing if video element isn't appended to the dom tree
+ https://bugs.webkit.org/show_bug.cgi?id=232124
+ rdar://83438282
+
+ Reviewed by Eric Carlson.
+
+ Ensure that we inform the GPU process whenever
+ MediaPlayer::renderingCanBeAccelerated value could have changed.
+
+ * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
+ (WebKit::MediaPlayerPrivateRemote::load):
+ (WebKit::MediaPlayerPrivateRemote::readyStateChanged):
+ (WebKit::MediaPlayerPrivateRemote::checkAcceleratedRenderingState):
+ (WebKit::MediaPlayerPrivateRemote::updateConfiguration):
+ (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenLayer):
+ (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenGravity):
+ * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
+
2021-11-04 Russell Epstein <[email protected]>
Cherry-pick r285335. rdar://problem/85045948
Modified: branches/safari-612-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp (285445 => 285446)
--- branches/safari-612-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp 2021-11-09 00:44:55 UTC (rev 285446)
@@ -208,7 +208,7 @@
if (!player)
return;
- m_configuration = WTFMove(configuration);
+ updateConfiguration(WTFMove(configuration));
player->mediaEngineUpdated();
}, m_id);
}
@@ -353,9 +353,7 @@
updateCachedState(WTFMove(state));
if (auto player = makeRefPtr(m_player.get())) {
player->readyStateChanged();
- bool renderingCanBeAccelerated = player->renderingCanBeAccelerated();
- if (m_renderingCanBeAccelerated != renderingCanBeAccelerated)
- acceleratedRenderingStateChanged();
+ checkAcceleratedRenderingState();
}
}
@@ -479,6 +477,22 @@
}
}
+void MediaPlayerPrivateRemote::checkAcceleratedRenderingState()
+{
+ if (auto player = makeRefPtr(m_player.get())) {
+ bool renderingCanBeAccelerated = player->renderingCanBeAccelerated();
+ if (m_renderingCanBeAccelerated != renderingCanBeAccelerated)
+ acceleratedRenderingStateChanged();
+ }
+}
+
+void MediaPlayerPrivateRemote::updateConfiguration(RemoteMediaPlayerConfiguration&& configuration)
+{
+ m_configuration = WTFMove(configuration);
+ // player->renderingCanBeAccelerated() result is dependent on m_configuration.supportsAcceleratedRendering value.
+ checkAcceleratedRenderingState();
+}
+
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
bool MediaPlayerPrivateRemote::canPlayToWirelessPlaybackTarget() const
{
@@ -767,7 +781,7 @@
if (!player)
return;
- m_configuration = WTFMove(configuration);
+ updateConfiguration(WTFMove(configuration));
player->mediaEngineUpdated();
}, m_id);
m_mediaSourcePrivate = MediaSourcePrivateRemote::create(m_manager.gpuProcessConnection(), identifier, m_manager.typeCache(m_remoteEngineIdentifier), *this, client);
@@ -822,6 +836,8 @@
#if PLATFORM(COCOA)
m_videoLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler), nullptr);
#endif
+ // A Fullscreen layer has been set, this could update the value returned by player->renderingCanBeAccelerated().
+ checkAcceleratedRenderingState();
}
void MediaPlayerPrivateRemote::updateVideoFullscreenInlineImage()
Modified: branches/safari-612-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h (285445 => 285446)
--- branches/safari-612-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h 2021-11-09 00:44:48 UTC (rev 285445)
+++ branches/safari-612-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h 2021-11-09 00:44:55 UTC (rev 285446)
@@ -313,6 +313,7 @@
bool supportsAcceleratedRendering() const final;
void acceleratedRenderingStateChanged() final;
+ void checkAcceleratedRenderingState();
void setShouldMaintainAspectRatio(bool) final;
@@ -396,8 +397,8 @@
bool supportsPauseAtHostTime() const final { return m_configuration.supportsPauseAtHostTime; }
bool playAtHostTime(const MonotonicTime&) final;
bool pauseAtHostTime(const MonotonicTime&) final;
+ void updateConfiguration(RemoteMediaPlayerConfiguration&&);
-
WeakPtr<WebCore::MediaPlayer> m_player;
Ref<WebCore::PlatformMediaResourceLoader> m_mediaResourceLoader;
#if PLATFORM(COCOA)