Title: [207764] trunk
Revision
207764
Author
eric.carl...@apple.com
Date
2016-10-24 10:53:12 -0700 (Mon, 24 Oct 2016)

Log Message

[MediaStream] Separate media capture and audio playback muting
https://bugs.webkit.org/show_bug.cgi?id=163855
<rdar://problem/28827186>

Reviewed by Darin Adler.

Source/WebCore:

Test: fast/mediastream/MediaStream-page-muted.html

Change page.muted from a bool to a bitfield so audio and media capture muted are independent.
Fix a couple of bugs in the mock media capture device uncovered by new test case.
        
* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::pageMutedStateDidChange): page.isMuted -> page.mutedState.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::pageMutedStateDidChange): Ditto.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updateVolume): Ditto.
(WebCore::HTMLMediaElement::effectiveMuted): Ditto.

* page/MediaProducer.h: Add MutedState enum.

* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::setMuted): Take MutedStateFlags instead of bool. m_muted -> m_mutedState.
* page/Page.h:

* platform/mock/MockRealtimeMediaSource.cpp:
(WebCore::MockRealtimeMediaSource::startProducingData): Call setMuted.
(WebCore::MockRealtimeMediaSource::stopProducingData): Ditto.
* platform/mock/MockRealtimeMediaSource.h:

* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::stopProducingData): Call correct base class method.

* testing/Internals.cpp:
(WebCore::Internals::setPageMuted): Change parameter from a bool to a string.
* testing/Internals.h:

* testing/Internals.idl:

Source/WebKit2:

* Shared/WebPageCreationParameters.h: Change 'muted' from bool to MutedStateFlags.

* UIProcess/API/C/WKPage.cpp: Change parameter from bool to WKMediaMutedState.
(WKPageSetMuted):
* UIProcess/API/C/WKPagePrivate.h: Define WKMediaMutedState.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::setMuted): m_muted -> m_mutedState.
(WebKit::WebPageProxy::creationParameters): Ditto.
* UIProcess/WebPageProxy.h:

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::isMuted): page.isMuted -> page.mutedState.

* WebProcess/WebPage/WebPage.messages.in: Change SetMuted parameter.

LayoutTests:

* fast/mediastream/MediaStream-page-muted-expected.txt: Added.
* fast/mediastream/MediaStream-page-muted.html: Added.
* media/video-muted-after-setting-page-muted-state.html: Updated.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (207763 => 207764)


--- trunk/LayoutTests/ChangeLog	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/LayoutTests/ChangeLog	2016-10-24 17:53:12 UTC (rev 207764)
@@ -1,3 +1,15 @@
+2016-10-24  Eric Carlson  <eric.carl...@apple.com>
+
+        [MediaStream] Separate media capture and audio playback muting
+        https://bugs.webkit.org/show_bug.cgi?id=163855
+        <rdar://problem/28827186>
+
+        Reviewed by Darin Adler.
+
+        * fast/mediastream/MediaStream-page-muted-expected.txt: Added.
+        * fast/mediastream/MediaStream-page-muted.html: Added.
+        * media/video-muted-after-setting-page-muted-state.html: Updated.
+
 2016-10-24  Youenn Fablet  <you...@apple.com>
 
         Activate WEB_RTC compilation flags for Mac bots

Added: trunk/LayoutTests/fast/mediastream/MediaStream-page-muted-expected.txt (0 => 207764)


--- trunk/LayoutTests/fast/mediastream/MediaStream-page-muted-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-page-muted-expected.txt	2016-10-24 17:53:12 UTC (rev 207764)
@@ -0,0 +1,29 @@
+Test enabling/disabling mock media capture devices
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+*** Mock capture devices should be enabled by default
+PASS mediaStream is an instance of Object
+PASS mediaStream.getTracks().length is 2
+
+*** Muting capture devices
+EVENT: mute
+PASS event.target.muted is true
+
+EVENT: mute
+PASS event.target.muted is true
+
+
+*** Unmuting capture devices
+EVENT: unmute
+PASS event.target.muted is false
+
+EVENT: unmute
+PASS event.target.muted is false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/mediastream/MediaStream-page-muted.html (0 => 207764)


