Remove AVAudioCaptureSource
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 May 2017 22:19:50 +0000 (22:19 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 May 2017 22:19:50 +0000 (22:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172360

Patch by Youenn Fablet <youenn@apple.com> on 2017-05-22
Reviewed by Sam Weinig.

Source/WebCore:

No change of behavior, this class is no longer used by default as it does not support echo cancellation.

* WebCore.xcodeproj/project.pbxproj:
* page/Settings.cpp:
(WebCore::Settings::setMediaCaptureRequiresSecureConnection):
(WebCore::Settings::useAVFoundationAudioCapture): Deleted.
(WebCore::Settings::setUseAVFoundationAudioCapture): Deleted.
* page/Settings.h:
* platform/mediastream/mac/AVAudioCaptureSource.h: Removed.
* platform/mediastream/mac/AVAudioCaptureSource.mm: Removed.
* platform/mediastream/mac/AVCaptureDeviceManager.h:
* platform/mediastream/mac/AVCaptureDeviceManager.mm:
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
(WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
(WebCore::RealtimeMediaSourceCenterMac::defaultAudioCaptureDeviceManager):
(WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture): Deleted.
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:

Source/WebKit/mac:

Removing the handling of AVAudio/CoreAudio capture source dynamic switch.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences useAVFoundationAudioCapture]): Deleted.
(-[WebPreferences setUseAVFoundationAudioCapture:]): Deleted.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Removing the handling of AVAudio/CoreAudio capture source dynamic switch.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetUseAVFoundationAudioCapture): Deleted.
(WKPreferencesGetUseAVFoundationAudioCapture): Deleted.
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217251 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.h [deleted file]
Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm [deleted file]
Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.h
Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm
Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp
Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 0d48183..e83a945 100644 (file)
@@ -1,3 +1,28 @@
+2017-05-22  Youenn Fablet  <youenn@apple.com>
+
+        Remove AVAudioCaptureSource
+        https://bugs.webkit.org/show_bug.cgi?id=172360
+
+        Reviewed by Sam Weinig.
+
+        No change of behavior, this class is no longer used by default as it does not support echo cancellation.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/Settings.cpp:
+        (WebCore::Settings::setMediaCaptureRequiresSecureConnection):
+        (WebCore::Settings::useAVFoundationAudioCapture): Deleted.
+        (WebCore::Settings::setUseAVFoundationAudioCapture): Deleted.
+        * page/Settings.h:
+        * platform/mediastream/mac/AVAudioCaptureSource.h: Removed.
+        * platform/mediastream/mac/AVAudioCaptureSource.mm: Removed.
+        * platform/mediastream/mac/AVCaptureDeviceManager.h:
+        * platform/mediastream/mac/AVCaptureDeviceManager.mm:
+        * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
+        (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
+        (WebCore::RealtimeMediaSourceCenterMac::defaultAudioCaptureDeviceManager):
+        (WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture): Deleted.
+        * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
+
 2017-05-22  Brian Burg  <bburg@apple.com>
 
         Web Inspector: webkit reload policy should match default behavior
index 1eef36d..82eb89a 100644 (file)
@@ -71,8 +71,6 @@
                070334D71459FFD5008D8D45 /* TrackBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 070334D61459FFD5008D8D45 /* TrackBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                070334D9145A006F008D8D45 /* TrackBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 070334D8145A006F008D8D45 /* TrackBase.cpp */; };
                070334E9145A1F36008D8D45 /* JSTrackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 070334E8145A1F35008D8D45 /* JSTrackCustom.cpp */; };
