Title: [272324] trunk
Revision
272324
Author
[email protected]
Date
2021-02-03 09:48:07 -0800 (Wed, 03 Feb 2021)

Log Message

Make sure GPUProcess MediaRecorder handles correctly muted tracks
https://bugs.webkit.org/show_bug.cgi?id=221325

Reviewed by Eric Carlson.

Source/WebCore:

Export new methods.
Covered by updated test.

* WebCore.xcodeproj/project.pbxproj:
* platform/audio/cocoa/WebAudioBufferList.h:
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:

Source/WebKit:

In case of muted audio, zero the audio buffer before writing it in the ring buffer.
In case of muted video, send a black frame instead of the real frame.
For that purpose, create a black frame and convert it to IOSurface.
Apply this to any non IOSurface based video sample.

Fix unified build.

* GPUProcess/webrtc/RemoteMediaRecorder.h:
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
(WebKit::MediaRecorderPrivate::videoSampleAvailable):
(WebKit::MediaRecorderPrivate::audioSamplesAvailable):
* WebProcess/GPU/webrtc/MediaRecorderPrivate.h:
* WebProcess/GPU/webrtc/MediaRecorderPrivate.mm: Added.
* WebProcess/Plugins/PDF/PDFPlugin.h:
* WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:

LayoutTests:

* http/wpt/mediarecorder/mute-tracks.html:
Enable media recorder in GPUProcess and reduce the number of retries to have the test fail and not timeout.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (272323 => 272324)


--- trunk/LayoutTests/ChangeLog	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/LayoutTests/ChangeLog	2021-02-03 17:48:07 UTC (rev 272324)
@@ -1,3 +1,13 @@
+2021-02-03  Youenn Fablet  <[email protected]>
+
+        Make sure GPUProcess MediaRecorder handles correctly muted tracks
+        https://bugs.webkit.org/show_bug.cgi?id=221325
+
+        Reviewed by Eric Carlson.
+
+        * http/wpt/mediarecorder/mute-tracks.html:
+        Enable media recorder in GPUProcess and reduce the number of retries to have the test fail and not timeout.
+
 2021-02-03  Fernando Jimenez Moreno  <[email protected]>
 
         [GStreamer] Add DASH support in the registry scanner

Modified: trunk/LayoutTests/http/wpt/mediarecorder/mute-tracks.html (272323 => 272324)


--- trunk/LayoutTests/http/wpt/mediarecorder/mute-tracks.html	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/LayoutTests/http/wpt/mediarecorder/mute-tracks.html	2021-02-03 17:48:07 UTC (rev 272324)
@@ -1,4 +1,3 @@
-<!-- webkit-test-runner [ WebRTCPlatformCodecsInGPUProcessEnabled=false ] -->
 <!DOCTYPE html>
 <html>
 <head>
@@ -127,7 +126,7 @@
 
     if (counter === undefined)
         counter = 0;
