Title: [290778] trunk
Revision
290778
Author
you...@apple.com
Date
2022-03-03 08:57:49 -0800 (Thu, 03 Mar 2022)

Log Message

macOS Safari 15.2 Audio Echo Issue after camera pause/unpause
https://bugs.webkit.org/show_bug.cgi?id=235544
<rdar://problem/88297045>

Reviewed by Eric Carlson.

Source/WebCore:

After https://commits.webkit.org/r275600, the muted state of MediaPlayer would be set to the page muted state
without taking into consideration HTMLMediaElement.muted.
Update the call site to use effectiveMuted instead.
Add internals API to write a corresponding layout test.

Test: fast/mediastream/mediastreamtrack-audiovideo-mutepage.html

* html/HTMLMediaElement.cpp:
* testing/Internals.cpp:
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* fast/mediastream/mediastreamtrack-audiovideo-mutepage-expected.txt: Added.
* fast/mediastream/mediastreamtrack-audiovideo-mutepage.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290777 => 290778)


--- trunk/LayoutTests/ChangeLog	2022-03-03 16:53:59 UTC (rev 290777)
+++ trunk/LayoutTests/ChangeLog	2022-03-03 16:57:49 UTC (rev 290778)
@@ -1,3 +1,14 @@
+2022-03-03  Youenn Fablet  <you...@apple.com>
+
+        macOS Safari 15.2 Audio Echo Issue after camera pause/unpause
+        https://bugs.webkit.org/show_bug.cgi?id=235544
+        <rdar://problem/88297045>
+
+        Reviewed by Eric Carlson.
+
+        * fast/mediastream/mediastreamtrack-audiovideo-mutepage-expected.txt: Added.
+        * fast/mediastream/mediastreamtrack-audiovideo-mutepage.html: Added.
+
 2022-03-03  Chris Dumez  <cdu...@apple.com>
 
         REGRESSION(r290356-r290351?): [ iOS EWS ] 3 imported/w3c/web-platform-tests/service-workers/service-worker/* tests are constant text failures.

Added: trunk/LayoutTests/fast/mediastream/mediastreamtrack-audiovideo-mutepage-expected.txt (0 => 290778)


--- trunk/LayoutTests/fast/mediastream/mediastreamtrack-audiovideo-mutepage-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/mediastream/mediastreamtrack-audiovideo-mutepage-expected.txt	2022-03-03 16:57:49 UTC (rev 290778)
@@ -0,0 +1,4 @@
+
+
+PASS Muting then unmuting a page should not change media element muted state if HTMLMediaElement.muted is true
+

Added: trunk/LayoutTests/fast/mediastream/mediastreamtrack-audiovideo-mutepage.html (0 => 290778)


--- trunk/LayoutTests/fast/mediastream/mediastreamtrack-audiovideo-mutepage.html	                        (rev 0)
+++ trunk/LayoutTests/fast/mediastream/mediastreamtrack-audiovideo-mutepage.html	2022-03-03 16:57:49 UTC (rev 290778)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <script src=""
+    <script src=""
+</head>
+<body>
+    <video id='video' autoplay playsinline muted></video>
+    <script>
+    promise_test(async (t) => {
+        video.srcObject = await navigator.mediaDevices.getUserMedia({ video: true, audio: true });
+        await video.play();
+
+        if (!window.internals)
+            return;
+
+        assert_true(internals.isPlayerMuted(video), "test1");
+
+        internals.setPageMuted("capturedevices");
+        await new Promise(resolve => video.srcObject.getAudioTracks()[0]._onmute_ = resolve);
+
+        assert_true(internals.isPlayerMuted(video), "test2");
+
+        internals.setPageMuted("");
+        await new Promise(resolve => video.srcObject.getAudioTracks()[0]._onunmute_ = resolve);
+
+        assert_true(internals.isPlayerMuted(video), "test3");
+    }, "Muting then unmuting a page should not change media element muted state if HTMLMediaElement.muted is true");
+    </script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (290777 => 290778)


--- trunk/Source/WebCore/ChangeLog	2022-03-03 16:53:59 UTC (rev 290777)
+++ trunk/Source/WebCore/ChangeLog	2022-03-03 16:57:49 UTC (rev 290778)
@@ -1,3 +1,23 @@
+2022-03-03  Youenn Fablet  <you...@apple.com>
+
+        macOS Safari 15.2 Audio Echo Issue after camera pause/unpause
+        https://bugs.webkit.org/show_bug.cgi?id=235544
+        <rdar://problem/88297045>
+
+        Reviewed by Eric Carlson.
+
+        After https://commits.webkit.org/r275600, the muted state of MediaPlayer would be set to the page muted state
+        without taking into consideration HTMLMediaElement.muted.
+        Update the call site to use effectiveMuted instead.
+        Add internals API to write a corresponding layout test.
+
+        Test: fast/mediastream/mediastreamtrack-audiovideo-mutepage.html
+
+        * html/HTMLMediaElement.cpp:
+        * testing/Internals.cpp:
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2022-03-03  Chris Dumez  <cdu...@apple.com>
 
         REGRESSION(r290356-r290351?): [ iOS EWS ] 3 imported/w3c/web-platform-tests/service-workers/service-worker/* tests are constant text failures.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (290777 => 290778)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2022-03-03 16:53:59 UTC (rev 290777)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2022-03-03 16:57:49 UTC (rev 290778)
@@ -8196,10 +8196,10 @@
 
 void HTMLMediaElement::pageMutedStateDidChange()
 {
-    if (Page* page = document().page()) {
+    if (auto* page = document().page()) {
         // Propagate the new state to the platform player.
         if (m_player)
-            m_player->setMuted(page->isAudioMuted());
+            m_player->setMuted(effectiveMuted());
         if (hasAudio() && !muted() && page->isAudioMuted())
             userDidInterfereWithAutoplay();
     }

Modified: trunk/Source/WebCore/testing/Internals.cpp (290777 => 290778)


--- trunk/Source/WebCore/testing/Internals.cpp	2022-03-03 16:53:59 UTC (rev 290777)
+++ trunk/Source/WebCore/testing/Internals.cpp	2022-03-03 16:57:49 UTC (rev 290778)
@@ -4494,17 +4494,22 @@
 #endif
 }
 
-bool Internals::elementIsBlockingDisplaySleep(HTMLMediaElement& element) const
+bool Internals::elementIsBlockingDisplaySleep(const HTMLMediaElement& element) const
 {
     return element.isDisablingSleep();
 }
 
-bool Internals::isPlayerVisibleInViewport(HTMLMediaElement& element) const
+bool Internals::isPlayerVisibleInViewport(const HTMLMediaElement& element) const
 {
     auto player = element.player();
     return player && player->isVisibleInViewport();
 }
 
+bool Internals::isPlayerMuted(const HTMLMediaElement& element) const
+{
+    auto player = element.player();
+    return player && player->muted();
+}
 #endif // ENABLE(VIDEO)
 
 #if ENABLE(WEB_AUDIO)

Modified: trunk/Source/WebCore/testing/Internals.h (290777 => 290778)


--- trunk/Source/WebCore/testing/Internals.h	2022-03-03 16:53:59 UTC (rev 290777)
+++ trunk/Source/WebCore/testing/Internals.h	2022-03-03 16:57:49 UTC (rev 290778)
@@ -738,8 +738,9 @@
     void setMediaElementRestrictions(HTMLMediaElement&, StringView restrictionsString);
     ExceptionOr<void> postRemoteControlCommand(const String&, float argument);
     void activeAudioRouteDidChange(bool shouldPause);
-    bool elementIsBlockingDisplaySleep(HTMLMediaElement&) const;
-    bool isPlayerVisibleInViewport(HTMLMediaElement&) const;
+    bool elementIsBlockingDisplaySleep(const HTMLMediaElement&) const;
+    bool isPlayerVisibleInViewport(const HTMLMediaElement&) const;
+    bool isPlayerMuted(const HTMLMediaElement&) const;
 #endif
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)

Modified: trunk/Source/WebCore/testing/Internals.idl (290777 => 290778)


--- trunk/Source/WebCore/testing/Internals.idl	2022-03-03 16:53:59 UTC (rev 290777)
+++ trunk/Source/WebCore/testing/Internals.idl	2022-03-03 16:57:49 UTC (rev 290778)
@@ -818,6 +818,7 @@
     [Conditional=VIDEO] undefined simulateSystemWake();
     [Conditional=VIDEO] boolean elementIsBlockingDisplaySleep(HTMLMediaElement element);
     [Conditional=VIDEO] boolean isPlayerVisibleInViewport(HTMLMediaElement element);
+    [Conditional=VIDEO] boolean isPlayerMuted(HTMLMediaElement element);
 
     MockPageOverlay installMockPageOverlay(PageOverlayType type);
     DOMString pageOverlayLayerTreeAsText(optional unsigned short flags = 0);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to