Title: [248387] trunk
Revision
248387
Author
[email protected]
Date
2019-08-07 14:12:03 -0700 (Wed, 07 Aug 2019)

Log Message

Muted <video> elements can block display from sleeping.
https://bugs.webkit.org/show_bug.cgi?id=200511

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/video-muted-holds-sleep-assertion.html

Modify the shouldDisableSleep() method to take muting into account.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::shouldDisableSleep const):

LayoutTests:

* media/video-muted-holds-sleep-assertion-expected.txt: Added.
* media/video-muted-holds-sleep-assertion.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (248386 => 248387)


--- trunk/LayoutTests/ChangeLog	2019-08-07 20:35:11 UTC (rev 248386)
+++ trunk/LayoutTests/ChangeLog	2019-08-07 21:12:03 UTC (rev 248387)
@@ -1,3 +1,13 @@
+2019-08-07  Jer Noble  <[email protected]>
+
+        Muted <video> elements can block display from sleeping.
+        https://bugs.webkit.org/show_bug.cgi?id=200511
+
+        Reviewed by Eric Carlson.
+
+        * media/video-muted-holds-sleep-assertion-expected.txt: Added.
+        * media/video-muted-holds-sleep-assertion.html: Added.
+
 2019-08-07  Russell Epstein  <[email protected]>
 
         Updating TestExpectations for Two Failing Layout Tests.

Added: trunk/LayoutTests/media/video-muted-holds-sleep-assertion-expected.txt (0 => 248387)


--- trunk/LayoutTests/media/video-muted-holds-sleep-assertion-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/video-muted-holds-sleep-assertion-expected.txt	2019-08-07 21:12:03 UTC (rev 248387)
@@ -0,0 +1,8 @@
+
+RUN(video.src = "" "content/test"))
+EVENT(canplaythrough)
+RUN(video.play())
+EVENT(playing)
+EXPECTED (internals.elementIsBlockingDisplaySleep(video) == 'false') OK
+END OF TEST
+

Added: trunk/LayoutTests/media/video-muted-holds-sleep-assertion.html (0 => 248387)


--- trunk/LayoutTests/media/video-muted-holds-sleep-assertion.html	                        (rev 0)
+++ trunk/LayoutTests/media/video-muted-holds-sleep-assertion.html	2019-08-07 21:12:03 UTC (rev 248387)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>video-muted-holds-sleep-assertion</title>
+    <script src=""
+    <script src=""
+    <script>
+    var loader;
+    var source;
+    var sourceBuffer;
+
+    window.addEventListener('load', async event => {
+        findMediaElement();
+
+        run('video.src = "" "content/test")');
+        await waitFor(video, 'canplaythrough');
+
+        run('video.play()');
+        await waitFor(video, 'playing');
+
+        testExpected('internals.elementIsBlockingDisplaySleep(video)', false);
+        endTest();
+    }, {once: true});
+    </script>
+</head>
+<body>
+    <video controls muted></video>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (248386 => 248387)


--- trunk/Source/WebCore/ChangeLog	2019-08-07 20:35:11 UTC (rev 248386)
+++ trunk/Source/WebCore/ChangeLog	2019-08-07 21:12:03 UTC (rev 248387)
@@ -1,3 +1,17 @@
+2019-08-07  Jer Noble  <[email protected]>
+
+        Muted <video> elements can block display from sleeping.
+        https://bugs.webkit.org/show_bug.cgi?id=200511
+
+        Reviewed by Eric Carlson.
+
+        Test: media/video-muted-holds-sleep-assertion.html
+
+        Modify the shouldDisableSleep() method to take muting into account.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::shouldDisableSleep const):
+
 2019-08-07  Robin Morisset  <[email protected]>
 
         [WHLSL] Simplify and eliminate redundant work in WHLSLFunctionWriter.cpp

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (248386 => 248387)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2019-08-07 20:35:11 UTC (rev 248386)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2019-08-07 21:12:03 UTC (rev 248387)
@@ -6913,7 +6913,7 @@
     if (PlatformMediaSessionManager::sharedManager().processIsSuspended())
         return SleepType::None;
 
-    bool shouldBeAbleToSleep = !hasVideo() || !hasAudio();
+    bool shouldBeAbleToSleep = mediaType() != PlatformMediaSession::VideoAudio;
 #if ENABLE(MEDIA_STREAM)
     // Remote media stream video tracks may have their corresponding audio tracks being played outside of the media element. Let's ensure to not IDLE the screen in that case.
     // FIXME: We should check that audio is being/to be played. Ideally, we would come up with a media stream agnostic heuristisc.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to