Title: [237275] trunk/Source
Revision
237275
Author
tsav...@apple.com
Date
2018-10-18 16:44:01 -0700 (Thu, 18 Oct 2018)

Log Message

Unreviewed, rolling out r237272.

Broke on device iOS builds and Windows builds

Reverted changeset:

"[MediaStream] Allow ports to optionally do screen capture in
the UI process"
https://bugs.webkit.org/show_bug.cgi?id=190728
https://trac.webkit.org/changeset/237272

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237274 => 237275)


--- trunk/Source/WebCore/ChangeLog	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/ChangeLog	2018-10-18 23:44:01 UTC (rev 237275)
@@ -1,3 +1,16 @@
+2018-10-18  Truitt Savell  <tsav...@apple.com>
+
+        Unreviewed, rolling out r237272.
+
+        Broke on device iOS builds and Windows builds
+
+        Reverted changeset:
+
+        "[MediaStream] Allow ports to optionally do screen capture in
+        the UI process"
+        https://bugs.webkit.org/show_bug.cgi?id=190728
+        https://trac.webkit.org/changeset/237272
+
 2018-10-18  Jer Noble  <jer.no...@apple.com>
 
         [MSE] timestampOffset can introduce floating-point rounding errors to incoming samples

Modified: trunk/Source/WebCore/Sources.txt (237274 => 237275)


--- trunk/Source/WebCore/Sources.txt	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/Sources.txt	2018-10-18 23:44:01 UTC (rev 237275)
@@ -1668,7 +1668,6 @@
 platform/graphics/Pattern.cpp
 platform/graphics/PlatformTimeRanges.cpp
 platform/graphics/Region.cpp
-platform/graphics/RemoteVideoSample.cpp
 platform/graphics/RoundedRect.cpp
 platform/graphics/ShadowBlur.cpp
 platform/graphics/StringTruncator.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (237274 => 237275)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-10-18 23:44:01 UTC (rev 237275)
@@ -114,7 +114,6 @@
 		073794FA19F5864E00E5A045 /* RTCDataChannelHandlerMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 073794F419F5864E00E5A045 /* RTCDataChannelHandlerMock.h */; };
 		073794FE19F5864E00E5A045 /* RTCNotifiersMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 073794F819F5864E00E5A045 /* RTCNotifiersMock.h */; };
 		07394ECA1BAB2CD700BE99CD /* MediaDevicesRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 07394EC91BAB2CD700BE99CD /* MediaDevicesRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		073A15542177A42600EA08F2 /* RemoteVideoSample.h in Headers */ = {isa = PBXBuildFile; fileRef = 073A15532177A39A00EA08F2 /* RemoteVideoSample.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		073B87671E4385AC0071C0EC /* AudioSampleBufferList.h in Headers */ = {isa = PBXBuildFile; fileRef = 073B87631E43859D0071C0EC /* AudioSampleBufferList.h */; };
 		073B87691E4385AC0071C0EC /* AudioSampleDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 073B87651E43859D0071C0EC /* AudioSampleDataSource.h */; };
 		073BDC051F68436100EE34ED /* TrackPrivateBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 076E11BE1F683E0D00177395 /* TrackPrivateBase.cpp */; };
@@ -619,7 +618,7 @@
 		1AFE119A0CBFFCC4003017FA /* JSSQLResultSetRowList.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFE11980CBFFCC4003017FA /* JSSQLResultSetRowList.h */; };
 		1AFFC4581D5E865500267A66 /* WebGLBlacklist.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFFC4511D5E7EC700267A66 /* WebGLBlacklist.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1AFFC4591D5E866100267A66 /* PluginBlacklist.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFFC44F1D5E7EC700267A66 /* PluginBlacklist.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		1B124D8D1D380B7000ECDFB0 /* MediaSampleAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B124D8C1D380B7000ECDFB0 /* MediaSampleAVFObjC.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		1B124D8D1D380B7000ECDFB0 /* MediaSampleAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B124D8C1D380B7000ECDFB0 /* MediaSampleAVFObjC.h */; };
 		1B124D8F1D380BB600ECDFB0 /* MediaSampleAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1B124D8E1D380BB600ECDFB0 /* MediaSampleAVFObjC.mm */; };
 		1BF9DB3C1D3973AD0026AEB7 /* MediaSample.h in Headers */ = {isa = PBXBuildFile; fileRef = CD641EC7181ED60100EE4C41 /* MediaSample.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1C010701192594DF008A4201 /* InlineTextBoxStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C0106FF192594DF008A4201 /* InlineTextBoxStyle.h */; };
@@ -5363,8 +5362,6 @@
 		073794F819F5864E00E5A045 /* RTCNotifiersMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCNotifiersMock.h; sourceTree = "<group>"; };
 		07394EC71BAB2CCD00BE99CD /* MediaDevicesRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaDevicesRequest.cpp; sourceTree = "<group>"; };
 		07394EC91BAB2CD700BE99CD /* MediaDevicesRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaDevicesRequest.h; sourceTree = "<group>"; };
-		073A15512177A39800EA08F2 /* RemoteVideoSample.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteVideoSample.cpp; sourceTree = "<group>"; };
-		073A15532177A39A00EA08F2 /* RemoteVideoSample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteVideoSample.h; sourceTree = "<group>"; };
 		073B87561E40DCE50071C0EC /* AudioStreamDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioStreamDescription.h; sourceTree = "<group>"; };
 		073B87571E40DCFD0071C0EC /* CAAudioStreamDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CAAudioStreamDescription.cpp; sourceTree = "<group>"; };
 		073B87581E40DCFD0071C0EC /* CAAudioStreamDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAAudioStreamDescription.h; sourceTree = "<group>"; };
@@ -19789,9 +19786,7 @@
 				E42050162141901B0066EF3B /* ProcessWarming.cpp */,
 				E42050142141901A0066EF3B /* ProcessWarming.h */,
 				CD9A87F9215D6CF3006F17B5 /* Quirks.cpp */,
-				CD9A87F2215D43A6006F17B5 /* Quirks.cpp */,
 				CD9A87FB215D6CF3006F17B5 /* Quirks.h */,
-				CD9A87F1215D43A6006F17B5 /* Quirks.h */,
 				46B9518D207D632A00A7D2DD /* RemoteDOMWindow.cpp */,
 				46B9518E207D632A00A7D2DD /* RemoteDOMWindow.h */,
 				46BCBBC3208500A700710638 /* RemoteDOMWindow.idl */,
@@ -19804,6 +19799,8 @@
 				A5071E841C56D079009951BE /* ResourceUsageThread.h */,
 				7C52229B1E1DAE47002CB8F7 /* RuntimeEnabledFeatures.cpp */,
 				7C52229C1E1DAE47002CB8F7 /* RuntimeEnabledFeatures.h */,
+				CD9A87F2215D43A6006F17B5 /* Quirks.cpp */,
+				CD9A87F1215D43A6006F17B5 /* Quirks.h */,
 				BCEC01BA0C274DAC009F4EC9 /* Screen.cpp */,
 				BCEC01BB0C274DAC009F4EC9 /* Screen.h */,
 				BCEC01BC0C274DAC009F4EC9 /* Screen.idl */,