-    if (counter > 400) {
+    if (counter > 100) {
         if (!errorMessage)
             errorMessage = "checkVideoBlack timed out expecting " + expected;
         return Promise.reject(errorMessage);

Modified: trunk/Source/WebCore/ChangeLog (272323 => 272324)


--- trunk/Source/WebCore/ChangeLog	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/Source/WebCore/ChangeLog	2021-02-03 17:48:07 UTC (rev 272324)
@@ -1,5 +1,19 @@
 2021-02-03  Youenn Fablet  <[email protected]>
 
+        Make sure GPUProcess MediaRecorder handles correctly muted tracks
+        https://bugs.webkit.org/show_bug.cgi?id=221325
+
+        Reviewed by Eric Carlson.
+
+        Export new methods.
+        Covered by updated test.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/audio/cocoa/WebAudioBufferList.h:
+        * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:
+
+2021-02-03  Youenn Fablet  <[email protected]>
+
         Make sure samples stay valid in LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData
         https://bugs.webkit.org/show_bug.cgi?id=221264
 

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (272323 => 272324)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-02-03 17:48:07 UTC (rev 272324)
@@ -1141,6 +1141,8 @@
 		41BBA866257E373B00AC7F6D /* SFrameUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 41209E24257A2FBB00120ACA /* SFrameUtils.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		41BF204922BA7BE80004F812 /* RealtimeVideoSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 41BF204022B947160004F812 /* RealtimeVideoSource.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		41C760B10EDE03D300C1655F /* ScriptState.h in Headers */ = {isa = PBXBuildFile; fileRef = 41C760B00EDE03D300C1655F /* ScriptState.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		41CB840125CAB7B30010E2B1 /* RealtimeIncomingVideoSourceCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 41CB840025CAB7B00010E2B1 /* RealtimeIncomingVideoSourceCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		41CB840225CAB81E0010E2B1 /* RealtimeIncomingVideoSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CDD833A1E4324BB00621E92 /* RealtimeIncomingVideoSource.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		41D015CA0F4B5C71004A662F /* ContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 41D015C80F4B5C71004A662F /* ContentType.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		41D129CE1F3D0EF600D15E47 /* WorkerGlobalScopeCaches.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FB278D1F34C28200795487 /* WorkerGlobalScopeCaches.h */; };
 		41D129D01F3D0F0500D15E47 /* CacheQueryOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FB279B1F34CEF000795487 /* CacheQueryOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7899,6 +7901,7 @@
 		41C7E1051E6A54360027B4DE /* CanvasCaptureMediaStreamTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasCaptureMediaStreamTrack.cpp; sourceTree = "<group>"; };
 		41C7E1061E6A54360027B4DE /* CanvasCaptureMediaStreamTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasCaptureMediaStreamTrack.h; sourceTree = "<group>"; };
 		41C7E1081E6AA37C0027B4DE /* CanvasCaptureMediaStreamTrack.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CanvasCaptureMediaStreamTrack.idl; sourceTree = "<group>"; };
+		41CB840025CAB7B00010E2B1 /* RealtimeIncomingVideoSourceCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RealtimeIncomingVideoSourceCocoa.h; sourceTree = "<group>"; };
 		41CD6F8923D6E81C00B16421 /* VideoSampleBufferCompressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoSampleBufferCompressor.h; sourceTree = "<group>"; };
 		41CD6F8B23D6E81D00B16421 /* VideoSampleBufferCompressor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoSampleBufferCompressor.mm; sourceTree = "<group>"; };
 		41CF8BE41D46222000707DC9 /* FetchBodyConsumer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchBodyConsumer.cpp; sourceTree = "<group>"; };
@@ -9517,7 +9520,6 @@
 		5CDCDDBF23D7B7BE00BA34A1 /* ContentFilterClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentFilterClient.h; sourceTree = "<group>"; };
 		5CDD83391E4324BB00621E83 /* RealtimeIncomingVideoSourceCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RealtimeIncomingVideoSourceCocoa.mm; sourceTree = "<group>"; };
 		5CDD83391E4324BB00621E92 /* RealtimeIncomingVideoSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RealtimeIncomingVideoSource.cpp; sourceTree = "<group>"; };
-		5CDD833A1E4324BB00621E83 /* RealtimeIncomingVideoSourceCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RealtimeIncomingVideoSourceCocoa.h; sourceTree = "<group>"; };
 		5CDD833A1E4324BB00621E92 /* RealtimeIncomingVideoSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RealtimeIncomingVideoSource.h; sourceTree = "<group>"; };
 		5CDD833B1E4324BB00621B83 /* RealtimeOutgoingVideoSourceCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RealtimeOutgoingVideoSourceCocoa.cpp; sourceTree = "<group>"; };
 		5CDD833B1E4324BB00621E92 /* RealtimeOutgoingVideoSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RealtimeOutgoingVideoSource.cpp; sourceTree = "<group>"; };
@@ -17444,7 +17446,7 @@
 				07EE76EE1BEA619800F89133 /* MockRealtimeVideoSourceMac.mm */,
 				41103AAA1E39790A00769F14 /* RealtimeIncomingAudioSourceCocoa.cpp */,
 				41103AA91E39790A00769F14 /* RealtimeIncomingAudioSourceCocoa.h */,
-				5CDD833A1E4324BB00621E83 /* RealtimeIncomingVideoSourceCocoa.h */,
+				41CB840025CAB7B00010E2B1 /* RealtimeIncomingVideoSourceCocoa.h */,
 				5CDD83391E4324BB00621E83 /* RealtimeIncomingVideoSourceCocoa.mm */,
 				4A0FFAA31AAF5EF60062803B /* RealtimeMediaSourceCenterMac.cpp */,
 				416CE4A4229DF12E00A8A686 /* RealtimeMediaSourceCenterMac.mm */,
@@ -34178,6 +34180,8 @@
 				FD31603C12B0267600C1A359 /* RealtimeAnalyser.h in Headers */,
 				41103AAD1E39791000769F03 /* RealtimeIncomingAudioSource.h in Headers */,
 				41103AAD1E39791000769F14 /* RealtimeIncomingAudioSourceCocoa.h in Headers */,
+				41CB840225CAB81E0010E2B1 /* RealtimeIncomingVideoSource.h in Headers */,
+				41CB840125CAB7B30010E2B1 /* RealtimeIncomingVideoSourceCocoa.h in Headers */,
 				4A4F65711AA997F100E38CDD /* RealtimeMediaSource.h in Headers */,
 				4A4F65721AA997F100E38CDD /* RealtimeMediaSourceCapabilities.h in Headers */,
 				4A0FFAA21AAF5EA20062803B /* RealtimeMediaSourceCenter.h in Headers */,

Modified: trunk/Source/WebCore/platform/audio/cocoa/WebAudioBufferList.h (272323 => 272324)


--- trunk/Source/WebCore/platform/audio/cocoa/WebAudioBufferList.h	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/Source/WebCore/platform/audio/cocoa/WebAudioBufferList.h	2021-02-03 17:48:07 UTC (rev 272324)
@@ -58,7 +58,7 @@
 
     WEBCORE_EXPORT static bool isSupportedDescription(const CAAudioStreamDescription&, uint32_t sampleCount);
 
-    void zeroFlatBuffer();
+    WEBCORE_EXPORT void zeroFlatBuffer();
 
 private:
     Kind kind() const { return Kind::WebAudioBufferList; }

Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h (272323 => 272324)


--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h	2021-02-03 17:48:07 UTC (rev 272324)
@@ -65,7 +65,7 @@
     webrtc::BufferType m_pixelBufferPoolBufferType;
 };
 
-RetainPtr<CVPixelBufferRef> createBlackPixelBuffer(size_t width, size_t height);
+WEBCORE_EXPORT RetainPtr<CVPixelBufferRef> createBlackPixelBuffer(size_t width, size_t height);
 
 } // namespace WebCore
 