--- trunk/LayoutTests/fast/mediastream/MediaStream-page-muted.html	                        (rev 0)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-page-muted.html	2016-10-24 17:53:12 UTC (rev 207764)
@@ -0,0 +1,80 @@
+<!DOCTYPE HTML>
+<html>
+    <head>
+        <script src=""
+        <script>
+            let mediaStream;
+            let eventCount = 0;
+
+            function muteChanged(ev)
+            {
+                event = ev;
+                debug(`EVENT: ${ev.type}`);
+                shouldBe('event.target.muted', (ev.type == "mute").toString());
+                debug("");
+
+                if (++eventCount == 2) {
+                    eventCount = 0;
+
+                    if (ev.type == "unmute") {
+                        finishJSTest();
+                        return;
+                    }
+
+                    if (window.internals) {
+                        debug("<br>*** Unmuting capture devices");
+                        internals.setPageMuted("");
+                    }
+                }
+            }
+            
+            function testWhenEnabled()
+            {
+                navigator.mediaDevices
+                    .getUserMedia({audio:{}, video:{}})
+                    .then(stream => {
+                        mediaStream = stream;
+                        shouldBeType("mediaStream", "Object");
+                        shouldBe("mediaStream.getTracks().length", "2");
+
+                        var tracks = mediaStream.getTracks();
+                        for (var i = 0; i < tracks.length; i++) {
+                            tracks[i]._onmute_ = muteChanged;
+                            tracks[i]._onunmute_ = muteChanged;
+                        }
+
+                        if (window.internals) {
+                            debug("<br>*** Muting capture devices");
+                            internals.setPageMuted("capturedevices");
+                        }
+                    })
+                    .catch((err) => {
+                        testFailed(`mediaDevices.getUserMedia() failed with ${err.name}`);
+                        finishJSTest();
+                    });
+            }
+
+            function start()
+            {
+                debug(`<br>*** Mock capture devices should be enabled by default`);
+                if (window.testRunner)
+                    testRunner.setUserMediaPermission(true);
+
+                testWhenEnabled();
+            }
+
+        </script>
+    </head>
+
+    <body _onload_="start()">
+        <p id="description"></p>
+        <div id="console"></div>
+        <script>
+            description("Test enabling/disabling mock media capture devices");
+            window.jsTestIsAsync = true;
+
+            window.successfullyParsed = true;
+        </script>
+        <script src=""
+    </body>
+</html>

Modified: trunk/LayoutTests/media/video-muted-after-setting-page-muted-state.html (207763 => 207764)


--- trunk/LayoutTests/media/video-muted-after-setting-page-muted-state.html	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/LayoutTests/media/video-muted-after-setting-page-muted-state.html	2016-10-24 17:53:12 UTC (rev 207764)
@@ -5,13 +5,13 @@
 <script>
     testExpected("video.muted", false);
     if (window.internals)
-        internals.setPageMuted(true);
+        internals.setPageMuted("audio");
     testExpected("video.muted", false);
 
     run("video.muted = true");
     testExpected("video.muted", true);
     if (window.internals)
-        internals.setPageMuted(false);
+        internals.setPageMuted("");
     testExpected("video.muted", true);
     endTest();
 </script>

Modified: trunk/Source/WebCore/ChangeLog (207763 => 207764)