-               070363E0181A1CDC00C074A5 /* AVAudioCaptureSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 070363D8181A1CDC00C074A5 /* AVAudioCaptureSource.h */; };
-               070363E1181A1CDC00C074A5 /* AVAudioCaptureSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 070363D9181A1CDC00C074A5 /* AVAudioCaptureSource.mm */; };
                070363E2181A1CDC00C074A5 /* AVCaptureDeviceManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 070363DA181A1CDC00C074A5 /* AVCaptureDeviceManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
                070363E3181A1CDC00C074A5 /* AVCaptureDeviceManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 070363DB181A1CDC00C074A5 /* AVCaptureDeviceManager.mm */; };
                070363E4181A1CDC00C074A5 /* AVMediaCaptureSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 070363DC181A1CDC00C074A5 /* AVMediaCaptureSource.h */; };
                070334D61459FFD5008D8D45 /* TrackBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackBase.h; sourceTree = "<group>"; };
                070334D8145A006F008D8D45 /* TrackBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrackBase.cpp; sourceTree = "<group>"; };
                070334E8145A1F35008D8D45 /* JSTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTrackCustom.cpp; sourceTree = "<group>"; };
-               070363D8181A1CDC00C074A5 /* AVAudioCaptureSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVAudioCaptureSource.h; sourceTree = "<group>"; };
-               070363D9181A1CDC00C074A5 /* AVAudioCaptureSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVAudioCaptureSource.mm; sourceTree = "<group>"; };
                070363DA181A1CDC00C074A5 /* AVCaptureDeviceManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVCaptureDeviceManager.h; sourceTree = "<group>"; };
                070363DB181A1CDC00C074A5 /* AVCaptureDeviceManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVCaptureDeviceManager.mm; sourceTree = "<group>"; };
                070363DC181A1CDC00C074A5 /* AVMediaCaptureSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVMediaCaptureSource.h; sourceTree = "<group>"; };
                        children = (
                                076EC1321E44F2CB00E5D813 /* AudioTrackPrivateMediaStreamCocoa.cpp */,
                                07C046C61E42512F007201E7 /* AudioTrackPrivateMediaStreamCocoa.h */,
-                               070363D8181A1CDC00C074A5 /* AVAudioCaptureSource.h */,
-                               070363D9181A1CDC00C074A5 /* AVAudioCaptureSource.mm */,
                                070363DA181A1CDC00C074A5 /* AVCaptureDeviceManager.h */,
                                070363DB181A1CDC00C074A5 /* AVCaptureDeviceManager.mm */,
                                070363DC181A1CDC00C074A5 /* AVMediaCaptureSource.h */,
                                C9D467051E60C465008195FB /* AutoplayEvent.h in Headers */,
                                45830D4E1679B4F800ACF8C3 /* AutoscrollController.h in Headers */,
                                A8CFF04E0A154F09000A4234 /* AutoTableLayout.h in Headers */,
-                               070363E0181A1CDC00C074A5 /* AVAudioCaptureSource.h in Headers */,
                                070363E2181A1CDC00C074A5 /* AVCaptureDeviceManager.h in Headers */,
                                07F0B97C1AC5DB4600E535D9 /* AVFoundationSPI.h in Headers */,
                                07F0B97A1AC5DB3300E535D9 /* AVKitSPI.h in Headers */,
                                7C1E97271A9F9834007BF0FB /* AutoFillButtonElement.cpp in Sources */,
                                45830D4D1679B4F800ACF8C3 /* AutoscrollController.cpp in Sources */,
                                A8CFF0500A154F09000A4234 /* AutoTableLayout.cpp in Sources */,
-                               070363E1181A1CDC00C074A5 /* AVAudioCaptureSource.mm in Sources */,
                                070363E3181A1CDC00C074A5 /* AVCaptureDeviceManager.mm in Sources */,
                                0719427F1D088F21002AA51D /* AVFoundationMIMETypeCache.mm in Sources */,
                                070363E5181A1CDC00C074A5 /* AVMediaCaptureSource.mm in Sources */,
index 0eaf526..3b41344 100644 (file)
@@ -98,7 +98,6 @@ bool Settings::gMockScrollAnimatorEnabled = false;
 #if ENABLE(MEDIA_STREAM)
 bool Settings::gMockCaptureDevicesEnabled = false;
 bool Settings::gMediaCaptureRequiresSecureConnection = true;
-bool Settings::gUseAVFoundationAudioCapture = false;
 #endif
 
 #if PLATFORM(WIN)