Modified: trunk/Source/WebKit/ChangeLog (272323 => 272324)


--- trunk/Source/WebKit/ChangeLog	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/Source/WebKit/ChangeLog	2021-02-03 17:48:07 UTC (rev 272324)
@@ -1,3 +1,28 @@
+2021-02-03  Youenn Fablet  <[email protected]>
+
+        Make sure GPUProcess MediaRecorder handles correctly muted tracks
+        https://bugs.webkit.org/show_bug.cgi?id=221325
+
+        Reviewed by Eric Carlson.
+
+        In case of muted audio, zero the audio buffer before writing it in the ring buffer.
+        In case of muted video, send a black frame instead of the real frame.
+        For that purpose, create a black frame and convert it to IOSurface.
+        Apply this to any non IOSurface based video sample.
+
+        Fix unified build.
+
+        * GPUProcess/webrtc/RemoteMediaRecorder.h:
+        * SourcesCocoa.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
+        (WebKit::MediaRecorderPrivate::videoSampleAvailable):
+        (WebKit::MediaRecorderPrivate::audioSamplesAvailable):
+        * WebProcess/GPU/webrtc/MediaRecorderPrivate.h:
+        * WebProcess/GPU/webrtc/MediaRecorderPrivate.mm: Added.
+        * WebProcess/Plugins/PDF/PDFPlugin.h:
+        * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
+
 2021-02-03  Alex Christensen  <[email protected]>
 
         Fix watch and tv build after r272228

Modified: trunk/Source/WebKit/SourcesCocoa.txt (272323 => 272324)


--- trunk/Source/WebKit/SourcesCocoa.txt	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2021-02-03 17:48:07 UTC (rev 272324)
@@ -598,6 +598,7 @@
 WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.mm
 WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp
 WebProcess/GPU/webrtc/LibWebRTCCodecs.mm