@@ -24112,8 +24109,6 @@
 				074E82B918A69F0E007EF54C /* PlatformTimeRanges.h */,
 				BCAB417F13E356E800D8AAF3 /* Region.cpp */,
 				BCAB418013E356E800D8AAF3 /* Region.h */,
-				073A15512177A39800EA08F2 /* RemoteVideoSample.cpp */,
-				073A15532177A39A00EA08F2 /* RemoteVideoSample.h */,
 				A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */,
 				A73F95FD12C97BFE0031AAF9 /* RoundedRect.h */,
 				0F3DD44D12F5EA1B000D9190 /* ShadowBlur.cpp */,
@@ -25149,8 +25144,6 @@
 				CD94A5C91F71CA9D00F525C5 /* CDMClient.h */,
 				CD063F801E23FA8900812BE3 /* InitDataRegistry.cpp */,
 				CD063F811E23FA8900812BE3 /* InitDataRegistry.h */,
-				CDF7569D215C244400EFCB50 /* MediaKeyEncryptionScheme.h */,
-				CDF7569E215C285E00EFCB50 /* MediaKeyEncryptionScheme.idl */,
 				2D9BF72F1DBFDC0F007A7D99 /* MediaKeyMessageEvent.cpp */,
 				2D9BF7301DBFDC0F007A7D99 /* MediaKeyMessageEvent.h */,
 				2D9BF6F51DBFB71F007A7D99 /* MediaKeyMessageEvent.idl */,
@@ -25159,6 +25152,8 @@
 				2D9BF7331DBFDC0F007A7D99 /* MediaKeys.cpp */,
 				2D9BF7341DBFDC0F007A7D99 /* MediaKeys.h */,
 				2D9BF6F61DBFB71F007A7D99 /* MediaKeys.idl */,
+				CDF7569D215C244400EFCB50 /* MediaKeyEncryptionScheme.h */,
+				CDF7569E215C285E00EFCB50 /* MediaKeyEncryptionScheme.idl */,
 				2D9BF7351DBFDC0F007A7D99 /* MediaKeySession.cpp */,
 				2D9BF7361DBFDC0F007A7D99 /* MediaKeySession.h */,
 				2D9BF6F71DBFB71F007A7D99 /* MediaKeySession.idl */,
@@ -29278,7 +29273,6 @@
 				FD23A12613F5FA5900F67001 /* JSMediaElementAudioSourceNode.h in Headers */,
 				2D9BF7121DBFD914007A7D99 /* JSMediaEncryptedEvent.h in Headers */,
 				E44614190CD6826900FADA75 /* JSMediaError.h in Headers */,
-				CDF756A3215C29E900EFCB50 /* JSMediaKeyEncryptionScheme.h in Headers */,
 				2D9BF7281DBFDB0D007A7D99 /* JSMediaKeyMessageEvent.h in Headers */,
 				2D9BF7291DBFDB10007A7D99 /* JSMediaKeys.h in Headers */,
 				2D9BF72A1DBFDB13007A7D99 /* JSMediaKeySession.h in Headers */,
@@ -29961,6 +29955,7 @@
 				51058AE01D67C229009A538C /* MockGamepad.h in Headers */,
 				51058AE21D67C229009A538C /* MockGamepadProvider.h in Headers */,
 				413CCD4A20DE034F0065A21A /* MockMediaDevice.h in Headers */,
+				CDF756A3215C29E900EFCB50 /* JSMediaKeyEncryptionScheme.h in Headers */,
 				CDF2B0131820540600F2B424 /* MockMediaPlayerMediaSource.h in Headers */,
 				CDF2B0151820540600F2B424 /* MockMediaSourcePrivate.h in Headers */,
 				A1BB85A92159B02C0067E07D /* MockPaymentError.h in Headers */,
@@ -30316,7 +30311,6 @@
 				CD8ACA891D237AA200ECC59E /* RemoteCommandListenerMac.h in Headers */,
 				46B95199207D634D00A7D2DD /* RemoteDOMWindow.h in Headers */,
 				46B9519A207D635400A7D2DD /* RemoteFrame.h in Headers */,
-				073A15542177A42600EA08F2 /* RemoteVideoSample.h in Headers */,
 				D06C0D8F0CFD11460065F43F /* RemoveFormatCommand.h in Headers */,
 				93309E05099E64920056E581 /* RemoveNodeCommand.h in Headers */,
 				93309E07099E64920056E581 /* RemoveNodePreservingChildrenCommand.h in Headers */,

Modified: trunk/Source/WebCore/platform/MediaSample.h (237274 => 237275)


--- trunk/Source/WebCore/platform/MediaSample.h	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/MediaSample.h	2018-10-18 23:44:01 UTC (rev 237275)
@@ -93,7 +93,6 @@
     };
     virtual VideoRotation videoRotation() const { return VideoRotation::None; }
     virtual bool videoMirrored() const { return false; }
-    virtual uint32_t videoPixelFormat() const { return 0; }
 
     bool isSync() const { return flags() & IsSync; }
     bool isNonDisplaying() const { return flags() & IsNonDisplaying; }

Deleted: trunk/Source/WebCore/platform/graphics/RemoteVideoSample.cpp (237274 => 237275)


--- trunk/Source/WebCore/platform/graphics/RemoteVideoSample.cpp	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/graphics/RemoteVideoSample.cpp	2018-10-18 23:44:01 UTC (rev 237275)
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include "config.h"
-#include "RemoteVideoSample.h"
-
-#include "GraphicsContextCG.h"
-#include "IOSurface.h"
-#include "Logging.h"
-#include "RealtimeVideoUtilities.h"
-
-#if HAVE(IOSURFACE)
-#include "MediaSampleAVFObjc.h"
-#endif
-
-#import <pal/cf/CoreMediaSoftLink.h>
-
-namespace WebCore {
-using namespace PAL;
-
-#if HAVE(IOSURFACE)
-std::unique_ptr<RemoteVideoSample> RemoteVideoSample::create(MediaSample&& sample)
-{
-    ASSERT(sample.platformSample().type == PlatformSample::CMSampleBufferType);
-
-    auto imageBuffer = CMSampleBufferGetImageBuffer(sample.platformSample().sample.cmSampleBuffer);
-    if (!imageBuffer)
-        return nullptr;
-
-    auto surface = CVPixelBufferGetIOSurface(imageBuffer);
-    if (!surface) {
-        RELEASE_LOG(Media, "RemoteVideoSample::create: CVPixelBufferGetIOSurface returned nullptr");
-        return nullptr;
-    }
-
-    return std::unique_ptr<RemoteVideoSample>(new RemoteVideoSample(surface, sRGBColorSpaceRef(), sample.presentationTime(), sample.videoRotation(), sample.videoMirrored()));
-}
-
-RemoteVideoSample::RemoteVideoSample(IOSurfaceRef surface, CGColorSpaceRef colorSpace, MediaTime&& time, MediaSample::VideoRotation rotation, bool mirrored)
-    : m_ioSurface(WebCore::IOSurface::createFromSurface(surface, colorSpace))
-    , m_rotation(rotation)
-    , m_time(WTFMove(time))
-    , m_videoFormat(IOSurfaceGetPixelFormat(surface))
-    , m_size(IntSize(IOSurfaceGetWidth(surface), IOSurfaceGetHeight(surface)))
-    , m_mirrored(mirrored)
-{
-}
-
-IOSurfaceRef RemoteVideoSample::surface()
-{
-    if (!m_ioSurface && m_sendRight)
-        m_ioSurface = WebCore::IOSurface::createFromSendRight(WTFMove(m_sendRight), sRGBColorSpaceRef());
-
-    return m_ioSurface ? m_ioSurface->surface() : nullptr;
-}
-#endif
-
-}