--- trunk/Source/WebCore/ChangeLog	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/ChangeLog	2016-10-24 17:53:12 UTC (rev 207764)
@@ -1,3 +1,47 @@
+2016-10-24  Eric Carlson  <eric.carl...@apple.com>
+
+        [MediaStream] Separate media capture and audio playback muting
+        https://bugs.webkit.org/show_bug.cgi?id=163855
+        <rdar://problem/28827186>
+
+        Reviewed by Darin Adler.
+
+        Test: fast/mediastream/MediaStream-page-muted.html
+
+        Change page.muted from a bool to a bitfield so audio and media capture muted are independent.
+        Fix a couple of bugs in the mock media capture device uncovered by new test case.
+        
+        * Modules/mediastream/MediaStream.cpp:
+        (WebCore::MediaStream::pageMutedStateDidChange): page.isMuted -> page.mutedState.
+
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::pageMutedStateDidChange): Ditto.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::updateVolume): Ditto.
+        (WebCore::HTMLMediaElement::effectiveMuted): Ditto.
+
+        * page/MediaProducer.h: Add MutedState enum.
+
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        (WebCore::Page::setMuted): Take MutedStateFlags instead of bool. m_muted -> m_mutedState.
+        * page/Page.h:
+
+        * platform/mock/MockRealtimeMediaSource.cpp:
+        (WebCore::MockRealtimeMediaSource::startProducingData): Call setMuted.
+        (WebCore::MockRealtimeMediaSource::stopProducingData): Ditto.
+        * platform/mock/MockRealtimeMediaSource.h:
+
+        * platform/mock/MockRealtimeVideoSource.cpp:
+        (WebCore::MockRealtimeVideoSource::stopProducingData): Call correct base class method.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::setPageMuted): Change parameter from a bool to a string.
+        * testing/Internals.h:
+
+        * testing/Internals.idl:
+
 2016-10-24  Darin Adler  <da...@apple.com>
 
         Try to fix Windows build.

Modified: trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp (207763 => 207764)


--- trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp	2016-10-24 17:53:12 UTC (rev 207764)
@@ -256,7 +256,7 @@
     if (!document)
         return;
 
-    bool pageMuted = document->page()->isMuted();
+    bool pageMuted = document->page()->isMediaCaptureMuted();
     if (m_externallyMuted == pageMuted)
         return;
 

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (207763 => 207764)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2016-10-24 17:53:12 UTC (rev 207764)
@@ -973,7 +973,7 @@
 void AudioContext::pageMutedStateDidChange()
 {
     if (m_destinationNode && document()->page())
-        m_destinationNode->setMuted(document()->page()->isMuted());
+        m_destinationNode->setMuted(document()->page()->isAudioMuted());
 }
 
 void AudioContext::isPlayingAudioDidChange()

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (207763 => 207764)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2016-10-24 17:53:12 UTC (rev 207764)
@@ -4846,7 +4846,7 @@
 
         if (m_mediaController) {
             volumeMultiplier *= m_mediaController->volume();
-            shouldMute = m_mediaController->muted() || (page && page->isMuted());
+            shouldMute = m_mediaController->muted() || (page && page->isAudioMuted());
         }
 
 #if ENABLE(MEDIA_SESSION)
@@ -7007,7 +7007,7 @@
 
 bool HTMLMediaElement::effectiveMuted() const
 {
-    return muted() || (document().page() && document().page()->isMuted());
+    return muted() || (document().page() && document().page()->isAudioMuted());
 }
 
 void HTMLMediaElement::updateAudioAssertionState()

Modified: trunk/Source/WebCore/page/MediaProducer.h (207763 => 207764)


--- trunk/Source/WebCore/page/MediaProducer.h	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/page/MediaProducer.h	2016-10-24 17:53:12 UTC (rev 207764)
@@ -48,6 +48,14 @@
     typedef unsigned MediaStateFlags;
 
     virtual MediaStateFlags mediaState() const = 0;
+
+    enum MutedState {
+        NoneMuted = 0,
+        AudioIsMuted = 1 << 0,
+        CaptureDevicesAreMuted = 1 << 1,
+    };
+    typedef unsigned MutedStateFlags;
+
     virtual void pageMutedStateDidChange() = 0;
 
 protected:

Modified: trunk/Source/WebCore/page/Page.cpp (207763 => 207764)


--- trunk/Source/WebCore/page/Page.cpp	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/page/Page.cpp	2016-10-24 17:53:12 UTC (rev 207764)
@@ -193,7 +193,6 @@
     , m_inLowQualityInterpolationMode(false)
     , m_areMemoryCacheClientCallsEnabled(true)
     , m_mediaVolume(1)
-    , m_muted(false)
     , m_pageScaleFactor(1)
     , m_zoomedOutPageScaleFactor(0)
     , m_topContentInset(0)
@@ -1381,12 +1380,12 @@
     chrome().client().isPlayingMediaDidChange(state, sourceElementID);
 }
 
-void Page::setMuted(bool muted)
+void Page::setMuted(MediaProducer::MutedStateFlags muted)
 {
-    if (m_muted == muted)
+    if (m_mutedState == muted)
         return;
 
-    m_muted = muted;
+    m_mutedState = muted;
 
     for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (!frame->document())

Modified: trunk/Source/WebCore/page/Page.h (207763 => 207764)


--- trunk/Source/WebCore/page/Page.h	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/page/Page.h	2016-10-24 17:53:12 UTC (rev 207764)
@@ -480,8 +480,10 @@
 
     MediaProducer::MediaStateFlags mediaState() const { return m_mediaState; }
     void updateIsPlayingMedia(uint64_t);
-    bool isMuted() const { return m_muted; }
-    WEBCORE_EXPORT void setMuted(bool);
+    MediaProducer::MutedStateFlags mutedState() const { return m_mutedState; }
+    bool isAudioMuted() const { return m_mutedState & MediaProducer::AudioIsMuted; }
+    bool isMediaCaptureMuted() const { return m_mutedState & MediaProducer::CaptureDevicesAreMuted; };
+    WEBCORE_EXPORT void setMuted(MediaProducer::MutedStateFlags);
 
 #if ENABLE(MEDIA_SESSION)
     WEBCORE_EXPORT void handleMediaEvent(MediaEventType);
@@ -609,7 +611,7 @@
     bool m_inLowQualityInterpolationMode;
     bool m_areMemoryCacheClientCallsEnabled;
     float m_mediaVolume;
-    bool m_muted;
+    MediaProducer::MutedStateFlags m_mutedState { MediaProducer::NoneMuted };
 
     float m_pageScaleFactor;
     float m_zoomedOutPageScaleFactor;

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp (207763 => 207764)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2016-10-24 17:53:12 UTC (rev 207764)
@@ -84,7 +84,7 @@
 
 void RealtimeMediaSource::setMuted(bool muted)
 {
-    if (m_muted == muted)
+    if (m_stopped || m_muted == muted)
         return;
 
     m_muted = muted;
@@ -150,7 +150,6 @@
     stop(callingObserver);
 }
 
-#if 1
 double RealtimeMediaSource::fitnessDistance(const MediaConstraint& constraint)
 {
     RealtimeMediaSourceCapabilities& capabilities = *this->capabilities();
@@ -275,7 +274,6 @@
 
     return 0;
 }
-#endif
 
 template <typename ValueType>
 static void applyNumericConstraint(const NumericConstraint<ValueType>& constraint, ValueType current, ValueType capabilityMin, ValueType capabilityMax, RealtimeMediaSource* source, void (RealtimeMediaSource::*applier)(ValueType))

Modified: trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp (207763 => 207764)


--- trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp	2016-10-24 17:53:12 UTC (rev 207764)
@@ -124,6 +124,18 @@
     return m_supportedConstraints;
 }
 
+void MockRealtimeMediaSource::startProducingData()
+{
+    m_isProducingData = true;
+    setMuted(false);
+}
+
+void MockRealtimeMediaSource::stopProducingData()
+{
+    m_isProducingData = false;
+    setMuted(true);
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM)

Modified: trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.h (207763 => 207764)


--- trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.h	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.h	2016-10-24 17:53:12 UTC (rev 207764)
@@ -69,8 +69,8 @@
     virtual void initializeCapabilities(RealtimeMediaSourceCapabilities&) = 0;
     virtual void initializeSupportedConstraints(RealtimeMediaSourceSupportedConstraints&) = 0;
 
-    void startProducingData() override { m_isProducingData = true; }
-    void stopProducingData() override { m_isProducingData = false; }
+    void startProducingData() override;
+    void stopProducingData() override;
 
     RefPtr<RealtimeMediaSourceCapabilities> capabilities() override;
     const RealtimeMediaSourceSettings& settings() override;

Modified: trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp (207763 => 207764)


--- trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp	2016-10-24 17:53:12 UTC (rev 207764)
@@ -85,7 +85,7 @@
 
 void MockRealtimeVideoSource::stopProducingData()
 {
-    MockRealtimeMediaSource::startProducingData();
+    MockRealtimeMediaSource::stopProducingData();
     m_timer.stop();
     m_elapsedTime += monotonicallyIncreasingTime() - m_startTime;
     m_startTime = NAN;

Modified: trunk/Source/WebCore/testing/Internals.cpp (207763 => 207764)


--- trunk/Source/WebCore/testing/Internals.cpp	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/testing/Internals.cpp	2016-10-24 17:53:12 UTC (rev 207764)
@@ -86,6 +86,7 @@
 #include "MainFrame.h"
 #include "MallocStatistics.h"
 #include "MediaPlayer.h"
+#include "MediaProducer.h"
 #include "MemoryCache.h"
 #include "MemoryInfo.h"
 #include "MemoryPressureHandler.h"
@@ -2945,14 +2946,24 @@
     return MockPageOverlayClient::singleton().layerTreeAsText(document->frame()->mainFrame());
 }
 
-void Internals::setPageMuted(bool muted)
+void Internals::setPageMuted(const String& states)
 {
     Document* document = contextDocument();
     if (!document)
         return;
 
+    WebCore::MediaProducer::MutedStateFlags state = MediaProducer::NoneMuted;
+    Vector<String> stateString;
+    states.split(',', false, stateString);
+    for (auto& muteString : stateString) {
+        if (equalLettersIgnoringASCIICase(muteString, "audio"))
+            state |= MediaProducer::AudioIsMuted;
+        if (equalLettersIgnoringASCIICase(muteString, "capturedevices"))
+            state |= MediaProducer::CaptureDevicesAreMuted;
+    }
+
     if (Page* page = document->page())
-        page->setMuted(muted);
+        page->setMuted(state);
 }
 
 bool Internals::isPagePlayingAudio()

Modified: trunk/Source/WebCore/testing/Internals.h (207763 => 207764)


--- trunk/Source/WebCore/testing/Internals.h	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/testing/Internals.h	2016-10-24 17:53:12 UTC (rev 207764)
@@ -440,7 +440,7 @@
     ExceptionOr<Ref<MockPageOverlay>> installMockPageOverlay(PageOverlayType);
     ExceptionOr<String> pageOverlayLayerTreeAsText() const;
 
-    void setPageMuted(bool);
+    void setPageMuted(const String&);
     bool isPagePlayingAudio();
 
     void setPageDefersLoading(bool);

Modified: trunk/Source/WebCore/testing/Internals.idl (207763 => 207764)


--- trunk/Source/WebCore/testing/Internals.idl	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebCore/testing/Internals.idl	2016-10-24 17:53:12 UTC (rev 207764)
@@ -417,7 +417,7 @@
     [MayThrowException] MockPageOverlay installMockPageOverlay(PageOverlayType type);
     [MayThrowException] DOMString pageOverlayLayerTreeAsText();
 
-    void setPageMuted(boolean muted);
+    void setPageMuted(DOMString mutedState);
     boolean isPagePlayingAudio();
 
     void setPageDefersLoading(boolean defersLoading);

Modified: trunk/Source/WebKit2/ChangeLog (207763 => 207764)