+WebProcess/GPU/webrtc/MediaRecorderPrivate.mm
 
 WebProcess/InjectedBundle/API/c/WKBundlePageBanner.cpp
 

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (272323 => 272324)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-02-03 17:48:07 UTC (rev 272324)
@@ -3731,6 +3731,7 @@
 		41B7ED71206965900087D853 /* NetworkMDNSRegister.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NetworkMDNSRegister.messages.in; sourceTree = "<group>"; };
 		41C5378F21F1362D008B1FAD /* _WKWebsiteDataStoreDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsiteDataStoreDelegate.h; sourceTree = "<group>"; };
 		41C858191F510DEE0065E085 /* CacheStorageEngineCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheStorageEngineCache.cpp; sourceTree = "<group>"; };
+		41CB840325CABF7C0010E2B1 /* MediaRecorderPrivate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaRecorderPrivate.mm; sourceTree = "<group>"; };
 		41D129D91F3D101400D15E47 /* WebCacheStorageProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebCacheStorageProvider.h; sourceTree = "<group>"; };
 		41D5C6D8238EB20D00B9B3CB /* ServiceWorkerSoftUpdateLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerSoftUpdateLoader.h; sourceTree = "<group>"; };
 		41D5C6D9238EB20E00B9B3CB /* ServiceWorkerSoftUpdateLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerSoftUpdateLoader.cpp; sourceTree = "<group>"; };
@@ -8184,6 +8185,7 @@
 				4176E89723C361BD003E83FE /* MediaRecorderIdentifier.h */,
 				4176E89423C34E26003E83FE /* MediaRecorderPrivate.cpp */,
 				4176E89523C34E27003E83FE /* MediaRecorderPrivate.h */,
+				41CB840325CABF7C0010E2B1 /* MediaRecorderPrivate.mm */,
 				4176E89323C34D6F003E83FE /* MediaRecorderProvider.cpp */,
 				4176E89223C34D6E003E83FE /* MediaRecorderProvider.h */,
 				4172198C23B612E800AE5686 /* RTCDecoderIdentifier.h */,

Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp (272323 => 272324)


--- trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp	2021-02-03 17:48:07 UTC (rev 272324)
@@ -36,11 +36,13 @@
 #include <WebCore/CARingBuffer.h>
 #include <WebCore/MediaStreamPrivate.h>
 #include <WebCore/MediaStreamTrackPrivate.h>
+#include <WebCore/RealtimeIncomingVideoSourceCocoa.h>
 #include <WebCore/RemoteVideoSample.h>
 #include <WebCore/SharedBuffer.h>
 #include <WebCore/WebAudioBufferList.h>
 
 namespace WebKit {
+using namespace PAL;
 using namespace WebCore;
 
 MediaRecorderPrivate::MediaRecorderPrivate(MediaStreamPrivate& stream, const MediaRecorderPrivateOptions& options)
@@ -87,7 +89,28 @@
 
 void MediaRecorderPrivate::videoSampleAvailable(MediaSample& sample)
 {
-    if (auto remoteSample = RemoteVideoSample::create(sample))
+    std::unique_ptr<RemoteVideoSample> remoteSample;
+    if (shouldMuteVideo()) {
+        if (!m_blackFrame) {
+            auto blackFrameDescription = CMSampleBufferGetFormatDescription(sample.platformSample().sample.cmSampleBuffer);
+            auto dimensions = CMVideoFormatDescriptionGetDimensions(blackFrameDescription);
+            auto blackFrame = createBlackPixelBuffer(dimensions.width, dimensions.height);
+            // FIXME: We convert to get an IOSurface. We could optimize this.
+            m_blackFrame = convertToBGRA(blackFrame.get());
+        }
+        remoteSample = RemoteVideoSample::create(m_blackFrame.get(), sample.presentationTime(), sample.videoRotation());
+    } else {
+        m_blackFrame = nullptr;
+        remoteSample = RemoteVideoSample::create(sample);
+        if (!remoteSample) {
+            // FIXME: Optimize this code path.
+            auto pixelBuffer = static_cast<CVPixelBufferRef>(CMSampleBufferGetImageBuffer(sample.platformSample().sample.cmSampleBuffer));
+            auto newPixelBuffer = convertToBGRA(pixelBuffer);
+            remoteSample = RemoteVideoSample::create(newPixelBuffer.get(), sample.presentationTime(), sample.videoRotation());
+        }
+    }
+
+    if (remoteSample)
         m_connection->send(Messages::RemoteMediaRecorder::VideoSampleAvailable { WTFMove(*remoteSample) }, m_identifier);
 }
 
@@ -100,10 +123,20 @@
         // Allocate a ring buffer large enough to contain 2 seconds of audio.
         m_numberOfFrames = m_description.sampleRate() * 2;
         m_ringBuffer->allocate(m_description.streamDescription(), m_numberOfFrames);
+        m_silenceAudioBuffer = nullptr;
     }
 
     ASSERT(is<WebAudioBufferList>(audioData));
