⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246002 in webkit


Ignore:
Timestamp:
May 31, 2019, 4:49:31 PM (7 years ago)
Author:
youenn@apple.com
Message:

Add an option to mute audio capture automatically when page is not visible
https://bugs.webkit.org/show_bug.cgi?id=198307

Reviewed by Eric Carlson.

Source/WebCore:

Reuse video capture mechanism for audio capture.
In case document gets in the background, interrupt the audio track if the audio factory requires it.
CoreAudioCaptureSourceIOS requires the audio source be interrupted if the app has not the right background mode.
It also allows interrupting the audio capture based on a runtime flag.

Add a runtime flag to control this.
Internals API is used to set it for test purposes, off by default.
For regular cases, the runtime flag is set through web preferences.

Test: platform/ios/mediastream/audio-muted-in-background-tab.html

  • dom/Document.cpp:

(WebCore::Document::notifyMediaCaptureOfVisibilityChanged):

  • page/RuntimeEnabledFeatures.h:

(WebCore::RuntimeEnabledFeatures::interruptAudioOnPageVisibilityChangeEnabled const):
(WebCore::RuntimeEnabledFeatures::setInterruptAudioOnPageVisibilityChangeEnabled):

  • platform/mediastream/RealtimeMediaSourceCenter.cpp:

(WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
(WebCore::RealtimeMediaSourceCenter::initializeShouldInterruptAudioOnPageVisibilityChange):
(WebCore::RealtimeMediaSourceCenter::setCapturePageState):
(WebCore::RealtimeMediaSourceCenter::visibilityDidChange):

  • platform/mediastream/RealtimeMediaSourceCenter.h:

(WebCore::RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange):

  • platform/mediastream/RealtimeMediaSourceFactory.h:

(WebCore::AudioCaptureFactory::setAudioCapturePageState):
(WebCore::VideoCaptureFactory::setVideoCapturePageState):

  • platform/mediastream/ios/CoreAudioCaptureSourceIOS.h:
  • platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:

(WebCore::CoreAudioCaptureSourceFactory::setAudioCapturePageState):
(WebCore::CoreAudioCaptureSourceFactoryIOS::shouldInterruptAudioOnPageVisibilityChange):

  • platform/mediastream/mac/CoreAudioCaptureSource.h:
  • platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:

(WebCore::RealtimeMediaSourceCenter::initializeShouldInterruptAudioOnPageVisibilityChange):

  • testing/Internals.cpp:

(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setShouldInterruptAudioOnPageVisibilityChange):

  • testing/Internals.h:
  • testing/Internals.idl:

Source/WebKit:

Add API to set the new runtime flag.
Make source proxy factories implement this automatic muting.

  • Shared/WebPreferences.yaml:
  • UIProcess/API/Cocoa/WKPreferences.mm:

(-[WKPreferences _interruptAudioOnPageVisibilityChangeEnabled]):
(-[WKPreferences _setInterruptAudioOnPageVisibilityChangeEnabled:]):

  • UIProcess/API/Cocoa/WKPreferencesPrivate.h:
  • WebProcess/cocoa/UserMediaCaptureManager.cpp:

(WebKit::UserMediaCaptureManager::setAudioCapturePageState):
(WebKit::UserMediaCaptureManager::setVideoCapturePageState):

  • WebProcess/cocoa/UserMediaCaptureManager.h:

LayoutTests:

  • platform/ios/mediastream/audio-muted-in-background-tab-expected.txt: Added.
  • platform/ios/mediastream/audio-muted-in-background-tab.html: Added.
Location:
trunk
Files:
2 added
23 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245999 r246002  
     12019-05-31  Youenn Fablet  <youenn@apple.com>
     2
     3        Add an option to mute audio capture automatically when page is not visible
     4        https://bugs.webkit.org/show_bug.cgi?id=198307
     5
     6        Reviewed by Eric Carlson.
     7
     8        * platform/ios/mediastream/audio-muted-in-background-tab-expected.txt: Added.
     9        * platform/ios/mediastream/audio-muted-in-background-tab.html: Added.
     10
    1112019-05-31  Shawn Roberts  <sroberts@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r245987 r246002  
     12019-05-31  Youenn Fablet  <youenn@apple.com>
     2
     3        Add an option to mute audio capture automatically when page is not visible
     4        https://bugs.webkit.org/show_bug.cgi?id=198307
     5
     6        Reviewed by Eric Carlson.
     7
     8        Reuse video capture mechanism for audio capture.
     9        In case document gets in the background, interrupt the audio track if the audio factory requires it.
     10        CoreAudioCaptureSourceIOS requires the audio source be interrupted if the app has not the right background mode.
     11        It also allows interrupting the audio capture based on a runtime flag.
     12
     13        Add a runtime flag to control this.
     14        Internals API is used to set it for test purposes, off by default.
     15        For regular cases, the runtime flag is set through web preferences.
     16
     17        Test: platform/ios/mediastream/audio-muted-in-background-tab.html
     18
     19        * dom/Document.cpp:
     20        (WebCore::Document::notifyMediaCaptureOfVisibilityChanged):
     21        * page/RuntimeEnabledFeatures.h:
     22        (WebCore::RuntimeEnabledFeatures::interruptAudioOnPageVisibilityChangeEnabled const):
     23        (WebCore::RuntimeEnabledFeatures::setInterruptAudioOnPageVisibilityChangeEnabled):
     24        * platform/mediastream/RealtimeMediaSourceCenter.cpp:
     25        (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
     26        (WebCore::RealtimeMediaSourceCenter::initializeShouldInterruptAudioOnPageVisibilityChange):
     27        (WebCore::RealtimeMediaSourceCenter::setCapturePageState):
     28        (WebCore::RealtimeMediaSourceCenter::visibilityDidChange):
     29        * platform/mediastream/RealtimeMediaSourceCenter.h:
     30        (WebCore::RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange):
     31        * platform/mediastream/RealtimeMediaSourceFactory.h:
     32        (WebCore::AudioCaptureFactory::setAudioCapturePageState):
     33        (WebCore::VideoCaptureFactory::setVideoCapturePageState):
     34        * platform/mediastream/ios/CoreAudioCaptureSourceIOS.h:
     35        * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:
     36        (WebCore::CoreAudioCaptureSourceFactory::setAudioCapturePageState):
     37        (WebCore::CoreAudioCaptureSourceFactoryIOS::shouldInterruptAudioOnPageVisibilityChange):
     38        * platform/mediastream/mac/CoreAudioCaptureSource.h:
     39        * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
     40        (WebCore::RealtimeMediaSourceCenter::initializeShouldInterruptAudioOnPageVisibilityChange):
     41        * testing/Internals.cpp:
     42        (WebCore::Internals::resetToConsistentState):
     43        (WebCore::Internals::setShouldInterruptAudioOnPageVisibilityChange):
     44        * testing/Internals.h:
     45        * testing/Internals.idl:
     46
    1472019-05-31  Geoffrey Garen  <ggaren@apple.com>
    248
  • trunk/Source/WebCore/SourcesCocoa.txt

    r245964 r246002  
    543543platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm
    544544platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp
     545platform/mediastream/mac/RealtimeMediaSourceCenterMac.mm
    545546platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp
    546547platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r245964 r246002  
    72797279                4162A4551011464700DFF3ED /* JSDedicatedWorkerGlobalScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDedicatedWorkerGlobalScope.cpp; sourceTree = "<group>"; };
    72807280                4162A4561011464700DFF3ED /* JSDedicatedWorkerGlobalScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDedicatedWorkerGlobalScope.h; sourceTree = "<group>"; };
     7281                416CE4A4229DF12E00A8A686 /* RealtimeMediaSourceCenterMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RealtimeMediaSourceCenterMac.mm; sourceTree = "<group>"; };
    72817282                416D759F20C6441300D02D2C /* NetworkLoadInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkLoadInformation.h; sourceTree = "<group>"; };
    72827283                416E0B37209BC3C2004A95D9 /* FetchIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchIdentifier.h; sourceTree = "<group>"; };
     
    1588315884                                5CDD83391E4324BB00621E83 /* RealtimeIncomingVideoSourceCocoa.mm */,
    1588415885                                4A0FFAA31AAF5EF60062803B /* RealtimeMediaSourceCenterMac.cpp */,
     15886                                416CE4A4229DF12E00A8A686 /* RealtimeMediaSourceCenterMac.mm */,
    1588515887                                41103AA71E39790A00769F14 /* RealtimeOutgoingAudioSourceCocoa.cpp */,
    1588615888                                41103AA81E39790A00769F14 /* RealtimeOutgoingAudioSourceCocoa.h */,
     
    1638716389                        isa = PBXGroup;
    1638816390                        children = (
    16389                                 6F0CD694229ED32700C5994E /* InlineLine.h */,
    16390                                 6F0CD692229ED31900C5994E /* InlineLine.cpp */,
    1639116391                                6FE7DDDD20EC6E8B008B5B4E /* text */,
    1639216392                                6F7CA3C9208C2B2E002F29AB /* InlineFormattingContext.cpp */,
     
    1639916399                                1123AFDC209ABBBA00736ACC /* InlineInvalidation.h */,
    1640016400                                6FE7CFA02177EEF1005B1573 /* InlineItem.h */,
     16401                                6F0CD692229ED31900C5994E /* InlineLine.cpp */,
     16402                                6F0CD694229ED32700C5994E /* InlineLine.h */,
    1640116403                                6FB47E612277425A00C7BCB0 /* InlineLineBox.h */,
    1640216404                                6FE198132178397B00446F08 /* InlineLineBreaker.cpp */,
     
    2819228194                                714C7C671FDAD2A900F2BEE1 /* AnimationPlaybackEventInit.h in Headers */,
    2819328195                                71025ECD1F99F0CE004A250C /* AnimationTimeline.h in Headers */,
    28194                                 6F0CD695229ED32700C5994E /* InlineLine.h in Headers */,
    2819528196                                0F580FAF149800D400FB5BD8 /* AnimationUtilities.h in Headers */,
    2819628197                                57152B5A21CB3E88000C37CA /* ApduCommand.h in Headers */,
     
    2949829499                                6FE7CFA22177EEF2005B1573 /* InlineItem.h in Headers */,
    2949929500                                BCE789161120D6080060ECE5 /* InlineIterator.h in Headers */,
     29501                                6F0CD695229ED32700C5994E /* InlineLine.h in Headers */,
    2950029502                                6FB47E632277425A00C7BCB0 /* InlineLineBox.h in Headers */,
    2950129503                                6FE198172178397C00446F08 /* InlineLineBreaker.h in Headers */,
  • trunk/Source/WebCore/dom/Document.cpp

    r245964 r246002  
    76497649        return;
    76507650
    7651     RealtimeMediaSourceCenter::singleton().setVideoCapturePageState(hidden(), page()->isMediaCaptureMuted());
     7651    RealtimeMediaSourceCenter::singleton().setCapturePageState(hidden(), page()->isMediaCaptureMuted());
    76527652#endif
    76537653}
  • trunk/Source/WebCore/page/RuntimeEnabledFeatures.h

    r245964 r246002  
    357357    bool pageAtRuleSupportEnabled() const { return m_pageAtRuleSupportEnabled; }
    358358    void setPageAtRuleSupportEnabled(bool isEnabled) { m_pageAtRuleSupportEnabled = isEnabled; }
     359
     360    bool interruptAudioOnPageVisibilityChangeEnabled() const { return m_interruptAudioOnPageVisibilityChangeEnabled; }
     361    void setInterruptAudioOnPageVisibilityChangeEnabled(bool enabled) { m_interruptAudioOnPageVisibilityChangeEnabled = enabled; }
    359362
    360363    WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();
     
    541544
    542545    bool m_referrerPolicyAttributeEnabled { false };
     546    bool m_interruptAudioOnPageVisibilityChangeEnabled { false };
    543547
    544548    friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
  • trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp

    r245964 r246002  
    3939#include "Logging.h"
    4040#include "MediaStreamPrivate.h"
     41#include "RuntimeEnabledFeatures.h"
    4142#include <wtf/SHA1.h>
    4243
     
    263264}
    264265
    265 void RealtimeMediaSourceCenter::setVideoCapturePageState(bool interrupted, bool pageMuted)
    266 {
     266void RealtimeMediaSourceCenter::setCapturePageState(bool interrupted, bool pageMuted)
     267{
     268    if (RuntimeEnabledFeatures::sharedFeatures().interruptAudioOnPageVisibilityChangeEnabled())
     269        audioCaptureFactory().setAudioCapturePageState(interrupted, pageMuted);
    267270    videoCaptureFactory().setVideoCapturePageState(interrupted, pageMuted);
    268271}
     
    318321}
    319322
     323#if !PLATFORM(COCOA)
     324bool RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange()
     325{
     326    return false;
     327}
     328#endif
     329
    320330} // namespace WebCore
    321331
  • trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h

    r245964 r246002  
    8787    WEBCORE_EXPORT void setDevicesChangedObserver(std::function<void()>&&);
    8888
    89     void setVideoCapturePageState(bool, bool);
     89    void setCapturePageState(bool interrupted, bool pageMuted);
    9090
    9191    void captureDevicesChanged();
     92
     93    WEBCORE_EXPORT static bool shouldInterruptAudioOnPageVisibilityChange();
    9294
    9395private:
     
    114116    VideoCaptureFactory* m_videoCaptureFactoryOverride { nullptr };
    115117    DisplayCaptureFactory* m_displayCaptureFactoryOverride { nullptr };
     118
     119    bool m_shouldInterruptAudioOnPageVisibilityChange { false };
    116120};
    117121
  • trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceFactory.h

    r245964 r246002  
    5858    virtual CaptureSourceOrError createAudioCaptureSource(const CaptureDevice&, String&&, const MediaConstraints*) = 0;
    5959    virtual CaptureDeviceManager& audioCaptureDeviceManager() = 0;
     60    virtual void setAudioCapturePageState(bool interrupted, bool pageMuted)
     61    {
     62        UNUSED_PARAM(interrupted);
     63        UNUSED_PARAM(pageMuted);
     64    }
    6065
    6166protected:
     
    7277    virtual CaptureSourceOrError createVideoCaptureSource(const CaptureDevice&, String&&, const MediaConstraints*) = 0;
    7378    virtual CaptureDeviceManager& videoCaptureDeviceManager() = 0;
    74     virtual void setVideoCapturePageState(bool, bool) { }
     79    virtual void setVideoCapturePageState(bool interrupted, bool pageMuted)
     80    {
     81        UNUSED_PARAM(interrupted);
     82        UNUSED_PARAM(pageMuted);
     83    }
    7584
    7685protected:
     
    8392    virtual CaptureSourceOrError createDisplayCaptureSource(const CaptureDevice&, const MediaConstraints*) = 0;
    8493    virtual CaptureDeviceManager& displayCaptureDeviceManager() = 0;
    85     virtual void setDisplayCapturePageState(bool , bool) { }
    8694
    8795protected:
  • trunk/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm

    r245964 r246002  
    127127}
    128128
     129void CoreAudioCaptureSourceFactory::setAudioCapturePageState(bool interrupted, bool pageMuted)
     130{
     131    if (auto* activeSource = this->activeSource())
     132        activeSource->setInterrupted(interrupted, pageMuted);
     133}
     134
    129135}
    130136
  • trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h

    r245964 r246002  
    143143
    144144    CaptureDeviceManager& audioCaptureDeviceManager() final;
     145#if PLATFORM(IOS_FAMILY)
     146    void setAudioCapturePageState(bool interrupted, bool pageMuted) final;
     147#endif
    145148};
    146149
  • trunk/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp

    r245964 r246002  
    3939#include "Logging.h"
    4040#include "MediaStreamPrivate.h"
     41#include "RuntimeEnabledFeatures.h"
    4142#include "ScreenDisplayCaptureSourceMac.h"
    4243#include "WindowDisplayCaptureSourceMac.h"
  • trunk/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.mm

    r245999 r246002  
    11/*
    2  * <%= @warning %>
    3  *
    42 * Copyright (C) 2017 Apple Inc. All rights reserved.
    53 *
     
    2725
    2826#include "config.h"
    29 #include "WebPreferencesStore.h"
     27#include "RealtimeMediaSourceCenter.h"
    3028
    31 #include "WebPreferencesDefaultValues.h"
    32 #include "WebPreferencesKeys.h"
    33 #include <wtf/NeverDestroyed.h>
    34 #include <wtf/Variant.h>
     29#if ENABLE(MEDIA_STREAM)
    3530
    36 // FIXME: These should added via options in WebPreferences.yaml, rather than hardcoded.
    37 #include <WebCore/DeprecatedGlobalSettings.h>
    38 #include <WebCore/LibWebRTCProvider.h>
    39 #include <WebCore/SecurityOrigin.h>
    40 #include <WebCore/Settings.h>
    41 #include <WebCore/TextEncodingRegistry.h>
     31namespace WebCore {
    4232
    43 namespace WebKit {
    44 using namespace WebCore;
    45 
    46 WebPreferencesStore::ValueMap& WebPreferencesStore::defaults()
     33bool RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange()
    4734{
    48     static NeverDestroyed<ValueMap> defaults;
    49     if (defaults.get().isEmpty()) {
    50 <%- for @pref in @preferences do -%>
    51 <%- if @pref.condition -%>
    52 #if <%= @pref.condition %>
    53 <%- end -%>
    54         defaults.get().set(WebPreferencesKey::<%= @pref.nameLower %>Key(), Value(<%= @pref.type %>(<%= @pref.defaultValue %>)));
    55 <%- if @pref.condition -%>
     35#if PLATFORM(IOS)
     36    NSArray *modes = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"];
     37    if (!modes)
     38        return true;
     39   
     40    int modesCount = [modes count];
     41    for (int i = 0; i < modesCount; i++) {
     42        if ([[modes objectAtIndex:i] isEqual: @"audio"])
     43            return false;
     44    }
     45    return true;
     46#else
     47    return false;
    5648#endif
    57 <%- end -%>
    58 <%- end -%>
    59     }
    60 
    61     return defaults;
    6249}
    6350
    64 } // namespace WebKit
     51} // namespace WebCore
     52
     53#endif // ENABLE(MEDIA_STREAM)
  • trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp

    r245964 r246002  
    9797private:
    9898#if PLATFORM(IOS_FAMILY)
    99     void setVideoCapturePageState(bool interrupted, bool pageMuted)
     99    void setVideoCapturePageState(bool interrupted, bool pageMuted) final
    100100    {
    101101        if (activeSource())
     
    140140    }
    141141private:
     142#if PLATFORM(IOS_FAMILY)
     143    void setAudioCapturePageState(bool interrupted, bool pageMuted) final
     144    {
     145        if (activeSource())
     146            activeSource()->setInterrupted(interrupted, pageMuted);
     147    }
     148#endif
    142149    CaptureDeviceManager& audioCaptureDeviceManager() final { return MockRealtimeMediaSourceCenter::singleton().audioCaptureDeviceManager(); }
    143150};
  • trunk/Source/WebCore/testing/Internals.cpp

    r245964 r246002  
    533533
    534534    MediaEngineConfigurationFactory::disableMock();
     535
     536#if ENABLE(MEDIA_STREAM)
     537    RuntimeEnabledFeatures::sharedFeatures().setInterruptAudioOnPageVisibilityChangeEnabled(false);
     538#endif
    535539}
    536540
     
    15031507
    15041508#if ENABLE(MEDIA_STREAM)
     1509void Internals::setShouldInterruptAudioOnPageVisibilityChange(bool shouldInterrupt)
     1510{
     1511    RuntimeEnabledFeatures::sharedFeatures().setInterruptAudioOnPageVisibilityChangeEnabled(shouldInterrupt);
     1512}
    15051513
    15061514void Internals::setMockMediaCaptureDevicesEnabled(bool enabled)
  • trunk/Source/WebCore/testing/Internals.h

    r245964 r246002  
    517517
    518518#if ENABLE(MEDIA_STREAM)
     519    void setShouldInterruptAudioOnPageVisibilityChange(bool);
    519520    void setMockMediaCaptureDevicesEnabled(bool);
    520521    void setMediaCaptureRequiresSecureConnection(bool);
  • trunk/Source/WebCore/testing/Internals.idl

    r245964 r246002  
    673673    [Conditional=WEB_RTC] void applyRotationForOutgoingVideoSources(RTCPeerConnection connection);
    674674
     675    [Conditional=MEDIA_STREAM] void setShouldInterruptAudioOnPageVisibilityChange(boolean shouldInterrupt);
    675676    [Conditional=MEDIA_STREAM] void setCameraMediaStreamTrackOrientation(MediaStreamTrack track, short orientation);
    676677    [Conditional=MEDIA_STREAM] void observeMediaStreamTrack(MediaStreamTrack track);
  • trunk/Source/WebKit/ChangeLog

    r245998 r246002  
     12019-05-31  Youenn Fablet  <youenn@apple.com>
     2
     3        Add an option to mute audio capture automatically when page is not visible
     4        https://bugs.webkit.org/show_bug.cgi?id=198307
     5
     6        Reviewed by Eric Carlson.
     7
     8        Add API to set the new runtime flag.
     9        Make source proxy factories implement this automatic muting.
     10
     11        * Shared/WebPreferences.yaml:
     12        * UIProcess/API/Cocoa/WKPreferences.mm:
     13        (-[WKPreferences _interruptAudioOnPageVisibilityChangeEnabled]):
     14        (-[WKPreferences _setInterruptAudioOnPageVisibilityChangeEnabled:]):
     15        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
     16        * WebProcess/cocoa/UserMediaCaptureManager.cpp:
     17        (WebKit::UserMediaCaptureManager::setAudioCapturePageState):
     18        (WebKit::UserMediaCaptureManager::setVideoCapturePageState):
     19        * WebProcess/cocoa/UserMediaCaptureManager.h:
     20
    1212019-05-31  Wenson Hsieh  <wenson_hsieh@apple.com>
    222
  • trunk/Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb

    r245964 r246002  
    3737#include <WebCore/DeprecatedGlobalSettings.h>
    3838#include <WebCore/LibWebRTCProvider.h>
     39#include <WebCore/RealtimeMediaSourceCenter.h>
    3940#include <WebCore/SecurityOrigin.h>
    4041#include <WebCore/Settings.h>
  • trunk/Source/WebKit/Shared/WebPreferences.yaml

    r245964 r246002  
    546546  condition: ENABLE(WEB_RTC)
    547547
     548InterruptAudioOnPageVisibilityChangeEnabled:
     549  type: bool
     550  defaultValue: WebCore::RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange()
     551  webcoreBinding: RuntimeEnabledFeatures
     552  condition: ENABLE(MEDIA_STREAM)
     553
    548554WebRTCUnifiedPlanEnabled:
    549555  type: bool
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm

    r245964 r246002  
    650650}
    651651
     652- (BOOL)_interruptAudioOnPageVisibilityChangeEnabled
     653{
     654    return _preferences->interruptAudioOnPageVisibilityChangeEnabled();
     655}
     656
     657- (void)_setInterruptAudioOnPageVisibilityChangeEnabled:(BOOL)enabled
     658{
     659    _preferences->setInterruptAudioOnPageVisibilityChangeEnabled(enabled);
     660}
     661
    652662- (BOOL)_enumeratingAllNetworkInterfacesEnabled
    653663{
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h

    r245964 r246002  
    121121@property (nonatomic, setter=_setWebRTCLegacyAPIEnabled:) BOOL _webRTCLegacyAPIEnabled WK_API_AVAILABLE(macos(10.13), ios(11.0));
    122122@property (nonatomic, setter=_setInactiveMediaCaptureSteamRepromptIntervalInMinutes:) double _inactiveMediaCaptureSteamRepromptIntervalInMinutes WK_API_AVAILABLE(macos(10.13.4), ios(11.3));
     123@property (nonatomic, setter=_setInterruptAudioOnPageVisibilityChangeEnabled:) BOOL _interruptAudioOnPageVisibilityChangeEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
    123124
    124125@property (nonatomic, setter=_setJavaScriptCanAccessClipboard:) BOOL _javaScriptCanAccessClipboard WK_API_AVAILABLE(macos(10.13), ios(11.0));
  • trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp

    r245964 r246002  
    367367}
    368368
    369 }
    370 
     369#if PLATFORM(IOS_FAMILY)
     370void UserMediaCaptureManager::setAudioCapturePageState(bool interrupted, bool pageMuted)
     371{
     372    if (auto* activeSource = static_cast<AudioCaptureFactory*>(this)->activeSource())
     373        activeSource->setInterrupted(interrupted, pageMuted);
     374}
     375
     376void UserMediaCaptureManager::setVideoCapturePageState(bool interrupted, bool pageMuted)
     377{
     378    if (auto* activeSource = static_cast<VideoCaptureFactory*>(this)->activeSource())
     379        activeSource->setInterrupted(interrupted, pageMuted);
     380}
    371381#endif
     382
     383}
     384
     385#endif
  • trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.h

    r245964 r246002  
    8080    WebCore::CaptureDeviceManager& displayCaptureDeviceManager() final { return m_noOpCaptureDeviceManager; }
    8181
     82#if PLATFORM(IOS_FAMILY)
     83    void setAudioCapturePageState(bool interrupted, bool pageMuted) final;
     84    void setVideoCapturePageState(bool interrupted, bool pageMuted) final;
     85#endif
     86
    8287    // IPC::MessageReceiver
    8388    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
Note: See TracChangeset for help on using the changeset viewer.