Deleted: trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h (237274 => 237275)


--- trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h	2018-10-18 23:44:01 UTC (rev 237275)
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include "MediaSample.h"
-#include "RemoteVideoSample.h"
-#include <wtf/MachSendRight.h>
-#include <wtf/MediaTime.h>
-
-#if HAVE(IOSURFACE)
-#include "IOSurface.h"
-#endif
-
-namespace WebCore {
-
-class RemoteVideoSample {
-public:
-    RemoteVideoSample() = default;
-    ~RemoteVideoSample() = default;
-
-#if HAVE(IOSURFACE)
-    WEBCORE_EXPORT static std::unique_ptr<RemoteVideoSample> create(MediaSample&&);
-    WEBCORE_EXPORT IOSurfaceRef surface();
-#endif
-
-    const MediaTime& time() const { return m_time; }
-    uint32_t videoFormat() const { return m_videoFormat; }
-    IntSize size() const { return m_size; }
-
-    template<class Encoder> void encode(Encoder& encoder) const
-    {
-#if HAVE(IOSURFACE)
-        if (m_ioSurface)
-            encoder << m_ioSurface->createSendRight();
-        else
-            encoder << WTF::MachSendRight();
-#endif
-        encoder << m_rotation;
-        encoder << m_time;
-        encoder << m_videoFormat;
-        encoder << m_size;
-        encoder << m_mirrored;
-    }
-
-    template<class Decoder> static bool decode(Decoder& decoder, RemoteVideoSample& sample)
-    {
-#if HAVE(IOSURFACE)
-        MachSendRight sendRight;
-        if (!decoder.decode(sendRight))
-            return false;
-        sample.m_sendRight = WTFMove(sendRight);
-#endif
-        MediaSample::VideoRotation rotation;
-        if (!decoder.decode(rotation))
-            return false;
-        sample.m_rotation = rotation;
-
-        MediaTime time;
-        if (!decoder.decode(time))
-            return false;
-        sample.m_time = WTFMove(time);
-
-        uint32_t format;
-        if (!decoder.decode(format))
-            return false;
-        sample.m_videoFormat = format;
-
-        IntSize size;
-        if (!decoder.decode(size))
-            return false;
-        sample.m_size = WTFMove(size);
-
-        bool mirrored;
-        if (!decoder.decode(mirrored))
-            return false;
-        sample.m_mirrored = mirrored;
-
-        return true;
-    }
-
-private:
-
-#if HAVE(IOSURFACE)
-    RemoteVideoSample(IOSurfaceRef, CGColorSpaceRef, MediaTime&&, MediaSample::VideoRotation, bool);
-
-    std::unique_ptr<WebCore::IOSurface> m_ioSurface;
-    WTF::MachSendRight m_sendRight;
-#endif
-    MediaSample::VideoRotation m_rotation { MediaSample::VideoRotation::None };
-    MediaTime m_time;
-    uint32_t m_videoFormat { 0 };
-    IntSize m_size;
-    bool m_mirrored { false };
-};
-
-}
-

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h (237274 => 237275)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h	2018-10-18 23:44:01 UTC (rev 237275)
@@ -64,7 +64,7 @@
 
     VideoRotation videoRotation() const override { return m_rotation; }
     bool videoMirrored() const override { return m_mirrored; }
-    uint32_t videoPixelFormat() const final;
+    uint32_t videoPixelFormat() const;
 
     CMSampleBufferRef sampleBuffer() const { return m_sample.get(); }
 

Modified: trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.h (237274 => 237275)


--- trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.h	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.h	2018-10-18 23:44:01 UTC (rev 237275)
@@ -52,7 +52,7 @@
     RefPtr<MediaSample> createMediaSample(CMSampleBufferRef, const IntSize&, MediaSample::VideoRotation = MediaSample::VideoRotation::None, bool mirrored = false);
 
 #if HAVE(IOSURFACE) && !PLATFORM(IOSMAC)
-    WEBCORE_EXPORT RefPtr<MediaSample> createMediaSample(IOSurfaceRef, const MediaTime&, const IntSize&, MediaSample::VideoRotation = MediaSample::VideoRotation::None, bool mirrored = false);
+    RefPtr<MediaSample> createMediaSample(IOSurfaceRef, const MediaTime&, const IntSize&, MediaSample::VideoRotation = MediaSample::VideoRotation::None, bool mirrored = false);
 #endif
 
 private:

Modified: trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm (237274 => 237275)


--- trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm	2018-10-18 23:44:01 UTC (rev 237275)
@@ -148,7 +148,7 @@
     auto description = CMSampleBufferGetFormatDescription(sourceBuffer);
     auto sourceSize = FloatSize(CMVideoFormatDescriptionGetPresentationDimensions(description, true, true));
     auto pixelBuffer = static_cast<CVPixelBufferRef>(CMSampleBufferGetImageBuffer(sourceBuffer));
-    if (size == expandedIntSize(sourceSize) && m_pixelFormat == CVPixelBufferGetPixelFormatType(pixelBuffer))
+    if (size == roundedIntSize(sourceSize) && m_pixelFormat == CVPixelBufferGetPixelFormatType(pixelBuffer))
         return retainPtr(sourceBuffer);
 
     if (!setSize(size))
@@ -340,7 +340,7 @@
 {
     ASSERT(sample.platformSample().type == PlatformSample::CMSampleBufferType);
 
-    if (size == expandedIntSize(sample.presentationSize()))
+    if (size == roundedIntSize(sample.presentationSize()))
         return &sample;
 
     auto resizedBuffer = convertCMSampleBuffer(sample.platformSample().sample.cmSampleBuffer, size);

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp (237274 => 237275)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2018-10-18 23:44:01 UTC (rev 237275)
@@ -158,13 +158,6 @@
     });
 }
 