--- trunk/Source/WebKit2/ChangeLog	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebKit2/ChangeLog	2016-10-24 17:53:12 UTC (rev 207764)
@@ -1,3 +1,28 @@
+2016-10-24  Eric Carlson  <eric.carl...@apple.com>
+
+        [MediaStream] Separate media capture and audio playback muting
+        https://bugs.webkit.org/show_bug.cgi?id=163855
+        <rdar://problem/28827186>
+
+        Reviewed by Darin Adler.
+
+        * Shared/WebPageCreationParameters.h: Change 'muted' from bool to MutedStateFlags.
+
+        * UIProcess/API/C/WKPage.cpp: Change parameter from bool to WKMediaMutedState.
+        (WKPageSetMuted):
+        * UIProcess/API/C/WKPagePrivate.h: Define WKMediaMutedState.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        (WebKit::WebPageProxy::setMuted): m_muted -> m_mutedState.
+        (WebKit::WebPageProxy::creationParameters): Ditto.
+        * UIProcess/WebPageProxy.h:
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::isMuted): page.isMuted -> page.mutedState.
+
+        * WebProcess/WebPage/WebPage.messages.in: Change SetMuted parameter.
+
 2016-10-24  Youenn Fablet  <you...@apple.com>
 
         Activate WEB_RTC compilation flags for Mac bots

Modified: trunk/Source/WebKit2/Shared/WebPageCreationParameters.h (207763 => 207764)


--- trunk/Source/WebKit2/Shared/WebPageCreationParameters.h	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebKit2/Shared/WebPageCreationParameters.h	2016-10-24 17:53:12 UTC (rev 207764)
@@ -35,6 +35,7 @@
 #include <WebCore/Color.h>
 #include <WebCore/FloatSize.h>
 #include <WebCore/IntSize.h>
+#include <WebCore/MediaProducer.h>
 #include <WebCore/Pagination.h>
 #include <WebCore/ScrollTypes.h>
 #include <WebCore/SessionID.h>
@@ -99,7 +100,7 @@
     float topContentInset;
     
     float mediaVolume;
-    bool muted;
+    WebCore::MediaProducer::MutedStateFlags muted;
     bool mayStartMediaWhenInWindow;
 
     WebCore::IntSize minimumLayoutSize;

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (207763 => 207764)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2016-10-24 17:53:12 UTC (rev 207764)
@@ -2601,7 +2601,7 @@
     toImpl(page)->setMediaVolume(volume);    
 }
 
-void WKPageSetMuted(WKPageRef page, bool muted)
+void WKPageSetMuted(WKPageRef page, WKMediaMutedState muted)
 {
     toImpl(page)->setMuted(muted);
 }

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h (207763 => 207764)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h	2016-10-24 17:53:12 UTC (rev 207764)
@@ -120,9 +120,16 @@
 WK_EXPORT void WKPageSetAddsVisitedLinks(WKPageRef page, bool visitedLinks);
 
 WK_EXPORT bool WKPageIsPlayingAudio(WKPageRef page);
-WK_EXPORT void WKPageSetMuted(WKPageRef page, bool muted);
 
 enum {
+    kWKMediaNoneMuted = 0,
+    kWKMediaAudioMuted = 1 << 0,
+    kWKMediaCaptureDevicesMuted = 1 << 1,
+};
+typedef uint32_t WKMediaMutedState;
+WK_EXPORT void WKPageSetMuted(WKPageRef page, WKMediaMutedState muted);
+
+enum {
     kWKMediaIsNotPlaying = 0,
     kWKMediaIsPlayingAudio = 1 << 0,
     kWKMediaIsPlayingVideo = 1 << 1,
@@ -130,6 +137,7 @@
 };
 typedef uint32_t WKMediaState;
 
