Title: [272583] trunk
- Revision
- 272583
- Author
- [email protected]
- Date
- 2021-02-09 09:47:37 -0800 (Tue, 09 Feb 2021)
Log Message
MediaStream-backed video elements should not compute the mediaType based on track muted states
https://bugs.webkit.org/show_bug.cgi?id=221601
Reviewed by Eric Carlson.
Source/WebCore:
In case of entering background, two things happen:
- video elements get paused
- local video capture track gets muted
When entering foreground:
- video element should resume but did not as the local video track was muted and video element was considered as an audio element.
- local video capture track gets unmuted but this is too late.
To fix this, compute hasVideo/hasAudio based on available tracks, no matter their active state.
Test: fast/mediastream/MediaStream-video-element-enter-background.html
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::hasVideo const):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::hasAudio const):
LayoutTests:
* fast/mediastream/MediaStream-video-element-enter-background-expected.txt: Added.
* fast/mediastream/MediaStream-video-element-enter-background.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (272582 => 272583)
--- trunk/LayoutTests/ChangeLog 2021-02-09 17:36:11 UTC (rev 272582)
+++ trunk/LayoutTests/ChangeLog 2021-02-09 17:47:37 UTC (rev 272583)
@@ -1,3 +1,13 @@
+2021-02-09 Youenn Fablet <[email protected]>
+
+ MediaStream-backed video elements should not compute the mediaType based on track muted states
+ https://bugs.webkit.org/show_bug.cgi?id=221601
+
+ Reviewed by Eric Carlson.
+
+ * fast/mediastream/MediaStream-video-element-enter-background-expected.txt: Added.
+ * fast/mediastream/MediaStream-video-element-enter-background.html: Added.
+
2021-02-09 Chris Gambrell <[email protected]>
[LayoutTests] Convert http/tests/inspector/ convert PHP to Python
Added: trunk/LayoutTests/fast/mediastream/MediaStream-video-element-enter-background-expected.txt (0 => 272583)
--- trunk/LayoutTests/fast/mediastream/MediaStream-video-element-enter-background-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-video-element-enter-background-expected.txt 2021-02-09 17:47:37 UTC (rev 272583)
@@ -0,0 +1,4 @@
+
+
+PASS MediaStream video should restart when going to foreground
+
Added: trunk/LayoutTests/fast/mediastream/MediaStream-video-element-enter-background.html (0 => 272583)
--- trunk/LayoutTests/fast/mediastream/MediaStream-video-element-enter-background.html (rev 0)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-video-element-enter-background.html 2021-02-09 17:47:37 UTC (rev 272583)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Testing MediaDevices addEventListener/removeEventListener</title>
+ <script src=""
+ <script src=""
+</head>
+<body>
+ <video id="video" autoplay playsInline></video>
+ <script>
+promise_test(async (test) => {
+ video.srcObject = await navigator.mediaDevices.getUserMedia({ video: true });
+ const track = video.srcObject.getTracks()[0];
+
+ await video.play();
+
+ if (!window.internals)
+ return;
+ internals.setMediaSessionRestrictions("video", "backgroundprocessplaybackrestricted");
+
+ let mutePromise = new Promise(resolve => track._onmute_ = resolve);
+ internals.applicationDidEnterBackground(true);
+ internals.setMediaStreamTrackMuted(track, true);
+ await mutePromise;
+
+ let counter = 100
+ while (!video.paused && --counter > 0)
+ await new Promise(resolve => setTimeout(resolve, 50));
+ assert_true(video.paused, "video paused");
+
+ let unmutePromise = new Promise(resolve => track._onunmute_ = resolve);
+ internals.applicationWillEnterForeground(false);
+ internals.setMediaStreamTrackMuted(track, false);
+ await unmutePromise;
+
+ counter = 100;
+ while (video.paused && --counter > 0)
+ await new Promise(resolve => setTimeout(resolve, 50));
+ assert_false(video.paused, "video resumed");
+
+}, "MediaStream video should restart when going to foreground");
+ </script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (272582 => 272583)
--- trunk/Source/WebCore/ChangeLog 2021-02-09 17:36:11 UTC (rev 272582)
+++ trunk/Source/WebCore/ChangeLog 2021-02-09 17:47:37 UTC (rev 272583)
@@ -1,3 +1,24 @@
+2021-02-09 Youenn Fablet <[email protected]>
+
+ MediaStream-backed video elements should not compute the mediaType based on track muted states
+ https://bugs.webkit.org/show_bug.cgi?id=221601
+
+ Reviewed by Eric Carlson.
+
+ In case of entering background, two things happen:
+ - video elements get paused
+ - local video capture track gets muted
+ When entering foreground:
+ - video element should resume but did not as the local video track was muted and video element was considered as an audio element.
+ - local video capture track gets unmuted but this is too late.
+ To fix this, compute hasVideo/hasAudio based on available tracks, no matter their active state.
+
+ Test: fast/mediastream/MediaStream-video-element-enter-background.html
+
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+ (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::hasVideo const):
+ (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::hasAudio const):
+
2021-02-09 Zalan Bujtas <[email protected]>
[LFC][IFC] canUseForText should also check if the space glyph comes from the primary font
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm (272582 => 272583)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm 2021-02-09 17:36:11 UTC (rev 272582)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm 2021-02-09 17:47:37 UTC (rev 272583)
@@ -577,18 +577,12 @@
bool MediaPlayerPrivateMediaStreamAVFObjC::hasVideo() const
{
- if (!metaDataAvailable())
- return false;
-
- return m_mediaStreamPrivate->hasVideo();
+ return !m_videoTrackMap.isEmpty();
}
bool MediaPlayerPrivateMediaStreamAVFObjC::hasAudio() const
{
- if (!metaDataAvailable())
- return false;
-
- return m_mediaStreamPrivate->hasAudio();
+ return !m_audioTrackMap.isEmpty();
}
void MediaPlayerPrivateMediaStreamAVFObjC::setVisible(bool visible)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes