[Mac] Add back web audio support for getUserMedia MediaStreamTrack
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Apr 2017 02:50:51 +0000 (02:50 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Apr 2017 02:50:51 +0000 (02:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170482

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-04
Reviewed by Eric Carlson.

Source/WebCore:

┬┤Covered by reenabled test.

Exporting method and class used in WebKit2.

* WebCore.xcodeproj/project.pbxproj:
* platform/audio/mac/CAAudioStreamDescription.h:
* platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:

Source/WebKit2:

* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::Source::setStorage):

LayoutTests:

* TestExpectations:

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

LayoutTests/ChangeLog
LayoutTests/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h
Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/cocoa/UserMediaCaptureManager.cpp

index 15c04fa..f0fbf7a 100644 (file)
@@ -1,3 +1,12 @@
+2017-04-04  Youenn Fablet  <youenn@apple.com>
+
+        [Mac] Add back web audio support for getUserMedia MediaStreamTrack
+        https://bugs.webkit.org/show_bug.cgi?id=170482
+
+        Reviewed by Eric Carlson.
+
+        * TestExpectations:
+
 2017-04-04  Ryan Haddad  <ryanhaddad@apple.com>
 
         Mark fast/images/slower-animation-than-decoding-image.html as flaky.
index d4abd7b..51bba55 100644 (file)
@@ -717,7 +717,6 @@ webrtc/video-getParameters.html [ Failure ]
 webrtc/peer-connection-audio-mute2.html [ Pass Failure ]
 webrtc/peer-connection-remote-audio-mute2.html [ Pass Failure ]
 webkit.org/b/170178 webrtc/video-replace-track-to-null.html [ Pass Failure ]
-fast/mediastream/getUserMedia-webaudio.html [ Skip ]
 fast/mediastream/RTCPeerConnection-closed-state.html [ Skip ]
 fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html [ Skip ]
 fast/mediastream/RTCPeerConnection-more-media-to-negotiate.html [ Skip ]
index 0d08a6d..c11c5a9 100644 (file)
@@ -1,3 +1,18 @@
+2017-04-04  Youenn Fablet  <youenn@apple.com>
+
+        [Mac] Add back web audio support for getUserMedia MediaStreamTrack
+        https://bugs.webkit.org/show_bug.cgi?id=170482
+
+        Reviewed by Eric Carlson.
+
+        ┬┤Covered by reenabled test.
+
+        Exporting method and class used in WebKit2.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/audio/mac/CAAudioStreamDescription.h:
+        * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
+
 2017-04-04  Alexey Proskuryakov  <ap@apple.com>
 
         More build fixing.
index 79485a2..996697a 100644 (file)
                07C1C0E21BFB600100BD2256 /* MediaTrackSupportedConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C1C0E01BFB600100BD2256 /* MediaTrackSupportedConstraints.h */; };
                07C1C0E51BFB60ED00BD2256 /* RealtimeMediaSourceSupportedConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C1C0E41BFB60ED00BD2256 /* RealtimeMediaSourceSupportedConstraints.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07CE77D516712A6A00C55A47 /* InbandTextTrackPrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               07D637401BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = 07D6373E1BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h */; };
+               07D637401BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = 07D6373E1BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07D637411BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07D6373F1BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.mm */; };
                07D6A4EF1BECF2D200174146 /* MockRealtimeMediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07D6A4ED1BECF2D200174146 /* MockRealtimeMediaSource.cpp */; };
                07D6A4F01BECF2D200174146 /* MockRealtimeMediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 07D6A4EE1BECF2D200174146 /* MockRealtimeMediaSource.h */; };
index 817246d..032b697 100644 (file)
@@ -43,7 +43,7 @@ public:
 
     const PlatformDescription& platformDescription() const final;
 
-    PCMFormat format() const final;
+    WEBCORE_EXPORT PCMFormat format() const final;
 
     double sampleRate() const final { return m_streamDescription.mSampleRate; }
     bool isPCM() const final { return m_streamDescription.mFormatID == kAudioFormatLinearPCM; }
index 10ad961..d984469 100644 (file)
@@ -44,7 +44,7 @@ namespace WebCore {
 class AudioSampleDataSource;
 class CAAudioStreamDescription;
 
-class WebAudioSourceProviderAVFObjC : public RefCounted<WebAudioSourceProviderAVFObjC>, public AudioSourceProvider, RealtimeMediaSource::Observer {
+class WEBCORE_EXPORT WebAudioSourceProviderAVFObjC : public RefCounted<WebAudioSourceProviderAVFObjC>, public AudioSourceProvider, RealtimeMediaSource::Observer {
 public:
     static Ref<WebAudioSourceProviderAVFObjC> create(RealtimeMediaSource&);
     virtual ~WebAudioSourceProviderAVFObjC();
index 56ae473..c14268b 100644 (file)
@@ -1,3 +1,13 @@
+2017-04-04  Youenn Fablet  <youenn@apple.com>
+
+        [Mac] Add back web audio support for getUserMedia MediaStreamTrack
+        https://bugs.webkit.org/show_bug.cgi?id=170482
+
+        Reviewed by Eric Carlson.
+
+        * WebProcess/cocoa/UserMediaCaptureManager.cpp:
+        (WebKit::UserMediaCaptureManager::Source::setStorage):
+
 2017-04-04  Tim Horton  <timothy_horton@apple.com>
 
         [Mac] -[WKWebView findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:] invokes the resultCollector with didWrap = NO even when it wraps
index 66237d0..ecf46ce 100644 (file)
@@ -38,6 +38,7 @@
 #include <WebCore/MediaConstraintsImpl.h>
 #include <WebCore/RealtimeMediaSourceCenter.h>
 #include <WebCore/WebAudioBufferList.h>
+#include <WebCore/WebAudioSourceProviderAVFObjC.h>
 
 using namespace WebCore;
 
@@ -79,6 +80,9 @@ public:
     void setStorage(const SharedMemory::Handle& handle, const WebCore::CAAudioStreamDescription& description, uint64_t numberOfFrames)
     {
         m_description = description;
+        if (m_audioSourceProvider)
+            m_audioSourceProvider->prepare(&m_description.streamDescription());
+
         if (handle.isNull()) {
             m_ringBuffer.deallocate();
             storage().setReadOnly(false);
@@ -110,7 +114,14 @@ public:
     void startProducingData() final { m_manager.startProducingData(m_id); }
     void stopProducingData() final { m_manager.stopProducingData(m_id); }
 
-    AudioSourceProvider* audioSourceProvider() final { return nullptr; }
+    AudioSourceProvider* audioSourceProvider() final {
+        if (!m_audioSourceProvider) {
+            m_audioSourceProvider = WebAudioSourceProviderAVFObjC::create(*this);
+            if (m_description.format() != AudioStreamDescription::None)
+                m_audioSourceProvider->prepare(&m_description.streamDescription());
+        }
+        return m_audioSourceProvider.get();
+    }
 
 private:
     // RealtimeMediaSource
@@ -123,6 +134,7 @@ private:
     RealtimeMediaSourceSettings m_settings;
     CAAudioStreamDescription m_description;
     CARingBuffer m_ringBuffer;
+    RefPtr<WebAudioSourceProviderAVFObjC> m_audioSourceProvider;
 };
 
 UserMediaCaptureManager::UserMediaCaptureManager(WebProcess* process)