+
 WK_EXPORT WKMediaState WKPageGetMediaState(WKPageRef page);
 
 enum {

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (207763 => 207764)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-10-24 17:53:12 UTC (rev 207764)
@@ -444,7 +444,6 @@
     , m_suppressVisibilityUpdates(false)
     , m_autoSizingShouldExpandToViewHeight(false)
     , m_mediaVolume(1)
-    , m_muted(false)
     , m_mayStartMediaWhenInWindow(true)
     , m_waitingForDidUpdateViewState(false)
 #if PLATFORM(COCOA)
@@ -1588,7 +1587,7 @@
 
     // We should suppress if the page is not active, is visually idle, and supression is enabled.
     bool isLoading = m_pageLoadState.isLoading();
-    bool isPlayingAudio = m_mediaState & MediaProducer::IsPlayingAudio && !m_muted;
+    bool isPlayingAudio = m_mediaState & MediaProducer::IsPlayingAudio && !(m_mutedState & MediaProducer::AudioIsMuted);
     bool pageShouldBeSuppressed = !isLoading && !isPlayingAudio && processSuppressionEnabled && (m_viewState & ViewState::IsVisuallyIdle);
     if (m_pageSuppressed != pageShouldBeSuppressed) {
         m_pageSuppressed = pageShouldBeSuppressed;
@@ -4152,17 +4151,17 @@
     m_process->send(Messages::WebPage::SetMediaVolume(volume), m_pageID);    
 }
 
-void WebPageProxy::setMuted(bool muted)
+void WebPageProxy::setMuted(WebCore::MediaProducer::MutedStateFlags state)
 {
-    if (m_muted == muted)
+    if (m_mutedState == state)
         return;
 
-    m_muted = muted;
+    m_mutedState = state;
 
     if (!isValid())
         return;
 
-    m_process->send(Messages::WebPage::SetMuted(muted), m_pageID);
+    m_process->send(Messages::WebPage::SetMuted(state), m_pageID);
 
     updateThrottleState();
 }
@@ -5483,7 +5482,7 @@
     parameters.viewScaleFactor = m_viewScaleFactor;
     parameters.topContentInset = m_topContentInset;
     parameters.mediaVolume = m_mediaVolume;
-    parameters.muted = m_muted;
+    parameters.muted = m_mutedState;
     parameters.mayStartMediaWhenInWindow = m_mayStartMediaWhenInWindow;
     parameters.minimumLayoutSize = m_minimumLayoutSize;
     parameters.autoSizingShouldExpandToViewHeight = m_autoSizingShouldExpandToViewHeight;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (207763 => 207764)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-10-24 17:53:12 UTC (rev 207764)
@@ -937,7 +937,7 @@
     void printMainFrame();
     
     void setMediaVolume(float);
-    void setMuted(bool);
+    void setMuted(WebCore::MediaProducer::MutedStateFlags);
     void setMayStartMediaWhenInWindow(bool);
     bool mayStartMediaWhenInWindow() const { return m_mayStartMediaWhenInWindow; }
         
@@ -1852,7 +1852,7 @@
     WebCore::IntSize m_minimumLayoutSize;
 
     float m_mediaVolume;
-    bool m_muted;
+    WebCore::MediaProducer::MutedStateFlags m_mutedState { WebCore::MediaProducer::NoneMuted };
     bool m_mayStartMediaWhenInWindow;
 
     bool m_waitingForDidUpdateViewState;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (207763 => 207764)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2016-10-24 17:53:12 UTC (rev 207764)
@@ -1531,7 +1531,7 @@
     if (!frame() || !frame()->page())
         return false;
 
-    return frame()->page()->isMuted();
+    return frame()->page()->isAudioMuted();
 }
 #endif
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (207763 => 207764)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2016-10-24 16:48:54 UTC (rev 207763)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2016-10-24 17:53:12 UTC (rev 207764)
@@ -314,7 +314,7 @@
 
     # Media
     SetMediaVolume(float volume)
-    SetMuted(bool muted)
+    SetMuted(WebCore::MediaProducer::MutedStateFlags muted)
     SetMayStartMediaWhenInWindow(bool mayStartMedia)
 
 #if ENABLE(MEDIA_SESSION)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to