@@ -620,19 +619,6 @@ void Settings::setMediaCaptureRequiresSecureConnection(bool mediaCaptureRequires
 {
     gMediaCaptureRequiresSecureConnection = mediaCaptureRequiresSecureConnection;
 }
-
-bool Settings::useAVFoundationAudioCapture()
-{
-    return gUseAVFoundationAudioCapture;
-}
-
-void Settings::setUseAVFoundationAudioCapture(bool useAVFoundationAudioCapture)
-{
-    gUseAVFoundationAudioCapture = useAVFoundationAudioCapture;
-#if USE(AVFOUNDATION)
-    RealtimeMediaSourceCenterMac::singleton().setUseAVFoundationAudioCapture(useAVFoundationAudioCapture);
-#endif
-}
 #endif
 
 void Settings::setScrollingPerformanceLoggingEnabled(bool enabled)
index 5948dbe..d196dc2 100644 (file)
@@ -310,9 +310,6 @@ public:
 
     bool mediaCaptureRequiresSecureConnection() const;
     WEBCORE_EXPORT static void setMediaCaptureRequiresSecureConnection(bool);
-
-    static bool useAVFoundationAudioCapture();
-    WEBCORE_EXPORT static void setUseAVFoundationAudioCapture(bool);
 #endif
 
 #if ENABLE(APPLE_PAY)
@@ -418,7 +415,6 @@ private:
     String m_mediaDeviceIdentifierStorageDirectory;
     static bool gMockCaptureDevicesEnabled;
     static bool gMediaCaptureRequiresSecureConnection;
-    static bool gUseAVFoundationAudioCapture;
 #endif
 
 #if ENABLE(APPLE_PAY)
diff --git a/Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.h b/Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.h
deleted file mode 100644 (file)
index 7988c1e..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef AVAudioCaptureSource_h
-#define AVAudioCaptureSource_h
-
-#if ENABLE(MEDIA_STREAM) && USE(AVFOUNDATION)
-
-#include "AVMediaCaptureSource.h"
-#include "CAAudioStreamDescription.h"
-#include <wtf/Lock.h>
-
-typedef struct AudioBufferList AudioBufferList;
-typedef struct AudioStreamBasicDescription AudioStreamBasicDescription;
-typedef const struct opaqueCMFormatDescription *CMFormatDescriptionRef;
-
-namespace WebCore {
-
-class WebAudioBufferList;
-class WebAudioSourceProviderAVFObjC;
-
-class AVAudioCaptureSource : public AVMediaCaptureSource {
-public:
-
-    static CaptureSourceOrError create(AVCaptureDevice*, const AtomicString&, const MediaConstraints*);
-
-    WEBCORE_EXPORT static AudioCaptureFactory& factory();
-
-private:
-    AVAudioCaptureSource(AVCaptureDevice*, const AtomicString&);
-    virtual ~AVAudioCaptureSource();
-
-    void initializeCapabilities(RealtimeMediaSourceCapabilities&) override;
-    void initializeSupportedConstraints(RealtimeMediaSourceSupportedConstraints&) override;
-
-    void captureOutputDidOutputSampleBufferFromConnection(AVCaptureOutput*, CMSampleBufferRef, AVCaptureConnection*) override;
-    
-    void setupCaptureSession() override;
-    void shutdownCaptureSession() override;
-    void updateSettings(RealtimeMediaSourceSettings&) override;
-    AudioSourceProvider* audioSourceProvider() override;
-
-    RetainPtr<AVCaptureConnection> m_audioConnection;
-    std::unique_ptr<WebAudioBufferList> m_list;
-
-    RefPtr<WebAudioSourceProviderAVFObjC> m_audioSourceProvider;
-    std::unique_ptr<CAAudioStreamDescription> m_inputDescription;
-    Lock m_lock;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
-
-#endif // AVVideoCaptureSource_h
diff --git a/Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm b/Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm
deleted file mode 100644 (file)
index aeb24fd..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "AVAudioCaptureSource.h"
-
-#if ENABLE(MEDIA_STREAM) && USE(AVFOUNDATION)
-
-#import "AudioSampleBufferList.h"
-#import "CAAudioStreamDescription.h"
-#import "CaptureDevice.h"
-#import "Logging.h"
-#import "MediaConstraints.h"
-#import "MediaSampleAVFObjC.h"
-#import "RealtimeMediaSourceSettings.h"
-#import "SoftLinking.h"
-#import "WebAudioSourceProviderAVFObjC.h"
-#import <AVFoundation/AVCaptureInput.h>
-#import <AVFoundation/AVCaptureOutput.h>
-#import <AVFoundation/AVCaptureSession.h>
-#import <CoreAudio/CoreAudioTypes.h>
-#import <wtf/HashSet.h>
-#import <wtf/NeverDestroyed.h>
-
-#import "CoreMediaSoftLink.h"
-
-typedef AVCaptureAudioChannel AVCaptureAudioChannelType;
-typedef AVCaptureAudioDataOutput AVCaptureAudioDataOutputType;
-typedef AVCaptureConnection AVCaptureConnectionType;
-typedef AVCaptureDevice AVCaptureDeviceTypedef;
-typedef AVCaptureDeviceInput AVCaptureDeviceInputType;
-typedef AVCaptureOutput AVCaptureOutputType;
-
-SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation)
-
-SOFT_LINK_CLASS(AVFoundation, AVCaptureAudioChannel)
-SOFT_LINK_CLASS(AVFoundation, AVCaptureAudioDataOutput)
-SOFT_LINK_CLASS(AVFoundation, AVCaptureConnection)
-SOFT_LINK_CLASS(AVFoundation, AVCaptureDevice)
-SOFT_LINK_CLASS(AVFoundation, AVCaptureDeviceInput)
-SOFT_LINK_CLASS(AVFoundation, AVCaptureOutput)
-
-#define AVCaptureAudioChannel getAVCaptureAudioChannelClass()
-#define AVCaptureAudioDataOutput getAVCaptureAudioDataOutputClass()
-#define AVCaptureConnection getAVCaptureConnectionClass()
-#define AVCaptureDevice getAVCaptureDeviceClass()
-#define AVCaptureDeviceFormat getAVCaptureDeviceFormatClass()
-#define AVCaptureDeviceInput getAVCaptureDeviceInputClass()
-#define AVCaptureOutput getAVCaptureOutputClass()
-#define AVFrameRateRange getAVFrameRateRangeClass()
-
-SOFT_LINK_POINTER(AVFoundation, AVMediaTypeAudio, NSString *)
-
-#define AVMediaTypeAudio getAVMediaTypeAudio()
-
-namespace WebCore {
-
-class AVAudioCaptureSourceFactory : public RealtimeMediaSource::AudioCaptureFactory
-#if PLATFORM(IOS)
-    , public RealtimeMediaSource::SingleSourceFactory<AVAudioCaptureSource>
-#endif
-{
-public:
-    CaptureSourceOrError createAudioCaptureSource(const String& deviceID, const MediaConstraints* constraints) final {
-        AVCaptureDeviceTypedef *device = [getAVCaptureDeviceClass() deviceWithUniqueID:deviceID];
-        return device ? AVAudioCaptureSource::create(device, emptyString(), constraints) : CaptureSourceOrError();
-    }
-};
-
-CaptureSourceOrError AVAudioCaptureSource::create(AVCaptureDeviceTypedef* device, const AtomicString& id, const MediaConstraints* constraints)
-{
-    auto source = adoptRef(*new AVAudioCaptureSource(device, id));
-    if (constraints) {
-        auto result = source->applyConstraints(*constraints);
-        if (result)
-            return String(result.value().first);
-    }
-
-    return CaptureSourceOrError(WTFMove(source));
-}
-
-static AVAudioCaptureSourceFactory& avAudioCaptureSourceFactory()
-{
-    static NeverDestroyed<AVAudioCaptureSourceFactory> factory;
-    return factory.get();
-}
-
-RealtimeMediaSource::AudioCaptureFactory& AVAudioCaptureSource::factory()
-{
-    return avAudioCaptureSourceFactory();
-}
-
-AVAudioCaptureSource::AVAudioCaptureSource(AVCaptureDeviceTypedef* device, const AtomicString& id)
-    : AVMediaCaptureSource(device, id, Type::Audio)
-{
-}
-
-AVAudioCaptureSource::~AVAudioCaptureSource()
-{
-#if PLATFORM(IOS)
-    avAudioCaptureSourceFactory().unsetActiveSource(*this);
-#endif
-    shutdownCaptureSession();
-}
-
-void AVAudioCaptureSource::initializeCapabilities(RealtimeMediaSourceCapabilities& capabilities)
-{
-    // FIXME: finish this implementation - https://webkit.org/b/122430
-    capabilities.setVolume(CapabilityValueOrRange(0.0, 1.0));
-}
-
-void AVAudioCaptureSource::initializeSupportedConstraints(RealtimeMediaSourceSupportedConstraints& supportedConstraints)
-{
-    supportedConstraints.setSupportsVolume(true);
-}
-
-void AVAudioCaptureSource::updateSettings(RealtimeMediaSourceSettings& settings)
-{
-    // FIXME: support volume
-
-    settings.setDeviceId(id());
-}
-
-void AVAudioCaptureSource::setupCaptureSession()
-{
-#if PLATFORM(IOS)
-    avAudioCaptureSourceFactory().setActiveSource(*this);
-#endif
-
-    RetainPtr<AVCaptureDeviceInputType> audioIn = adoptNS([allocAVCaptureDeviceInputInstance() initWithDevice:device() error:nil]);
-
-    if (![session() canAddInput:audioIn.get()]) {
-        LOG(Media, "AVVideoCaptureSource::setupCaptureSession(%p), unable to add audio input device", this);
-        return;
-    }
-    [session() addInput:audioIn.get()];
-
-    RetainPtr<AVCaptureAudioDataOutputType> audioOutput = adoptNS([allocAVCaptureAudioDataOutputInstance() init]);
-    setAudioSampleBufferDelegate(audioOutput.get());
-
-    if (![session() canAddOutput:audioOutput.get()]) {
-        LOG(Media, "AVVideoCaptureSource::setupCaptureSession(%p), unable to add audio sample buffer output delegate", this);
-        return;
-    }
-    [session() addOutput:audioOutput.get()];
-    m_audioConnection = [audioOutput.get() connectionWithMediaType:AVMediaTypeAudio];
-}
-
-void AVAudioCaptureSource::shutdownCaptureSession()
-{
-    {
-        LockHolder lock(m_lock);
-
-        m_audioConnection = nullptr;
-        m_inputDescription = nullptr;
-
-        if (m_audioSourceProvider)
-            m_audioSourceProvider->unprepare();
-    }
-
-    // Don't hold the lock when destroying the audio provider, it will call back into this object
-    // to remove itself as an observer.
-    m_audioSourceProvider = nullptr;
-}
-
-void AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection(AVCaptureOutputType*, CMSampleBufferRef sampleBuffer, AVCaptureConnectionType*)
-{
-    if (muted())
-        return;
-
-    CMFormatDescriptionRef formatDescription = CMSampleBufferGetFormatDescription(sampleBuffer);
-    if (!formatDescription)
-        return;
-
-    std::unique_lock<Lock> lock(m_lock, std::try_to_lock);
-    if (!lock.owns_lock()) {
-        // Failed to acquire the lock, just return instead of blocking.
-        return;
-    }
-
-    const AudioStreamBasicDescription* streamDescription = CMAudioFormatDescriptionGetStreamBasicDescription(formatDescription);
-    if (!m_inputDescription || *m_inputDescription != *streamDescription) {
-        m_inputDescription = std::make_unique<CAAudioStreamDescription>(*streamDescription);
-
-        if (m_audioSourceProvider)
-            m_audioSourceProvider->prepare(streamDescription);
-    }
-
-    m_list = std::make_unique<WebAudioBufferList>(*m_inputDescription, sampleBuffer);
-    audioSamplesAvailable(toMediaTime(CMSampleBufferGetPresentationTimeStamp(sampleBuffer)), *m_list, CAAudioStreamDescription(*streamDescription), CMSampleBufferGetNumSamples(sampleBuffer));
-}
-
-AudioSourceProvider* AVAudioCaptureSource::audioSourceProvider()
-{
-    if (!m_audioSourceProvider)
-        m_audioSourceProvider = WebAudioSourceProviderAVFObjC::create(*this);
-
-    return m_audioSourceProvider.get();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
index 0cb1722..2d5ecd7 100644 (file)
@@ -45,8 +45,6 @@ namespace WebCore {
 class AVCaptureDeviceManager final : public CaptureDeviceManager {
     friend class NeverDestroyed<AVCaptureDeviceManager>;
 public:
-    WEBCORE_EXPORT static void setUseAVFoundationAudioCapture(bool);
-
     Vector<CaptureDevice>& captureDevices() final;
 
     static AVCaptureDeviceManager& singleton();
index fd759ea..14c9553 100644 (file)
@@ -28,7 +28,6 @@
 
 #if ENABLE(MEDIA_STREAM) && USE(AVFOUNDATION)
 
-#import "AVAudioCaptureSource.h"
 #import "AVMediaCaptureSource.h"
 #import "AVVideoCaptureSource.h"
 #import "AudioSourceProvider.h"
index d7d7389..03febb2 100644 (file)
@@ -33,7 +33,6 @@
 #if ENABLE(MEDIA_STREAM)
 #include "RealtimeMediaSourceCenterMac.h"
 
-#include "AVAudioCaptureSource.h"
 #include "AVAudioSessionCaptureDeviceManager.h"
 #include "AVCaptureDeviceManager.h"
 #include "AVVideoCaptureSource.h"
 
 namespace WebCore {
 
-void RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture(bool enabled)
-{
-    m_useAVFoundationAudioCapture = enabled;
-}
-
 RealtimeMediaSourceCenterMac& RealtimeMediaSourceCenterMac::singleton()
 {
     ASSERT(isMainThread());
@@ -77,7 +71,7 @@ RealtimeMediaSourceCenterMac::~RealtimeMediaSourceCenterMac()
 
 RealtimeMediaSource::AudioCaptureFactory& RealtimeMediaSourceCenterMac::defaultAudioFactory()
 {
-    return m_useAVFoundationAudioCapture ? AVAudioCaptureSource::factory() : CoreAudioCaptureSource::factory();
+    return CoreAudioCaptureSource::factory();
 }
 
 RealtimeMediaSource::VideoCaptureFactory& RealtimeMediaSourceCenterMac::defaultVideoFactory()
@@ -87,8 +81,6 @@ RealtimeMediaSource::VideoCaptureFactory& RealtimeMediaSourceCenterMac::defaultV
 
 CaptureDeviceManager& RealtimeMediaSourceCenterMac::defaultAudioCaptureDeviceManager()
 {
-    if (m_useAVFoundationAudioCapture)
-        return AVCaptureDeviceManager::singleton();
 #if PLATFORM(MAC)
     return CoreAudioCaptureDeviceManager::singleton();
 #else
index 85bbfe4..a51d0e4 100644 (file)
@@ -44,7 +44,6 @@ class RealtimeMediaSourceCenterMac final : public RealtimeMediaSourceCenter {
 public:
     WEBCORE_EXPORT static RealtimeMediaSourceCenterMac& singleton();
 
-    WEBCORE_EXPORT void setUseAVFoundationAudioCapture(bool enabled);
 private:
     friend class NeverDestroyed<RealtimeMediaSourceCenterMac>;
     RealtimeMediaSourceCenterMac();
@@ -55,8 +54,6 @@ private:
 
     CaptureDeviceManager& defaultAudioCaptureDeviceManager() final;
     CaptureDeviceManager& defaultVideoCaptureDeviceManager() final;
-
-    bool m_useAVFoundationAudioCapture { false };
 };
 
 } // namespace WebCore
index 3115f8d..8444cce 100644 (file)
@@ -1,3 +1,21 @@
+2017-05-22  Youenn Fablet  <youenn@apple.com>
+
+        Remove AVAudioCaptureSource
+        https://bugs.webkit.org/show_bug.cgi?id=172360
+
+        Reviewed by Sam Weinig.
+
+        Removing the handling of AVAudio/CoreAudio capture source dynamic switch.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences useAVFoundationAudioCapture]): Deleted.
+        (-[WebPreferences setUseAVFoundationAudioCapture:]): Deleted.
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2017-05-22  Sam Weinig  <sam@webkit.org>
 
         [WebIDL] Support callbacks with arbitrary return types
index 7d6de1f..d9b27ca 100644 (file)
 #define WebKitEnableInheritURIQueryComponentPreferenceKey @"WebKitEnableInheritURIQueryComponent"
 #define WebKitMediaDataLoadsAutomaticallyPreferenceKey @"WebKitMediaDataLoadsAutomatically"
 #define WebKitMockCaptureDevicesEnabledPreferenceKey @"WebKitMockCaptureDevicesEnabled"
-#define WebKitUseAVFoundationAudioCapturePreferenceKey @"WebKitUseAVFoundationAudioCaptureEnabled"
 #define WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey @"WebKitEnumeratingAllNetworkInterfacesEnabled"
 #define WebKitICECandidateFilteringEnabledPreferenceKey @"WebKitICECandidateFilteringEnabled"
 #define WebKitMediaCaptureRequiresSecureConnectionPreferenceKey @"WebKitMediaCaptureRequiresSecureConnection"
index f8c57c8..b8385fe 100644 (file)
@@ -619,7 +619,6 @@ public:
 #if ENABLE(MEDIA_STREAM)
         [NSNumber numberWithBool:NO], WebKitMockCaptureDevicesEnabledPreferenceKey,
         [NSNumber numberWithBool:YES], WebKitMediaCaptureRequiresSecureConnectionPreferenceKey,
-        [NSNumber numberWithBool:NO], WebKitUseAVFoundationAudioCapturePreferenceKey,
 #endif
         [NSNumber numberWithBool:YES], WebKitShadowDOMEnabledPreferenceKey,
         [NSNumber numberWithBool:YES], WebKitCustomElementsEnabledPreferenceKey,
@@ -2883,16 +2882,6 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitMockCaptureDevicesEnabledPreferenceKey];
 }
 
-- (BOOL)useAVFoundationAudioCapture
-{
-    return [self _boolValueForKey:WebKitUseAVFoundationAudioCapturePreferenceKey];
-}
-
-- (void)setUseAVFoundationAudioCapture:(BOOL)flag
-{
-    [self _setBoolValue:flag forKey:WebKitUseAVFoundationAudioCapturePreferenceKey];
-}
-
 - (BOOL)enumeratingAllNetworkInterfacesEnabled
 {
     return [self _boolValueForKey:WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey];
index 823fc36..f10fb00 100644 (file)
@@ -514,9 +514,6 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 - (void)setMediaCaptureRequiresSecureConnection:(BOOL)flag;
 - (BOOL)mediaCaptureRequiresSecureConnection;
 
-- (void)setUseAVFoundationAudioCapture:(BOOL)flag;
-- (BOOL)useAVFoundationAudioCapture;
-
 - (void)setShadowDOMEnabled:(BOOL)flag;
 - (BOOL)shadowDOMEnabled;
 
index 7c1e057..a120852 100644 (file)
@@ -2978,7 +2978,6 @@ static bool needsSelfRetainWhileLoadingQuirk()
     settings.setMockCaptureDevicesEnabled([preferences mockCaptureDevicesEnabled]);
     settings.setMediaCaptureRequiresSecureConnection([preferences mediaCaptureRequiresSecureConnection]);
     RuntimeEnabledFeatures::sharedFeatures().setMediaStreamEnabled([preferences mediaStreamEnabled]);
-    settings.setUseAVFoundationAudioCapture([preferences useAVFoundationAudioCapture]);
     RuntimeEnabledFeatures::sharedFeatures().setMediaDevicesEnabled([preferences mediaDevicesEnabled]);
 #endif
 
index 37d8a08..ef71417 100644 (file)
@@ -1,3 +1,22 @@
+2017-05-22  Youenn Fablet  <youenn@apple.com>
+
+        Remove AVAudioCaptureSource
+        https://bugs.webkit.org/show_bug.cgi?id=172360
+
+        Reviewed by Sam Weinig.
+
+        Removing the handling of AVAudio/CoreAudio capture source dynamic switch.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetUseAVFoundationAudioCapture): Deleted.
+        (WKPreferencesGetUseAVFoundationAudioCapture): Deleted.
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
+        (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2017-05-22  Brian Burg  <bburg@apple.com>
 
         Web Automation: characters produced with shift modifier on QWERTY keyboard should be delivered as shift-down, char-down, char-up, shift-up events
index c84ec98..3df3e7d 100644 (file)
     macro(HTTPEquivEnabled, httpEquivEnabled, Bool, bool, true, "", "") \
     macro(MockCaptureDevicesEnabled, mockCaptureDevicesEnabled, Bool, bool, false, "", "") \
     macro(MediaCaptureRequiresSecureConnection, mediaCaptureRequiresSecureConnection, Bool, bool, true, "", "") \
-    macro(UseAVFoundationAudioCapture, useAVFoundationAudioCapture, Bool, bool, false, "", "") \
     macro(EnumeratingAllNetworkInterfacesEnabled, enumeratingAllNetworkInterfacesEnabled, Bool, bool, false, "", "") \
     macro(WebRTCLegacyAPIEnabled, webRTCLegacyAPIEnabled, Bool, bool, true, "", "") \
     macro(ICECandidateFilteringEnabled, iceCandidateFilteringEnabled, Bool, bool, true, "", "") \
index ead76ba..66011d5 100644 (file)
@@ -1611,16 +1611,6 @@ bool WKPreferencesGetMediaCaptureRequiresSecureConnection(WKPreferencesRef prefe
     return toImpl(preferencesRef)->mediaCaptureRequiresSecureConnection();
 }
 
-void WKPreferencesSetUseAVFoundationAudioCapture(WKPreferencesRef preferencesRef, bool enabled)
-{
-    toImpl(preferencesRef)->setUseAVFoundationAudioCapture(enabled);
-}
-
-bool WKPreferencesGetUseAVFoundationAudioCapture(WKPreferencesRef preferencesRef)
-{
-    return toImpl(preferencesRef)->useAVFoundationAudioCapture();
-}
-
 void WKPreferencesSetFetchAPIEnabled(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setFetchAPIEnabled(flag);
index cd232b9..0b0c8f7 100644 (file)
@@ -433,10 +433,6 @@ WK_EXPORT bool WKPreferencesGetEnumeratingAllNetworkInterfacesEnabled(WKPreferen
 WK_EXPORT void WKPreferencesSetMediaCaptureRequiresSecureConnection(WKPreferencesRef, bool);
 WK_EXPORT bool WKPreferencesGetMediaCaptureRequiresSecureConnection(WKPreferencesRef);
 
-// Defaults to false.
-WK_EXPORT void WKPreferencesSetUseAVFoundationAudioCapture(WKPreferencesRef, bool);
-WK_EXPORT bool WKPreferencesGetUseAVFoundationAudioCapture(WKPreferencesRef);
-    
 // Defaults to false
 WK_EXPORT void WKPreferencesSetFetchAPIEnabled(WKPreferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetFetchAPIEnabled(WKPreferencesRef);
index 9199363..35a56b3 100644 (file)
@@ -287,11 +287,6 @@ void UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs() const
     // this is a noop if the preference hasn't changed since the last time this was called.
     bool mockDevicesEnabled = m_page.preferences().mockCaptureDevicesEnabled();
     WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled(mockDevicesEnabled);
-
-#if USE(AVFOUNDATION)
-    bool useAVFoundationAudioCapture = m_page.preferences().useAVFoundationAudioCapture();
-    WebCore::RealtimeMediaSourceCenterMac::singleton().setUseAVFoundationAudioCapture(useAVFoundationAudioCapture);
-#endif
 #endif
 }
 
index b090164..4c8cfd7 100644 (file)
@@ -3261,7 +3261,6 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
 #if ENABLE(MEDIA_STREAM)
     settings.setMockCaptureDevicesEnabled(store.getBoolValueForKey(WebPreferencesKey::mockCaptureDevicesEnabledKey()));
     settings.setMediaCaptureRequiresSecureConnection(store.getBoolValueForKey(WebPreferencesKey::mediaCaptureRequiresSecureConnectionKey()));
-    settings.setUseAVFoundationAudioCapture(store.getBoolValueForKey(WebPreferencesKey::useAVFoundationAudioCaptureKey()));
 #endif
 
     settings.setShouldConvertPositionStyleOnCopy(store.getBoolValueForKey(WebPreferencesKey::shouldConvertPositionStyleOnCopyKey()));