-void RealtimeMediaSource::remoteVideoSampleAvailable(RemoteVideoSample&& sample)
-{
-    forEachObserver([&](auto& observer) {
-        observer.remoteVideoSampleAvailable(sample);
-    });
-}
-
 void RealtimeMediaSource::audioSamplesAvailable(const MediaTime& time, const PlatformAudioData& audioData, const AudioStreamDescription& description, size_t numberOfFrames)
 {
     forEachObserver([&](auto& observer) {

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h (237274 => 237275)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h	2018-10-18 23:44:01 UTC (rev 237275)
@@ -61,7 +61,6 @@
 class OrientationNotifier;
 class PlatformAudioData;
 class RealtimeMediaSourceSettings;
-class RemoteVideoSample;
 
 struct CaptureSourceOrError;
 
@@ -82,7 +81,6 @@
 
         // Called on the main thread.
         virtual void videoSampleAvailable(MediaSample&) { }
-        virtual void remoteVideoSampleAvailable(RemoteVideoSample&) { }
 
         // May be called on a background thread.
         virtual void audioSamplesAvailable(const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t /*numberOfFrames*/) { }
@@ -167,9 +165,6 @@
     virtual bool isIncomingAudioSource() const { return false; }
     virtual bool isIncomingVideoSource() const { return false; }
 
-    void setIsRemote(bool isRemote) { m_isRemote = isRemote; }
-    bool isRemote() const { return m_isRemote; }
-
     // Testing only
     virtual void delaySamples(Seconds) { };
 
@@ -201,7 +196,6 @@
 
     void videoSampleAvailable(MediaSample&);
     void audioSamplesAvailable(const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t);
-    void remoteVideoSampleAvailable(RemoteVideoSample&&);
 
 private:
     virtual void startProducingData() { }
@@ -208,6 +202,7 @@
     virtual void stopProducingData() { }
     virtual void settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag>) { }
 
+
     void forEachObserver(const WTF::Function<void(Observer&)>&) const;
 
     bool m_muted { false };
@@ -233,7 +228,6 @@
     bool m_isProducingData { false };
     bool m_interrupted { false };
     bool m_captureDidFailed { false };
-    bool m_isRemote { false };
 };
 
 struct CaptureSourceOrError {

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp (237274 => 237275)


--- trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp	2018-10-18 23:44:01 UTC (rev 237275)
@@ -31,12 +31,7 @@
 #include "Logging.h"
 #include "RealtimeMediaSourceCenter.h"
 #include "RealtimeMediaSourceSettings.h"
-#include "RemoteVideoSample.h"
 
-#if PLATFORM(COCOA)
-#include "ImageTransferSessionVT.h"
-#endif
-
 namespace WebCore {
 
 RealtimeVideoSource::RealtimeVideoSource(String&& name, String&& id, String&& hashSalt)
@@ -383,36 +378,7 @@
     if (interval > 1)
         m_observedFrameRate = (m_observedFrameTimeStamps.size() / interval);
 
-    if (isRemote()) {
-#if HAVE(IOSURFACE)
-        auto remoteSample = RemoteVideoSample::create(WTFMove(sample));
-        if (remoteSample)
-            remoteVideoSampleAvailable(WTFMove(*remoteSample));
-#else
-        ASSERT_NOT_REACHED();
-#endif
-        return;
-    }
-
-    auto mediaSample = makeRefPtr(&sample);
-#if PLATFORM(COCOA)
-    auto size = this->size();
-    if (!size.isEmpty() && size != expandedIntSize(sample.presentationSize())) {
-
-        if (!m_imageTransferSession)
-            m_imageTransferSession = ImageTransferSessionVT::create(sample.videoPixelFormat());
-
-        if (m_imageTransferSession) {
-            mediaSample = m_imageTransferSession->convertMediaSample(sample, size);
-            if (!mediaSample) {
-                ASSERT_NOT_REACHED();
-                return;
-            }
-        }
-    }
-#endif
-
-    videoSampleAvailable(mediaSample.releaseNonNull());
+    videoSampleAvailable(sample);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h (237274 => 237275)


--- trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h	2018-10-18 23:44:01 UTC (rev 237275)
@@ -37,8 +37,6 @@
 
 namespace WebCore {
 
-class ImageTransferSessionVT;
-
 class RealtimeVideoSource : public RealtimeMediaSource {
 public:
     virtual ~RealtimeVideoSource();
@@ -85,9 +83,6 @@
     Deque<double> m_observedFrameTimeStamps;
     double m_observedFrameRate { 0 };
     IntSize m_defaultSize;
-#if PLATFORM(COCOA)
-    std::unique_ptr<ImageTransferSessionVT> m_imageTransferSession;
-#endif
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm (237274 => 237275)


--- trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm	2018-10-18 23:44:01 UTC (rev 237275)
@@ -540,9 +540,27 @@
 
 void AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection(AVCaptureOutputType*, CMSampleBufferRef sampleBuffer, AVCaptureConnectionType* captureConnection)
 {
-    auto sample = MediaSampleAVFObjC::create(sampleBuffer, m_sampleRotation, [captureConnection isVideoMirrored]);
+    CMFormatDescriptionRef formatDescription = CMSampleBufferGetFormatDescription(sampleBuffer);
+    if (!formatDescription)
+        return;
+
+    CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(formatDescription);
+    RefPtr<MediaSample> sample;
+    if (dimensions.width != m_requestedSize.width() || dimensions.height != m_requestedSize.height()) {
+
+        if (!m_imageTransferSession)
+            m_imageTransferSession = ImageTransferSessionVT::create(avVideoCapturePixelBufferFormat());
+
+        sample = m_imageTransferSession->createMediaSample(sampleBuffer, m_requestedSize, m_sampleRotation, [captureConnection isVideoMirrored]);
+        if (!sample) {
+            ASSERT_NOT_REACHED();
+            return;
+        }
+    } else
+        sample = MediaSampleAVFObjC::create(sampleBuffer, m_sampleRotation, [captureConnection isVideoMirrored]);
+
     scheduleDeferredTask([this, sample = WTFMove(sample)] () mutable {
-        processNewFrame(WTFMove(sample));
+        processNewFrame(sample.releaseNonNull());
     });
 }
 

Modified: trunk/Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp (237274 => 237275)


--- trunk/Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp	2018-10-18 23:44:01 UTC (rev 237275)
@@ -35,7 +35,6 @@
 #include "RealtimeMediaSourceCenter.h"
 #include "RealtimeMediaSourceSettings.h"
 #include "RealtimeVideoUtilities.h"
-#include "RemoteVideoSample.h"
 #include "Timer.h"
 #include <CoreMedia/CMSync.h>
 #include <mach/mach_time.h>
@@ -173,44 +172,22 @@
         m_imageTransferSession = ImageTransferSessionVT::create(preferedPixelBufferFormat());
 
     auto sampleTime = MediaTime::createWithDouble((elapsedTime() + 100_ms).seconds());
-
     auto frame = generateFrame();
-    auto imageSize = WTF::switchOn(frame,
-        [](RetainPtr<IOSurfaceRef> surface) -> IntSize {
-            if (!surface)
-                return { };
-
-            return IntSize(IOSurfaceGetWidth(surface.get()), IOSurfaceGetHeight(surface.get()));
-        },
-        [](RetainPtr<CGImageRef> image) -> IntSize {
-            if (!image)
-                return { };
-
-            return IntSize(CGImageGetWidth(image.get()), CGImageGetHeight(image.get()));
-        }
-    );
-
-    ASSERT(!imageSize.isEmpty());
-    if (imageSize.isEmpty())
-        return;
-
-    if (m_intrinsicSize != imageSize)
-        setIntrinsicSize(imageSize);
-
-    auto mediaSampleSize = isRemote() ? imageSize : frameSize();
-
+    IntSize imageSize;
     RefPtr<MediaSample> sample = WTF::switchOn(frame,
-        [this, sampleTime, mediaSampleSize](RetainPtr<IOSurfaceRef> surface) -> RefPtr<MediaSample> {
+        [this, sampleTime, &imageSize](RetainPtr<IOSurfaceRef> surface) -> RefPtr<MediaSample> {
             if (!surface)
                 return nullptr;
 
-            return m_imageTransferSession->createMediaSample(surface.get(), sampleTime, mediaSampleSize);
+            imageSize = IntSize(IOSurfaceGetWidth(surface.get()), IOSurfaceGetHeight(surface.get()));
+            return m_imageTransferSession->createMediaSample(surface.get(), sampleTime, imageSize);
         },
-        [this, sampleTime, mediaSampleSize](RetainPtr<CGImageRef> image) -> RefPtr<MediaSample> {
+        [this, sampleTime, &imageSize](RetainPtr<CGImageRef> image) -> RefPtr<MediaSample> {
             if (!image)
                 return nullptr;
 
-            return m_imageTransferSession->createMediaSample(image.get(), sampleTime, mediaSampleSize);
+            imageSize = IntSize(CGImageGetWidth(image.get()), CGImageGetHeight(image.get()));
+            return m_imageTransferSession->createMediaSample(image.get(), sampleTime, imageSize);
         }
     );
 
@@ -219,14 +196,9 @@
         return;
     }
 
-    if (isRemote()) {
-        auto remoteSample = RemoteVideoSample::create(WTFMove(*sample));
-        if (remoteSample)
-            remoteVideoSampleAvailable(WTFMove(*remoteSample));
+    if (m_intrinsicSize != imageSize)
+        setIntrinsicSize(imageSize);
 
-        return;
-    }
-
     videoSampleAvailable(*sample.get());
 #endif
 }

Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp (237274 => 237275)


--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp	2018-10-18 23:44:01 UTC (rev 237275)
@@ -30,6 +30,7 @@
 
 #include "Logging.h"
 #include "RealtimeIncomingVideoSourceCocoa.h"
+#include "RealtimeVideoUtilities.h"
 
 ALLOW_UNUSED_PARAMETERS_BEGIN
 

Modified: trunk/Source/WebKit/ChangeLog (237274 => 237275)


--- trunk/Source/WebKit/ChangeLog	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebKit/ChangeLog	2018-10-18 23:44:01 UTC (rev 237275)
@@ -1,3 +1,16 @@
+2018-10-18  Truitt Savell  <tsav...@apple.com>
+
+        Unreviewed, rolling out r237272.
+
+        Broke on device iOS builds and Windows builds
+
+        Reverted changeset:
+
+        "[MediaStream] Allow ports to optionally do screen capture in
+        the UI process"
+        https://bugs.webkit.org/show_bug.cgi?id=190728
+        https://trac.webkit.org/changeset/237272
+
 2018-10-18  Jer Noble  <jer.no...@apple.com>
 
         Enable WKPreferences._lowPowerVideoAudioBufferSizeEnabled by default

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (237274 => 237275)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2018-10-18 23:44:01 UTC (rev 237275)
@@ -72,7 +72,6 @@
 #if ENABLE(MEDIA_STREAM)
     encoder << audioCaptureExtensionHandle;
     encoder << shouldCaptureAudioInUIProcess;
-    encoder << shouldCaptureDisplayInUIProcess;
 #endif
     encoder << shouldUseTestingNetworkSession;
     encoder << urlSchemesRegisteredAsEmptyDocument;
@@ -265,8 +264,6 @@
 
     if (!decoder.decode(parameters.shouldCaptureAudioInUIProcess))
         return false;
-    if (!decoder.decode(parameters.shouldCaptureDisplayInUIProcess))
-        return false;
 #endif
     if (!decoder.decode(parameters.shouldUseTestingNetworkSession))
         return false;

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.h (237274 => 237275)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2018-10-18 23:44:01 UTC (rev 237275)
@@ -96,7 +96,6 @@
 #if ENABLE(MEDIA_STREAM)
     SandboxExtension::Handle audioCaptureExtensionHandle;
     bool shouldCaptureAudioInUIProcess { false };
-    bool shouldCaptureDisplayInUIProcess { false };
 #endif
     String mediaKeyStorageDirectory;
 

Modified: trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp (237274 => 237275)


--- trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp	2018-10-18 23:44:01 UTC (rev 237275)
@@ -115,7 +115,6 @@
     copy->m_alwaysRunsAtBackgroundPriority = this->m_alwaysRunsAtBackgroundPriority;
     copy->m_shouldTakeUIBackgroundAssertion = this->m_shouldTakeUIBackgroundAssertion;
     copy->m_shouldCaptureAudioInUIProcess = this->m_shouldCaptureAudioInUIProcess;
-    copy->m_shouldCaptureDisplayInUIProcess = this->m_shouldCaptureDisplayInUIProcess;
 #if PLATFORM(IOS_FAMILY)
     copy->m_ctDataConnectionServiceType = this->m_ctDataConnectionServiceType;
 #endif

Modified: trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h (237274 => 237275)


--- trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h	2018-10-18 23:44:01 UTC (rev 237275)
@@ -36,12 +36,6 @@
 
 namespace API {
 
-#if PLATFORM(COCOA) && !PLATFORM(IOS_FAMILY_SIMULATOR)
-#define DEFAULT_CAPTURE_DISPLAY_IN_UI_PROCESS true
-#else
-#define DEFAULT_CAPTURE_DISPLAY_IN_UI_PROCESS false
-#endif
-
 class ProcessPoolConfiguration final : public ObjectImpl<Object::Type::ProcessPoolConfiguration> {
 public:
     static Ref<ProcessPoolConfiguration> create();
@@ -139,9 +133,6 @@
     bool shouldCaptureAudioInUIProcess() const { return m_shouldCaptureAudioInUIProcess; }
     void setShouldCaptureAudioInUIProcess(bool shouldCaptureAudioInUIProcess) { m_shouldCaptureAudioInUIProcess = shouldCaptureAudioInUIProcess; }
 
-    bool shouldCaptureDisplayInUIProcess() const { return m_shouldCaptureDisplayInUIProcess; }
-    void setShouldCaptureDisplayInUIProcess(bool shouldCaptureDisplayInUIProcess) { m_shouldCaptureDisplayInUIProcess = shouldCaptureDisplayInUIProcess; }
-
 #if PLATFORM(IOS_FAMILY)
     const WTF::String& ctDataConnectionServiceType() const { return m_ctDataConnectionServiceType; }
     void setCTDataConnectionServiceType(const WTF::String& ctDataConnectionServiceType) { m_ctDataConnectionServiceType = ctDataConnectionServiceType; }
@@ -203,7 +194,6 @@
     bool m_alwaysRunsAtBackgroundPriority { false };
     bool m_shouldTakeUIBackgroundAssertion { true };
     bool m_shouldCaptureAudioInUIProcess { false };
-    bool m_shouldCaptureDisplayInUIProcess { DEFAULT_CAPTURE_DISPLAY_IN_UI_PROCESS };
     ProcessID m_presentingApplicationPID { getCurrentProcessID() };
     bool m_processSwapsOnNavigation { false };
     bool m_alwaysKeepAndReuseSwappedProcesses { false };

Modified: trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp (237274 => 237275)


--- trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp	2018-10-18 23:44:01 UTC (rev 237275)
@@ -35,7 +35,6 @@
 #include <WebCore/CARingBuffer.h>
 #include <WebCore/MediaConstraints.h>
 #include <WebCore/RealtimeMediaSourceCenter.h>
-#include <WebCore/RemoteVideoSample.h>
 #include <WebCore/WebAudioBufferList.h>
 #include <wtf/UniqueRef.h>
 
@@ -99,11 +98,6 @@
         m_manager.process().send(Messages::UserMediaCaptureManager::AudioSamplesAvailable(m_id, time, numberOfFrames, startFrame, endFrame), 0);
     }
 
-    virtual void remoteVideoSampleAvailable(RemoteVideoSample& sample)
-    {
-        m_manager.process().send(Messages::UserMediaCaptureManager::RemoteVideoSampleAvailable(m_id, WTFMove(sample)), 0);
-    }
-
     void storageChanged(SharedMemory* storage) final {
         SharedMemory::Handle handle;
         if (storage)
@@ -131,23 +125,17 @@
     m_process.removeMessageReceiver(Messages::UserMediaCaptureManagerProxy::messageReceiverName());
 }
 
-void UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints(uint64_t id, const CaptureDevice& device, String&& hashSalt, const MediaConstraints& constraints, bool& succeeded, String& invalidConstraints, WebCore::RealtimeMediaSourceSettings& settings)
+void UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints(uint64_t id, const CaptureDevice& device, WebCore::RealtimeMediaSource::Type type, String&& hashSalt, const MediaConstraints& constraints, bool& succeeded, String& invalidConstraints, WebCore::RealtimeMediaSourceSettings& settings)
 {
     CaptureSourceOrError sourceOrError;
-    switch (device.type()) {
-    case WebCore::CaptureDevice::DeviceType::Microphone:
-        sourceOrError = RealtimeMediaSourceCenter::audioFactory().createAudioCaptureSource(device, WTFMove(hashSalt), &constraints);
+    switch (type) {
+    case WebCore::RealtimeMediaSource::Type::Audio:
+        sourceOrError = RealtimeMediaSourceCenter::singleton().audioFactory().createAudioCaptureSource(device, WTFMove(hashSalt), &constraints);
         break;
-    case WebCore::CaptureDevice::DeviceType::Camera:
-        sourceOrError = RealtimeMediaSourceCenter::videoFactory().createVideoCaptureSource(device, WTFMove(hashSalt), &constraints);
+    case WebCore::RealtimeMediaSource::Type::Video:
+        sourceOrError = RealtimeMediaSourceCenter::singleton().videoFactory().createVideoCaptureSource(device, WTFMove(hashSalt), &constraints);
         break;
-    case WebCore::CaptureDevice::DeviceType::Screen:
-    case WebCore::CaptureDevice::DeviceType::Window:
-    case WebCore::CaptureDevice::DeviceType::Application:
-    case WebCore::CaptureDevice::DeviceType::Browser:
-        sourceOrError = RealtimeMediaSourceCenter::displayCaptureFactory().createDisplayCaptureSource(device, &constraints);
-        break;
-    case WebCore::CaptureDevice::DeviceType::Unknown:
+    case WebCore::RealtimeMediaSource::Type::None:
         ASSERT_NOT_REACHED();
         break;
     }
@@ -155,7 +143,6 @@
     succeeded = !!sourceOrError;
     if (sourceOrError) {
         auto source = sourceOrError.source();
-        source->setIsRemote(true);
         settings = source->settings();
         m_proxies.set(id, std::make_unique<SourceProxy>(id, *this, WTFMove(source)));
     } else

Modified: trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h (237274 => 237275)


--- trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h	2018-10-18 23:44:01 UTC (rev 237275)
@@ -29,7 +29,6 @@
 
 #include "Connection.h"
 #include "MessageReceiver.h"
-#include "UserMediaCaptureManager.h"
 #include "UserMediaCaptureManagerProxyMessages.h"
 #include <WebCore/RealtimeMediaSource.h>
 
@@ -50,7 +49,7 @@
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
     void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) final;
 
-    void createMediaSourceForCaptureDeviceWithConstraints(uint64_t id, const WebCore::CaptureDevice& deviceID, String&&, const WebCore::MediaConstraints&, bool& succeeded, String& invalidConstraints, WebCore::RealtimeMediaSourceSettings&);
+    void createMediaSourceForCaptureDeviceWithConstraints(uint64_t id, const WebCore::CaptureDevice& deviceID, WebCore::RealtimeMediaSource::Type, String&&, const WebCore::MediaConstraints&, bool& succeeded, String& invalidConstraints, WebCore::RealtimeMediaSourceSettings&);
     void startProducingData(uint64_t);
     void stopProducingData(uint64_t);
     void capabilities(uint64_t, WebCore::RealtimeMediaSourceCapabilities&);

Modified: trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in (237274 => 237275)


--- trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in	2018-10-18 23:44:01 UTC (rev 237275)
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2018 Apple Inc. All rights reserved.
+# Copyright (C) 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
@@ -24,7 +24,7 @@
 #if ENABLE(MEDIA_STREAM)
 
 messages -> UserMediaCaptureManagerProxy {
-CreateMediaSourceForCaptureDeviceWithConstraints(uint64_t id, WebCore::CaptureDevice device, String hashSalt, struct WebCore::MediaConstraints constraints) -> (bool success, String invalidConstraints, WebCore::RealtimeMediaSourceSettings settings)
+    CreateMediaSourceForCaptureDeviceWithConstraints(uint64_t id, WebCore::CaptureDevice device, WebCore::RealtimeMediaSource::Type type, String hashSalt, struct WebCore::MediaConstraints constraints) -> (bool success, String invalidConstraints, WebCore::RealtimeMediaSourceSettings settings)
     StartProducingData(uint64_t id)
     StopProducingData(uint64_t id)
     Capabilities(uint64_t id) -> (WebCore::RealtimeMediaSourceCapabilities capabilities)

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (237274 => 237275)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2018-10-18 23:44:01 UTC (rev 237275)
@@ -907,7 +907,6 @@
     parameters.resourceLoadStatisticsEnabled = websiteDataStore.resourceLoadStatisticsEnabled();
 #if ENABLE(MEDIA_STREAM)
     parameters.shouldCaptureAudioInUIProcess = m_configuration->shouldCaptureAudioInUIProcess();
-    parameters.shouldCaptureDisplayInUIProcess = m_configuration->shouldCaptureDisplayInUIProcess();
 #endif
 
     parameters.presentingApplicationPID = m_configuration->presentingApplicationPID();

Modified: trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp (237274 => 237275)


--- trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp	2018-10-18 23:44:01 UTC (rev 237275)
@@ -35,16 +35,12 @@
 #include "WebProcess.h"
 #include "WebProcessCreationParameters.h"
 #include <WebCore/CaptureDevice.h>
-#include <WebCore/ImageTransferSessionVT.h>
 #include <WebCore/MediaConstraints.h>
 #include <WebCore/RealtimeMediaSourceCenter.h>
-#include <WebCore/RemoteVideoSample.h>
 #include <WebCore/WebAudioBufferList.h>
 #include <WebCore/WebAudioSourceProviderAVFObjC.h>
-#include <wtf/Assertions.h>
 
 namespace WebKit {
-using namespace PAL;
 using namespace WebCore;
 
 static uint64_t nextSessionID()
@@ -59,22 +55,16 @@
         : RealtimeMediaSource(type, WTFMove(name), WTFMove(sourceID), WTFMove(hashSalt))
         , m_id(id)
         , m_manager(manager)
+        , m_ringBuffer(makeUniqueRef<SharedRingBufferStorage>(nullptr))
     {
-        if (type == Type::Audio)
-            m_ringBuffer = std::make_unique<CARingBuffer>(makeUniqueRef<SharedRingBufferStorage>(nullptr));
     }
 
     ~Source()
     {
-        if (type() == Type::Audio)
-            storage().invalidate();
+        storage().invalidate();
     }
 
-    SharedRingBufferStorage& storage()
-    {
-        ASSERT(type() == Type::Audio);
-        return static_cast<SharedRingBufferStorage&>(m_ringBuffer->storage());
-    }
+    SharedRingBufferStorage& storage() { return static_cast<SharedRingBufferStorage&>(m_ringBuffer.storage()); }
 
     const RealtimeMediaSourceCapabilities& capabilities() final
     {
@@ -94,11 +84,10 @@
     const CAAudioStreamDescription& description() const { return m_description; }
     void setStorage(const SharedMemory::Handle& handle, const WebCore::CAAudioStreamDescription& description, uint64_t numberOfFrames)
     {
-        ASSERT(type() == Type::Audio);
         m_description = description;
 
         if (handle.isNull()) {
-            m_ringBuffer->deallocate();
+            m_ringBuffer.deallocate();
             storage().setReadOnly(false);
             storage().setStorage(nullptr);
             return;
@@ -108,51 +97,22 @@
         storage().setStorage(WTFMove(memory));
         storage().setReadOnly(true);
 
-        m_ringBuffer->allocate(description, numberOfFrames);
+        m_ringBuffer.allocate(description, numberOfFrames);
     }
 
     void setRingBufferFrameBounds(uint64_t startFrame, uint64_t endFrame)
     {
-        ASSERT(type() == Type::Audio);
-        m_ringBuffer->setCurrentFrameBounds(startFrame, endFrame);
+        m_ringBuffer.setCurrentFrameBounds(startFrame, endFrame);
     }
 
     void audioSamplesAvailable(MediaTime time, uint64_t numberOfFrames)
     {
-        ASSERT(type() == Type::Audio);
         WebAudioBufferList audioData(m_description, numberOfFrames);
-        m_ringBuffer->fetch(audioData.list(), numberOfFrames, time.timeValue());
+        m_ringBuffer.fetch(audioData.list(), numberOfFrames, time.timeValue());
 
         RealtimeMediaSource::audioSamplesAvailable(time, audioData, m_description, numberOfFrames);
     }
 
-#if HAVE(IOSURFACE)
-    void remoteVideoSampleAvailable(RemoteVideoSample&& remoteSample)
-    {
-        ASSERT(type() == Type::Video);
-
-        auto videoSampleSize = IntSize(m_settings.width(), m_settings.height());
-        if (videoSampleSize.isEmpty())
-            videoSampleSize = remoteSample.size();
-
-        if (!m_imageTransferSession)
-            m_imageTransferSession = ImageTransferSessionVT::create(remoteSample.videoFormat());
-
-        if (!m_imageTransferSession) {
-            ASSERT_NOT_REACHED();
-            return;
-        }
-
-        auto sampleRef = m_imageTransferSession->createMediaSample(remoteSample.surface(), remoteSample.time(), videoSampleSize);
-        if (!sampleRef) {
-            ASSERT_NOT_REACHED();
-            return;
-        }
-
-        RealtimeMediaSource::videoSampleAvailable(*sampleRef);
-    }
-#endif
-
     void applyConstraintsSucceeded(const WebCore::RealtimeMediaSourceSettings& settings)
     {
         auto callbacks = m_pendingApplyConstraintsCallbacks.takeFirst();
@@ -184,12 +144,9 @@
     UserMediaCaptureManager& m_manager;
     mutable std::optional<RealtimeMediaSourceCapabilities> m_capabilities;
     RealtimeMediaSourceSettings m_settings;
-
     CAAudioStreamDescription m_description;
-    std::unique_ptr<CARingBuffer> m_ringBuffer;
+    CARingBuffer m_ringBuffer;
 
-    std::unique_ptr<ImageTransferSessionVT> m_imageTransferSession;
-
     struct ApplyConstraintsCallback {
         SuccessHandler successHandler;
         FailureHandler failureHandler;
@@ -205,8 +162,7 @@
 
 UserMediaCaptureManager::~UserMediaCaptureManager()
 {
-    RealtimeMediaSourceCenter::unsetAudioFactory(*this);
-    RealtimeMediaSourceCenter::unsetDisplayCaptureFactory(*this);
+    RealtimeMediaSourceCenter::singleton().unsetAudioFactory(*this);
     m_process.removeMessageReceiver(Messages::UserMediaCaptureManager::messageReceiverName());
 }
 
@@ -218,12 +174,10 @@
 void UserMediaCaptureManager::initialize(const WebProcessCreationParameters& parameters)
 {
     if (parameters.shouldCaptureAudioInUIProcess)
-        RealtimeMediaSourceCenter::setAudioFactory(*this);
-    if (parameters.shouldCaptureDisplayInUIProcess)
-        RealtimeMediaSourceCenter::setDisplayCaptureFactory(*this);
+        RealtimeMediaSourceCenter::singleton().setAudioFactory(*this);
 }
 
-WebCore::CaptureSourceOrError UserMediaCaptureManager::createCaptureSource(const CaptureDevice& device, String&& hashSalt, const WebCore::MediaConstraints* constraints)
+WebCore::CaptureSourceOrError UserMediaCaptureManager::createCaptureSource(const CaptureDevice& device, WebCore::RealtimeMediaSource::Type sourceType, String&& hashSalt, const WebCore::MediaConstraints* constraints)
 {
     if (!constraints)
         return { };
@@ -232,11 +186,10 @@
     RealtimeMediaSourceSettings settings;
     String errorMessage;
     bool succeeded;
-    if (!m_process.sendSync(Messages::UserMediaCaptureManagerProxy::CreateMediaSourceForCaptureDeviceWithConstraints(id, device, hashSalt, *constraints), Messages::UserMediaCaptureManagerProxy::CreateMediaSourceForCaptureDeviceWithConstraints::Reply(succeeded, errorMessage, settings), 0))
+    if (!m_process.sendSync(Messages::UserMediaCaptureManagerProxy::CreateMediaSourceForCaptureDeviceWithConstraints(id, device, sourceType, hashSalt, *constraints), Messages::UserMediaCaptureManagerProxy::CreateMediaSourceForCaptureDeviceWithConstraints::Reply(succeeded, errorMessage, settings), 0))
         return WTFMove(errorMessage);
 
-    auto type = device.type() == CaptureDevice::DeviceType::Microphone ? WebCore::RealtimeMediaSource::Type::Audio : WebCore::RealtimeMediaSource::Type::Video;
-    auto source = adoptRef(*new Source(String::number(id), type, String { settings.label() }, WTFMove(hashSalt), id, *this));
+    auto source = adoptRef(*new Source(String::number(id), sourceType, String { settings.label() }, WTFMove(hashSalt), id, *this));
     source->setSettings(WTFMove(settings));
     m_sources.set(id, source.copyRef());
     return WebCore::CaptureSourceOrError(WTFMove(source));
@@ -286,19 +239,6 @@
     source.audioSamplesAvailable(time, numberOfFrames);
 }
 
-#if HAVE(IOSURFACE)
-void UserMediaCaptureManager::remoteVideoSampleAvailable(uint64_t id, RemoteVideoSample&& sample)
-{
-    ASSERT(m_sources.contains(id));
-    m_sources.get(id)->remoteVideoSampleAvailable(WTFMove(sample));
-}
-#else
-NO_RETURN_DUE_TO_ASSERT void UserMediaCaptureManager::remoteVideoSampleAvailable(uint64_t, RemoteVideoSample&&)
-{
-    ASSERT_NOT_REACHED();
-}
-#endif
-
 void UserMediaCaptureManager::startProducingData(uint64_t id)
 {
     m_process.send(Messages::UserMediaCaptureManagerProxy::StartProducingData(id), 0);

Modified: trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.h (237274 => 237275)


--- trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.h	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.h	2018-10-18 23:44:01 UTC (rev 237275)
@@ -36,7 +36,6 @@
 
 namespace WebCore {
 class CAAudioStreamDescription;
-class RemoteVideoSample;
 }
 
 namespace WebKit {
@@ -44,7 +43,7 @@
 class CrossProcessRealtimeAudioSource;
 class WebProcess;
 
-class UserMediaCaptureManager : public WebProcessSupplement, public IPC::MessageReceiver, public WebCore::AudioCaptureFactory, public WebCore::VideoCaptureFactory, public WebCore::DisplayCaptureFactory {
+class UserMediaCaptureManager : public WebProcessSupplement, public IPC::MessageReceiver, public WebCore::AudioCaptureFactory, public WebCore::VideoCaptureFactory {
 public:
     explicit UserMediaCaptureManager(WebProcess&);
     ~UserMediaCaptureManager();
@@ -56,10 +55,9 @@
     void initialize(const WebProcessCreationParameters&) final;
 
     // WebCore::RealtimeMediaSource factories
-    WebCore::CaptureSourceOrError createAudioCaptureSource(const WebCore::CaptureDevice& device, String&& hashSalt, const WebCore::MediaConstraints* constraints) final { return createCaptureSource(device, WTFMove(hashSalt), constraints); }
-    WebCore::CaptureSourceOrError createVideoCaptureSource(const WebCore::CaptureDevice& device, String&& hashSalt, const WebCore::MediaConstraints* constraints) final { return createCaptureSource(device, WTFMove(hashSalt), constraints); }
-    WebCore::CaptureSourceOrError createDisplayCaptureSource(const WebCore::CaptureDevice& device, const WebCore::MediaConstraints* constraints) final  { return createCaptureSource(device, { }, constraints); }
-    WebCore::CaptureSourceOrError createCaptureSource(const WebCore::CaptureDevice&, String&&, const WebCore::MediaConstraints*);
+    WebCore::CaptureSourceOrError createAudioCaptureSource(const WebCore::CaptureDevice& device, String&& hashSalt, const WebCore::MediaConstraints* constraints) final { return createCaptureSource(device, WebCore::RealtimeMediaSource::Type::Audio, WTFMove(hashSalt), constraints); }
+    WebCore::CaptureSourceOrError createVideoCaptureSource(const WebCore::CaptureDevice& device, String&& hashSalt, const WebCore::MediaConstraints* constraints) final { return createCaptureSource(device, WebCore::RealtimeMediaSource::Type::Video, WTFMove(hashSalt), constraints); }
+    WebCore::CaptureSourceOrError createCaptureSource(const WebCore::CaptureDevice&, WebCore::RealtimeMediaSource::Type, String&&, const WebCore::MediaConstraints*);
 
     // IPC::MessageReceiver
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
@@ -72,7 +70,6 @@
     void storageChanged(uint64_t id, const SharedMemory::Handle&, const WebCore::CAAudioStreamDescription&, uint64_t numberOfFrames);
     void ringBufferFrameBoundsChanged(uint64_t id, uint64_t startFrame, uint64_t endFrame);
     void audioSamplesAvailable(uint64_t id, MediaTime, uint64_t numberOfFrames, uint64_t startFrame, uint64_t endFrame);
-    void remoteVideoSampleAvailable(uint64_t id, WebCore::RemoteVideoSample&&);
 
     void startProducingData(uint64_t);
     void stopProducingData(uint64_t);
@@ -88,6 +85,6 @@
     WebProcess& m_process;
 };
 
-} // namespace WebKit
+}
 
 #endif

Modified: trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.messages.in (237274 => 237275)


--- trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.messages.in	2018-10-18 23:02:15 UTC (rev 237274)
+++ trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.messages.in	2018-10-18 23:44:01 UTC (rev 237275)
@@ -32,7 +32,6 @@
     AudioSamplesAvailable(uint64_t id, MediaTime time, uint64_t numberOfFrames, uint64_t startFrame, uint64_t endFrame)
     ApplyConstraintsSucceeded(uint64_t id, WebCore::RealtimeMediaSourceSettings settings)
     ApplyConstraintsFailed(uint64_t id, String failedConstraint, String message)
-    RemoteVideoSampleAvailable(uint64_t id, WebCore::RemoteVideoSample sample)
 }
 
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to