-    m_ringBuffer->store(downcast<WebAudioBufferList>(audioData).list(), numberOfFrames, time.timeValue());
+
+    if (shouldMuteAudio()) {
+        if (!m_silenceAudioBuffer)
+            m_silenceAudioBuffer = makeUnique<WebAudioBufferList>(m_description, numberOfFrames);
+        else
+            m_silenceAudioBuffer->setSampleCount(numberOfFrames);
+        m_silenceAudioBuffer->zeroFlatBuffer();
+        m_ringBuffer->store(m_silenceAudioBuffer->list(), numberOfFrames, time.timeValue());
+    } else
+        m_ringBuffer->store(downcast<WebAudioBufferList>(audioData).list(), numberOfFrames, time.timeValue());
     m_connection->send(Messages::RemoteMediaRecorder::AudioSamplesAvailable { time, numberOfFrames }, m_identifier);
 }
 

Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.h (272323 => 272324)


--- trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.h	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.h	2021-02-03 17:48:07 UTC (rev 272324)
@@ -31,6 +31,7 @@
 #include "SharedRingBufferStorage.h"
 
 #include <WebCore/MediaRecorderPrivate.h>
+#include <WebCore/PixelBufferConformerCV.h>
 #include <wtf/MediaTime.h>
 #include <wtf/WeakPtr.h>
 
@@ -64,17 +65,22 @@
     void resumeRecording(CompletionHandler<void()>&&) final;
 
     void storageChanged(SharedMemory*, const WebCore::CAAudioStreamDescription& format, size_t frameCount);
+    RetainPtr<CVPixelBufferRef> convertToBGRA(CVPixelBufferRef);
 
     MediaRecorderIdentifier m_identifier;
     Ref<WebCore::MediaStreamPrivate> m_stream;
     Ref<IPC::Connection> m_connection;
 
+    RetainPtr<CVPixelBufferRef> m_blackFrame;
     std::unique_ptr<WebCore::CARingBuffer> m_ringBuffer;
     WebCore::CAAudioStreamDescription m_description { };
+    std::unique_ptr<WebCore::WebAudioBufferList> m_silenceAudioBuffer;
     int64_t m_numberOfFrames { 0 };
     WebCore::MediaRecorderPrivateOptions m_options;
     bool m_hasVideo { false };
     bool m_isStopped { false };
+
+    std::unique_ptr<WebCore::PixelBufferConformerCV> m_pixelBufferConformer;
 };
 
 }

Added: trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.mm (0 => 272324)


--- trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.mm	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.mm	2021-02-03 17:48:07 UTC (rev 272324)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#include "config.h"
+#include "MediaRecorderPrivate.h"
+
+#if PLATFORM(COCOA) && ENABLE(GPU_PROCESS) && ENABLE(MEDIA_STREAM) && HAVE(AVASSETWRITERDELEGATE)
+
+#include <WebCore/CoreVideoSoftLink.h>
+
+namespace WebKit {
+using namespace WebCore;
+
+RetainPtr<CVPixelBufferRef> MediaRecorderPrivate::convertToBGRA(CVPixelBufferRef pixelBuffer)
+{
+    if (!m_pixelBufferConformer)
+        m_pixelBufferConformer = makeUnique<PixelBufferConformerCV>((__bridge CFDictionaryRef)@{ (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA) });
+    return m_pixelBufferConformer->convert(pixelBuffer);
+}
+
+}
+
+#endif

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h (272323 => 272324)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h	2021-02-03 17:48:07 UTC (rev 272324)
@@ -27,11 +27,13 @@
 
 #if ENABLE(PDFKIT_PLUGIN)
 
+#include "DataReference.h"
 #include "PDFKitImports.h"
 #include "PDFPluginIdentifier.h"
 #include "Plugin.h"
 #include "WebEvent.h"
 #include "WebHitTestResultData.h"
+#include "WebMouseEvent.h"
 #include <WebCore/AXObjectCache.h>
 #include <WebCore/AffineTransform.h>
 #include <WebCore/FindOptions.h>

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm (272323 => 272324)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm	2021-02-03 17:44:43 UTC (rev 272323)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm	2021-02-03 17:48:07 UTC (rev 272324)
@@ -33,6 +33,7 @@
 #import "PDFLayerControllerSPI.h"
 #import "PDFPlugin.h"
 #import <Quartz/Quartz.h>
+#import <WebCore/AddEventListenerOptions.h>
 #import <WebCore/CSSPrimitiveValue.h>
 #import <WebCore/CSSPropertyNames.h>
 #import <WebCore/ColorMac.h>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to