Title: [276120] trunk/Source
Revision
276120
Author
[email protected]
Date
2021-04-15 23:49:28 -0700 (Thu, 15 Apr 2021)

Log Message

Unreviewed, reverting r276107.
https://bugs.webkit.org/show_bug.cgi?id=224653

It broke non-Cocoa clean builds

Reverted changeset:

"[GPUP] WebContent process should not create AVOutputContext
instances when media in GPU Process is enabled"
https://bugs.webkit.org/show_bug.cgi?id=224469
https://trac.webkit.org/changeset/276107

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (276119 => 276120)


--- trunk/Source/WebCore/ChangeLog	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/ChangeLog	2021-04-16 06:49:28 UTC (rev 276120)
@@ -1,3 +1,17 @@
+2021-04-15  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r276107.
+        https://bugs.webkit.org/show_bug.cgi?id=224653
+
+        It broke non-Cocoa clean builds
+
+        Reverted changeset:
+
+        "[GPUP] WebContent process should not create AVOutputContext
+        instances when media in GPU Process is enabled"
+        https://bugs.webkit.org/show_bug.cgi?id=224469
+        https://trac.webkit.org/changeset/276107
+
 2021-04-15  Lauro Moura  <[email protected]>
 
         REGRESSION(r276039) [GTK] Build failures on Ubuntu 18.04

Modified: trunk/Source/WebCore/Headers.cmake (276119 => 276120)


--- trunk/Source/WebCore/Headers.cmake	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/Headers.cmake	2021-04-16 06:49:28 UTC (rev 276120)
@@ -1269,6 +1269,7 @@
     platform/graphics/MIMETypeCache.h
     platform/graphics/MediaPlaybackTarget.h
     platform/graphics/MediaPlaybackTargetClient.h
+    platform/graphics/MediaPlaybackTargetContext.h
     platform/graphics/MediaPlaybackTargetPicker.h
     platform/graphics/MediaPlayer.h
     platform/graphics/MediaPlayerEnums.h

Modified: trunk/Source/WebCore/Modules/airplay/WebMediaSessionManager.cpp (276119 => 276120)


--- trunk/Source/WebCore/Modules/airplay/WebMediaSessionManager.cpp	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/Modules/airplay/WebMediaSessionManager.cpp	2021-04-16 06:49:28 UTC (rev 276120)
@@ -161,7 +161,7 @@
     m_mockPickerEnabled = enabled;
 }
 
-void WebMediaSessionManager::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::MockState state)
+void WebMediaSessionManager::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::State state)
 {
     ALWAYS_LOG_MEDIASESSIONMANAGER(__func__);
     mockPicker().setState(name, state);

Modified: trunk/Source/WebCore/Modules/airplay/WebMediaSessionManager.h (276119 => 276120)


--- trunk/Source/WebCore/Modules/airplay/WebMediaSessionManager.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/Modules/airplay/WebMediaSessionManager.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -51,7 +51,7 @@
     WEBCORE_EXPORT static WebMediaSessionManager& shared();
 
     WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerEnabled(bool);
-    WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext::MockState);
+    WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext::State);
     WEBCORE_EXPORT void mockMediaPlaybackTargetPickerDismissPopup();
 
     WEBCORE_EXPORT PlaybackTargetClientContextIdentifier addPlaybackTargetPickerClient(WebMediaSessionManagerClient&, PlaybackTargetClientContextIdentifier);

Modified: trunk/Source/WebCore/SourcesCocoa.txt (276119 => 276120)


--- trunk/Source/WebCore/SourcesCocoa.txt	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2021-04-16 06:49:28 UTC (rev 276120)
@@ -369,7 +369,6 @@
 platform/graphics/cocoa/IOSurfacePoolCocoa.mm
 platform/graphics/cocoa/IntRectCocoa.mm
 platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp
-platform/graphics/cocoa/MediaPlaybackTargetContext.mm
 platform/graphics/cocoa/RemoteGraphicsContextGLProxyBaseCocoa.mm
 platform/graphics/cocoa/SourceBufferParser.cpp
 platform/graphics/cocoa/SourceBufferParserWebM.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (276119 => 276120)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-04-16 06:49:28 UTC (rev 276120)
@@ -6980,7 +6980,6 @@
 		1D0026A32374D62400CA6CDF /* JSPictureInPictureWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPictureInPictureWindow.cpp; sourceTree = "<group>"; };
 		1D0026A82374F9D900CA6CDF /* JSEnterPictureInPictureEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEnterPictureInPictureEvent.h; sourceTree = "<group>"; };
 		1D0026A92374F9D900CA6CDF /* JSEnterPictureInPictureEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEnterPictureInPictureEvent.cpp; sourceTree = "<group>"; };
-		1D008AA5262108C000EE3ADE /* MediaPlaybackTargetContext.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaPlaybackTargetContext.mm; sourceTree = "<group>"; };
 		1D2C82B6236A3F6A0055D6C5 /* PictureInPictureSupport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PictureInPictureSupport.h; sourceTree = "<group>"; };
 		1D47658D25CCA778007AF312 /* ImageDecoderIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageDecoderIdentifier.h; sourceTree = "<group>"; };
 		1DAB3113251D725C00FC9485 /* VideoLayerManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VideoLayerManager.h; sourceTree = "<group>"; };
@@ -26967,6 +26966,7 @@
 				CDDE02E918B3DFC700CF7FF1 /* LegacyCDMSession.h */,
 				07E3DFD01A9E786500764CA8 /* MediaPlaybackTarget.h */,
 				079216531AA560AA00A3C049 /* MediaPlaybackTargetClient.h */,
+				07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */,
 				078E43D71ABB6C7E001C2FA6 /* MediaPlaybackTargetPicker.cpp */,
 				078E43D81ABB6C7E001C2FA6 /* MediaPlaybackTargetPicker.h */,
 				E4B41E0C0CBF90BD00AF2ECE /* MediaPlayer.cpp */,
@@ -27182,8 +27182,6 @@
 				AD9FF6E01908391D003B61E0 /* IOSurfacePoolCocoa.mm */,
 				CDC48AC82149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.cpp */,
 				CDC48AC72149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h */,
-				07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */,
-				1D008AA5262108C000EE3ADE /* MediaPlaybackTargetContext.mm */,
 				31647FA8251616BD0010F8FB /* OpenGLSoftLinkCocoa.h */,
 				31647FA9251616BD0010F8FB /* OpenGLSoftLinkCocoa.mm */,
 				7B64C0B4254C3B160006B4AF /* RemoteGraphicsContextGLProxyBaseCocoa.mm */,
@@ -32117,7 +32115,6 @@
 				4162A451101145AE00DFF3ED /* DedicatedWorkerGlobalScope.h in Headers */,
 				41A3D58F101C152D00316D07 /* DedicatedWorkerThread.h in Headers */,
 				FD06DFA6134A4DEF006F5D7D /* DefaultAudioDestinationNode.h in Headers */,
-				E4F38D1B2626F13B007B1064 /* DefaultResourceLoadPriority.h in Headers */,
 				CD83D36221122A210076E11C /* DeferrableTask.h in Headers */,
 				FD31602C12B0267600C1A359 /* DelayDSPKernel.h in Headers */,
 				FD31602E12B0267600C1A359 /* DelayNode.h in Headers */,
@@ -34617,6 +34614,7 @@
 				B595FF471824CEE300FF51CD /* RenderIterator.h in Headers */,
 				BCEA487A097D93020094C9E4 /* RenderLayer.h in Headers */,
 				0F580CFF0F12DE9B0051D689 /* RenderLayerBacking.h in Headers */,
+				E4F38D1B2626F13B007B1064 /* DefaultResourceLoadPriority.h in Headers */,
 				0F580CFD0F12DE9B0051D689 /* RenderLayerCompositor.h in Headers */,
 				3C244FEAA375AC633F88BE6F /* RenderLayerModelObject.h in Headers */,
 				0F53FB84213B7A6400C40D34 /* RenderLayerScrollableArea.h in Headers */,

Modified: trunk/Source/WebCore/page/ChromeClient.h (276119 => 276120)


--- trunk/Source/WebCore/page/ChromeClient.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/page/ChromeClient.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -513,7 +513,7 @@
     virtual void showPlaybackTargetPicker(PlaybackTargetClientContextIdentifier, const IntPoint&, bool /*isVideo*/) { }
     virtual void playbackTargetPickerClientStateDidChange(PlaybackTargetClientContextIdentifier, MediaProducer::MediaStateFlags) { }
     virtual void setMockMediaPlaybackTargetPickerEnabled(bool)  { }
-    virtual void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext::MockState) { }
+    virtual void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext::State) { }
     virtual void mockMediaPlaybackTargetPickerDismissPopup() { }
 #endif
 

Modified: trunk/Source/WebCore/page/Page.cpp (276119 => 276120)


--- trunk/Source/WebCore/page/Page.cpp	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/page/Page.cpp	2021-04-16 06:49:28 UTC (rev 276120)
@@ -2952,7 +2952,7 @@
     chrome().client().setMockMediaPlaybackTargetPickerEnabled(enabled);
 }
 
-void Page::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::MockState state)
+void Page::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::State state)
 {
     chrome().client().setMockMediaPlaybackTargetPickerState(name, state);
 }

Modified: trunk/Source/WebCore/page/Page.h (276119 => 276120)


--- trunk/Source/WebCore/page/Page.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/page/Page.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -731,7 +731,7 @@
     void showPlaybackTargetPicker(PlaybackTargetClientContextIdentifier, const IntPoint&, bool, RouteSharingPolicy, const String&);
     void playbackTargetPickerClientStateDidChange(PlaybackTargetClientContextIdentifier, MediaProducer::MediaStateFlags);
     WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerEnabled(bool);
-    WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext::MockState);
+    WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext::State);
     WEBCORE_EXPORT void mockMediaPlaybackTargetPickerDismissPopup();
 
     WEBCORE_EXPORT void setPlaybackTarget(PlaybackTargetClientContextIdentifier, Ref<MediaPlaybackTarget>&&);

Modified: trunk/Source/WebCore/platform/graphics/MediaPlaybackTarget.h (276119 => 276120)


--- trunk/Source/WebCore/platform/graphics/MediaPlaybackTarget.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/platform/graphics/MediaPlaybackTarget.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -27,23 +27,24 @@
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 
-#include "MediaPlaybackTargetContext.h"
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
 
+class MediaPlaybackTargetContext;
+
 class MediaPlaybackTarget : public RefCounted<MediaPlaybackTarget> {
 public:
     virtual ~MediaPlaybackTarget() = default;
 
-    enum class TargetType : uint8_t { AVFoundation, Mock };
+    enum TargetType { AVFoundation, Mock };
     virtual TargetType targetType() const = 0;
+
     virtual const MediaPlaybackTargetContext& targetContext() const = 0;
-
-    bool hasActiveRoute() const { return targetContext().hasActiveRoute(); }
-    String deviceName() const { return targetContext().deviceName(); }
-    bool supportsRemoteVideoPlayback() { return targetContext().supportsRemoteVideoPlayback(); }
+    virtual bool hasActiveRoute() const = 0;
+    virtual String deviceName() const = 0;
+    virtual bool supportsRemoteVideoPlayback() const = 0;
 };
 
 }

Added: trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetContext.h (0 => 276120)


--- trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetContext.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetContext.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2015 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 MediaPlaybackTargetContext_h
+#define MediaPlaybackTargetContext_h
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+
+#include <wtf/text/WTFString.h>
+
+OBJC_CLASS AVOutputContext;
+
+#if PLATFORM(COCOA)
+OBJC_CLASS NSKeyedArchiver;
+OBJC_CLASS NSKeyedUnarchiver;
+#endif
+
+namespace WebCore {
+
+class MediaPlaybackTargetContext {
+public:
+    enum Type : int32_t {
+        None,
+        AVOutputContextType,
+        MockType,
+    };
+
+    enum ContextState {
+        Unknown = 0,
+        OutputDeviceUnavailable = 1,
+        OutputDeviceAvailable = 2,
+    };
+    typedef unsigned State;
+
+    MediaPlaybackTargetContext()
+        : m_type(None)
+    {
+    }
+
+    MediaPlaybackTargetContext(AVOutputContext *outputContext)
+        : m_type(AVOutputContextType)
+        , m_outputContext(outputContext)
+    {
+    }
+
+    MediaPlaybackTargetContext(const String& name, State state)
+        : m_type(MockType)
+        , m_name(name)
+        , m_state(state)
+    {
+    }
+
+    Type type() const { return m_type; }
+
+    const String& mockDeviceName() const
+    {
+        ASSERT(m_type == MockType);
+        return m_name;
+    }
+
+    State mockState() const
+    {
+        ASSERT(m_type == MockType);
+        return m_state;
+    }
+
+    AVOutputContext *avOutputContext() const
+    {
+        ASSERT(m_type == AVOutputContextType);
+        return m_outputContext;
+    }
+
+    bool encodingRequiresPlatformData() const { return m_type == AVOutputContextType; }
+    
+private:
+    Type m_type { None };
+    AVOutputContext *m_outputContext { nullptr };
+    String m_name;
+    State m_state { Unknown };
+};
+
+}
+
+#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)
+
+#endif // MediaPlaybackTargetContext 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h (276119 => 276120)


--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -28,6 +28,7 @@
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 
 #include "MediaPlaybackTarget.h"
+#include "MediaPlaybackTargetContext.h"
 #include <wtf/RetainPtr.h>
 
 namespace WebCore {
@@ -35,7 +36,6 @@
 class MediaPlaybackTargetCocoa : public MediaPlaybackTarget {
 public:
     WEBCORE_EXPORT static Ref<MediaPlaybackTarget> create(AVOutputContext *);
-    WEBCORE_EXPORT static Ref<MediaPlaybackTarget> create(MediaPlaybackTargetContext&&);
 
 #if PLATFORM(IOS_FAMILY) && !PLATFORM(IOS_FAMILY_SIMULATOR) && !PLATFORM(MACCATALYST)
     static Ref<MediaPlaybackTarget> create();
@@ -43,14 +43,21 @@
 
     virtual ~MediaPlaybackTargetCocoa();
 
-    TargetType targetType() const final { return TargetType::AVFoundation; }
-    const MediaPlaybackTargetContext& targetContext() const final { return m_context; }
+    TargetType targetType() const final { return AVFoundation; }
 
+    const MediaPlaybackTargetContext& targetContext() const final;
+    bool hasActiveRoute() const final;
+    String deviceName() const final;
+    bool supportsRemoteVideoPlayback() const final;
+
+    AVOutputContext *outputContext() const { return m_outputContext.get(); }
+
 protected:
-    explicit MediaPlaybackTargetCocoa(AVOutputContext *);
-    explicit MediaPlaybackTargetCocoa(MediaPlaybackTargetContext&&);
+    MediaPlaybackTargetCocoa(AVOutputContext *);
 
-    MediaPlaybackTargetContext m_context;
+    RetainPtr<AVOutputContext> m_outputContext;
+    mutable MediaPlaybackTargetContext m_context;
+    String m_deviceName;
 };
 
 MediaPlaybackTargetCocoa* toMediaPlaybackTargetCocoa(MediaPlaybackTarget*);

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm (276119 => 276120)


--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm	2021-04-16 06:49:28 UTC (rev 276120)
@@ -34,26 +34,17 @@
 
 namespace WebCore {
 
-Ref<MediaPlaybackTarget> MediaPlaybackTargetCocoa::create(AVOutputContext *outputContext)
+Ref<MediaPlaybackTarget> MediaPlaybackTargetCocoa::create(AVOutputContext *context)
 {
-    return adoptRef(*new MediaPlaybackTargetCocoa(outputContext));
+    return adoptRef(*new MediaPlaybackTargetCocoa(context));
 }
 
-Ref<MediaPlaybackTarget> MediaPlaybackTargetCocoa::create(MediaPlaybackTargetContext&& context)
+MediaPlaybackTargetCocoa::MediaPlaybackTargetCocoa(AVOutputContext *context)
+    : MediaPlaybackTarget()
+    , m_outputContext(context)
 {
-    return adoptRef(*new MediaPlaybackTargetCocoa(WTFMove(context)));
 }
 
-MediaPlaybackTargetCocoa::MediaPlaybackTargetCocoa(AVOutputContext *outputContext)
-    : m_context(outputContext)
-{
-}
-
-MediaPlaybackTargetCocoa::MediaPlaybackTargetCocoa(MediaPlaybackTargetContext&& context)
-    : m_context(WTFMove(context))
-{
-}
-
 #if PLATFORM(IOS_FAMILY) && !PLATFORM(IOS_FAMILY_SIMULATOR) && !PLATFORM(MACCATALYST)
 Ref<MediaPlaybackTarget> MediaPlaybackTargetCocoa::create()
 {
@@ -62,10 +53,75 @@
 }
 #endif
 
+bool MediaPlaybackTargetCocoa::supportsRemoteVideoPlayback() const
+{
+    if (!m_outputContext)
+        return false;
+
+    if (![m_outputContext respondsToSelector:@selector(supportsMultipleOutputDevices)] || ![m_outputContext supportsMultipleOutputDevices] || ![m_outputContext respondsToSelector:@selector(outputDevices)]) {
+        if (auto *outputDevice = [m_outputContext outputDevice]) {
+            if (outputDevice.deviceFeatures & AVOutputDeviceFeatureVideo)
+                return true;
+        }
+
+        return false;
+    }
+
+    for (AVOutputDevice *outputDevice in [m_outputContext outputDevices]) {
+        if (outputDevice.deviceFeatures & AVOutputDeviceFeatureVideo)
+            return true;
+    }
+
+    return false;
+}
+
 MediaPlaybackTargetCocoa::~MediaPlaybackTargetCocoa()
 {
 }
 
+const MediaPlaybackTargetContext& MediaPlaybackTargetCocoa::targetContext() const
+{
+    m_context = MediaPlaybackTargetContext(m_outputContext.get());
+    return m_context;
+}
+
+bool MediaPlaybackTargetCocoa::hasActiveRoute() const
+{
+    if (!m_outputContext)
+        return false;
+
+    if ([m_outputContext respondsToSelector:@selector(supportsMultipleOutputDevices)] && [m_outputContext supportsMultipleOutputDevices] && [m_outputContext respondsToSelector:@selector(outputDevices)]) {
+        for (AVOutputDevice *outputDevice in [m_outputContext outputDevices]) {
+            if (outputDevice.deviceFeatures & (AVOutputDeviceFeatureVideo | AVOutputDeviceFeatureAudio))
+                return true;
+        }
+
+        return false;
+    }
+
+    if ([m_outputContext respondsToSelector:@selector(outputDevice)]) {
+        if (auto *outputDevice = [m_outputContext outputDevice])
+            return outputDevice.deviceFeatures & (AVOutputDeviceFeatureVideo | AVOutputDeviceFeatureAudio);
+    }
+
+    return m_outputContext.get().deviceName;
+}
+
+String MediaPlaybackTargetCocoa::deviceName() const
+{
+    if (!m_outputContext)
+        return emptyString();
+
+    if (![m_outputContext supportsMultipleOutputDevices])
+        return [m_outputContext deviceName];
+
+    auto outputDeviceNames = adoptNS([[NSMutableArray alloc] init]);
+    for (AVOutputDevice *outputDevice in [m_outputContext outputDevices])
+        [outputDeviceNames addObject:[outputDevice deviceName]];
+
+    return [outputDeviceNames componentsJoinedByString:@" + "];
+}
+
 MediaPlaybackTargetCocoa* toMediaPlaybackTargetCocoa(MediaPlaybackTarget* rep)
 {
     return const_cast<MediaPlaybackTargetCocoa*>(toMediaPlaybackTargetCocoa(const_cast<const MediaPlaybackTarget*>(rep)));
@@ -73,7 +129,7 @@
 
 const MediaPlaybackTargetCocoa* toMediaPlaybackTargetCocoa(const MediaPlaybackTarget* rep)
 {
-    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(rep->targetType() == MediaPlaybackTarget::TargetType::AVFoundation);
+    ASSERT_WITH_SECURITY_IMPLICATION(rep->targetType() == MediaPlaybackTarget::AVFoundation);
     return static_cast<const MediaPlaybackTargetCocoa*>(rep);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (276119 => 276120)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2021-04-16 06:49:28 UTC (rev 276120)
@@ -2824,7 +2824,7 @@
 
 #if !PLATFORM(IOS_FAMILY)
     if (m_playbackTarget) {
-        if (m_playbackTarget->targetType() == MediaPlaybackTarget::TargetType::AVFoundation)
+        if (m_playbackTarget->targetType() == MediaPlaybackTarget::AVFoundation)
             wirelessTarget = m_avPlayer && m_avPlayer.get().externalPlaybackActive;
         else
             wirelessTarget = m_shouldPlayToPlaybackTarget && m_playbackTarget->hasActiveRoute();
@@ -2968,7 +2968,7 @@
 {
     m_playbackTarget = WTFMove(target);
 
-    m_outputContext = m_playbackTarget->targetType() == MediaPlaybackTarget::TargetType::AVFoundation ? toMediaPlaybackTargetCocoa(m_playbackTarget.get())->targetContext().outputContext() : nullptr;
+    m_outputContext = m_playbackTarget->targetType() == MediaPlaybackTarget::AVFoundation ? toMediaPlaybackTargetCocoa(m_playbackTarget.get())->outputContext() : nullptr;
 
     INFO_LOG(LOGIDENTIFIER);
 
@@ -2988,7 +2988,7 @@
 
     INFO_LOG(LOGIDENTIFIER, shouldPlay);
 
-    if (m_playbackTarget->targetType() == MediaPlaybackTarget::TargetType::AVFoundation) {
+    if (m_playbackTarget->targetType() == MediaPlaybackTarget::AVFoundation) {
         AVOutputContext *newContext = shouldPlay ? m_outputContext.get() : nil;
 
         if (!m_avPlayer)
@@ -3005,7 +3005,7 @@
         return;
     }
 
-    ASSERT(m_playbackTarget->targetType() == MediaPlaybackTarget::TargetType::Mock);
+    ASSERT(m_playbackTarget->targetType() == MediaPlaybackTarget::Mock);
 
     setDelayCallbacks(true);
     auto weakThis = makeWeakPtr(*this);

Deleted: trunk/Source/WebCore/platform/graphics/cocoa/MediaPlaybackTargetContext.h (276119 => 276120)


--- trunk/Source/WebCore/platform/graphics/cocoa/MediaPlaybackTargetContext.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/platform/graphics/cocoa/MediaPlaybackTargetContext.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2015-2021 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
-
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
-
-#include <wtf/RetainPtr.h>
-#include <wtf/text/WTFString.h>
-
-#if PLATFORM(COCOA)
-OBJC_CLASS AVOutputContext;
-OBJC_CLASS NSData;
-#endif
-
-namespace WebCore {
-
-class MediaPlaybackTargetContext {
-public:
-    enum class Type : uint8_t {
-        None,
-        AVOutputContext,
-        SerializedAVOutputContext,
-        Mock,
-    };
-
-    enum class MockState : uint8_t {
-        Unknown = 0,
-        OutputDeviceUnavailable = 1,
-        OutputDeviceAvailable = 2,
-    };
-
-    MediaPlaybackTargetContext() = default;
-    WEBCORE_EXPORT explicit MediaPlaybackTargetContext(RetainPtr<AVOutputContext>&&);
-
-    MediaPlaybackTargetContext(RetainPtr<NSData>&& serializedOutputContext, bool hasActiveRoute)
-        : m_type(Type::SerializedAVOutputContext)
-        , m_serializedOutputContext(WTFMove(serializedOutputContext))
-        , m_cachedHasActiveRoute(hasActiveRoute)
-    {
-        ASSERT(m_serializedOutputContext);
-    }
-
-    MediaPlaybackTargetContext(const String& mockDeviceName, MockState state)
-        : m_type(Type::Mock)
-        , m_mockDeviceName(mockDeviceName)
-        , m_mockState(state)
-    {
-    }
-
-    Type type() const { return m_type; }
-    WEBCORE_EXPORT String deviceName() const;
-    WEBCORE_EXPORT bool hasActiveRoute() const;
-    bool supportsRemoteVideoPlayback() const;
-
-    MockState mockState() const
-    {
-        ASSERT(m_type == Type::Mock);
-        return m_mockState;
-    }
-
-    RetainPtr<AVOutputContext> outputContext() const
-    {
-        ASSERT(m_type == Type::AVOutputContext);
-        return m_outputContext;
-    }
-
-    RetainPtr<NSData> serializedOutputContext() const
-    {
-        ASSERT(m_type == Type::SerializedAVOutputContext);
-        return m_serializedOutputContext;
-    }
-
-    WEBCORE_EXPORT bool serializeOutputContext();
-    WEBCORE_EXPORT bool deserializeOutputContext();
-
-    bool encodingRequiresPlatformData() const { return m_type == Type::AVOutputContext || m_type == Type::SerializedAVOutputContext; }
-
-private:
-    Type m_type { Type::None };
-    RetainPtr<AVOutputContext> m_outputContext;
-    RetainPtr<NSData> m_serializedOutputContext;
-    bool m_cachedHasActiveRoute { false };
-
-    String m_mockDeviceName;
-    MockState m_mockState { MockState::Unknown };
-};
-
-} // namespace WebCore
-
-namespace WTF {
-
-template<> struct EnumTraits<WebCore::MediaPlaybackTargetContext::Type> {
-    using values = EnumValues<
-        WebCore::MediaPlaybackTargetContext::Type,
-        WebCore::MediaPlaybackTargetContext::Type::None,
-        WebCore::MediaPlaybackTargetContext::Type::AVOutputContext,
-        WebCore::MediaPlaybackTargetContext::Type::SerializedAVOutputContext,
-        WebCore::MediaPlaybackTargetContext::Type::Mock
-    >;
-};
-
-template<> struct EnumTraits<WebCore::MediaPlaybackTargetContext::MockState> {
-    using values = EnumValues<
-        WebCore::MediaPlaybackTargetContext::MockState,
-        WebCore::MediaPlaybackTargetContext::MockState::Unknown,
-        WebCore::MediaPlaybackTargetContext::MockState::OutputDeviceUnavailable,
-        WebCore::MediaPlaybackTargetContext::MockState::OutputDeviceAvailable
-    >;
-};
-
-} // namespace WTF
-
-#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)

Deleted: trunk/Source/WebCore/platform/graphics/cocoa/MediaPlaybackTargetContext.mm (276119 => 276120)


--- trunk/Source/WebCore/platform/graphics/cocoa/MediaPlaybackTargetContext.mm	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/platform/graphics/cocoa/MediaPlaybackTargetContext.mm	2021-04-16 06:49:28 UTC (rev 276120)
@@ -1,162 +0,0 @@
-/*
- * Copyright (C) 2021 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 "MediaPlaybackTargetContext.h"
-
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
-
-#import <Foundation/Foundation.h>
-#import <objc/runtime.h>
-#import <pal/spi/cocoa/AVFoundationSPI.h>
-#import <pal/cocoa/AVFoundationSoftLink.h>
-
-namespace WebCore {
-
-MediaPlaybackTargetContext::MediaPlaybackTargetContext(RetainPtr<AVOutputContext>&& outputContext)
-    : m_outputContext(outputContext)
-{
-    ASSERT(m_outputContext);
-    m_type = MediaPlaybackTargetContext::Type::AVOutputContext;
-}
-
-String MediaPlaybackTargetContext::deviceName() const
-{
-    ASSERT(m_type == MediaPlaybackTargetContext::Type::Mock || m_type == MediaPlaybackTargetContext::Type::AVOutputContext);
-
-    if (m_type == MediaPlaybackTargetContext::Type::Mock)
-        return m_mockDeviceName;
-
-    ASSERT(m_type == MediaPlaybackTargetContext::Type::AVOutputContext);
-    String deviceName;
-    if (![m_outputContext supportsMultipleOutputDevices])
-        deviceName = [m_outputContext deviceName];
-    else {
-        auto outputDeviceNames = adoptNS([[NSMutableArray alloc] init]);
-        for (AVOutputDevice *outputDevice in [m_outputContext outputDevices])
-            [outputDeviceNames addObject:[outputDevice deviceName]];
-
-        deviceName = [outputDeviceNames componentsJoinedByString:@" + "];
-    }
-
-    return deviceName;
-}
-bool MediaPlaybackTargetContext::hasActiveRoute() const
-{
-    ASSERT(m_type != MediaPlaybackTargetContext::Type::None);
-    if (m_type == MediaPlaybackTargetContext::Type::Mock)
-        return !m_mockDeviceName.isEmpty();
-
-    // FIXME: It may not be safe to use the cached `hasActiveRoute` of a serialized AVOutputContext
-    if (m_type == MediaPlaybackTargetContext::Type::SerializedAVOutputContext)
-        return m_cachedHasActiveRoute;
-
-    ASSERT(m_type == MediaPlaybackTargetContext::Type::AVOutputContext);
-    bool hasActiveRoute = false;
-    if ([m_outputContext respondsToSelector:@selector(supportsMultipleOutputDevices)] && [m_outputContext supportsMultipleOutputDevices] && [m_outputContext respondsToSelector:@selector(outputDevices)]) {
-        for (AVOutputDevice *outputDevice in [m_outputContext outputDevices]) {
-            if (outputDevice.deviceFeatures & (AVOutputDeviceFeatureVideo | AVOutputDeviceFeatureAudio))
-                hasActiveRoute = true;
-        }
-    } else if ([m_outputContext respondsToSelector:@selector(outputDevice)]) {
-        if (auto *outputDevice = [m_outputContext outputDevice])
-            hasActiveRoute = outputDevice.deviceFeatures & (AVOutputDeviceFeatureVideo | AVOutputDeviceFeatureAudio);
-    } else
-        hasActiveRoute = m_outputContext.get().deviceName;
-
-    return hasActiveRoute;
-}
-bool MediaPlaybackTargetContext::supportsRemoteVideoPlayback() const
-{
-    ASSERT(m_type == MediaPlaybackTargetContext::Type::Mock || m_type == MediaPlaybackTargetContext::Type::AVOutputContext);
-    if (m_type == MediaPlaybackTargetContext::Type::Mock)
-        return !m_mockDeviceName.isEmpty();
-
-    bool supportsRemoteVideoPlayback = false;
-    if (![m_outputContext respondsToSelector:@selector(supportsMultipleOutputDevices)] || ![m_outputContext supportsMultipleOutputDevices] || ![m_outputContext respondsToSelector:@selector(outputDevices)]) {
-        if (auto *outputDevice = [m_outputContext outputDevice]) {
-            if (outputDevice.deviceFeatures & AVOutputDeviceFeatureVideo)
-                supportsRemoteVideoPlayback = true;
-        }
-    } else {
-        for (AVOutputDevice *outputDevice in [m_outputContext outputDevices]) {
-            if (outputDevice.deviceFeatures & AVOutputDeviceFeatureVideo)
-                supportsRemoteVideoPlayback = true;
-        }
-    }
-
-    return supportsRemoteVideoPlayback;
-}
-
-bool MediaPlaybackTargetContext::serializeOutputContext()
-{
-    ASSERT(m_type != MediaPlaybackTargetContext::Type::SerializedAVOutputContext);
-    if (m_type != MediaPlaybackTargetContext::Type::AVOutputContext)
-        return false;
-
-    auto archiver = adoptNS([[NSKeyedArchiver alloc] initRequiringSecureCoding:YES]);
-    [archiver encodeObject:m_outputContext.get() forKey:NSKeyedArchiveRootObjectKey];
-    [archiver finishEncoding];
-
-    m_serializedOutputContext = [archiver encodedData];
-    m_type = MediaPlaybackTargetContext::Type::SerializedAVOutputContext;
-    m_outputContext.clear();
-
-    return true;
-}
-
-bool MediaPlaybackTargetContext::deserializeOutputContext()
-{
-    ASSERT(m_type != MediaPlaybackTargetContext::Type::AVOutputContext);
-    if (m_type != MediaPlaybackTargetContext::Type::SerializedAVOutputContext)
-        return false;
-
-    bool success = false;
-    auto unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingFromData:m_serializedOutputContext.get() error:nullptr]);
-    unarchiver.get().decodingFailurePolicy = NSDecodingFailurePolicyRaiseException;
-    auto allowedClassSet = adoptNS([[NSSet alloc] initWithArray:@[ PAL::getAVOutputContextClass() ]]);
-
-    @try {
-        id result = [unarchiver decodeObjectOfClasses:allowedClassSet.get() forKey:NSKeyedArchiveRootObjectKey];
-        ASSERT(result);
-        if (result) {
-            m_outputContext = result;
-            m_type = MediaPlaybackTargetContext::Type::AVOutputContext;
-            m_serializedOutputContext.clear();
-            success = true;
-        }
-    } @catch (NSException *exception) {
-        LOG_ERROR("Failed to decode object of class AVOutputContext : %@", exception);
-    } @finally {
-        [unarchiver finishDecoding];
-        unarchiver.get().delegate = nil;
-    }
-
-    return success;
-}
-
-}
-
-#endif

Modified: trunk/Source/WebCore/platform/mock/MediaPlaybackTargetMock.cpp (276119 => 276120)


--- trunk/Source/WebCore/platform/mock/MediaPlaybackTargetMock.cpp	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/platform/mock/MediaPlaybackTargetMock.cpp	2021-04-16 06:49:28 UTC (rev 276120)
@@ -30,18 +30,26 @@
 
 namespace WebCore {
 
-Ref<MediaPlaybackTarget> MediaPlaybackTargetMock::create(const String& name, MediaPlaybackTargetContext::MockState state)
+Ref<MediaPlaybackTarget> MediaPlaybackTargetMock::create(const String& name, MediaPlaybackTargetContext::State state)
 {
     return adoptRef(*new MediaPlaybackTargetMock(name, state));
 }
 
-MediaPlaybackTargetMock::MediaPlaybackTargetMock(const String& name, MediaPlaybackTargetContext::MockState state)
-    : m_context(name, state)
+MediaPlaybackTargetMock::MediaPlaybackTargetMock(const String& name, MediaPlaybackTargetContext::State state)
+    : MediaPlaybackTarget()
+    , m_name(name)
+    , m_state(state)
 {
 }
 
 MediaPlaybackTargetMock::~MediaPlaybackTargetMock() = default;
 
+const MediaPlaybackTargetContext& MediaPlaybackTargetMock::targetContext() const
+{
+    m_context = MediaPlaybackTargetContext(m_name, m_state);
+    return m_context;
+}
+
 MediaPlaybackTargetMock* toMediaPlaybackTargetMock(MediaPlaybackTarget* rep)
 {
     return const_cast<MediaPlaybackTargetMock*>(toMediaPlaybackTargetMock(const_cast<const MediaPlaybackTarget*>(rep)));
@@ -49,7 +57,7 @@
 
 const MediaPlaybackTargetMock* toMediaPlaybackTargetMock(const MediaPlaybackTarget* rep)
 {
-    RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(rep->targetType() == MediaPlaybackTarget::TargetType::Mock);
+    ASSERT_WITH_SECURITY_IMPLICATION(rep->targetType() == MediaPlaybackTarget::Mock);
     return static_cast<const MediaPlaybackTargetMock*>(rep);
 }
 

Modified: trunk/Source/WebCore/platform/mock/MediaPlaybackTargetMock.h (276119 => 276120)


--- trunk/Source/WebCore/platform/mock/MediaPlaybackTargetMock.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/platform/mock/MediaPlaybackTargetMock.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -23,11 +23,13 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#pragma once
+#ifndef MediaPlaybackTargetMock_h
+#define MediaPlaybackTargetMock_h
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
 
 #include "MediaPlaybackTarget.h"
+#include "MediaPlaybackTargetContext.h"
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -34,19 +36,27 @@
 
 class MediaPlaybackTargetMock : public MediaPlaybackTarget {
 public:
-    WEBCORE_EXPORT static Ref<MediaPlaybackTarget> create(const String&, MediaPlaybackTargetContext::MockState);
+    WEBCORE_EXPORT static Ref<MediaPlaybackTarget> create(const String&, MediaPlaybackTargetContext::State);
 
     virtual ~MediaPlaybackTargetMock();
 
-    TargetType targetType() const final { return MediaPlaybackTarget::TargetType::Mock; }
-    const MediaPlaybackTargetContext& targetContext() const final { return m_context; }
+    TargetType targetType() const final { return Mock; }
 
-    MediaPlaybackTargetContext::MockState state() const { return m_context.mockState(); }
+    const MediaPlaybackTargetContext& targetContext() const final;
 
+    bool hasActiveRoute() const final { return !m_name.isEmpty(); }
+    bool supportsRemoteVideoPlayback() const final { return !m_name.isEmpty(); }
+
+    String deviceName() const final { return m_name; }
+
+    MediaPlaybackTargetContext::State state() const;
+
 protected:
-    MediaPlaybackTargetMock(const String&, MediaPlaybackTargetContext::MockState);
+    MediaPlaybackTargetMock(const String&, MediaPlaybackTargetContext::State);
 
-    MediaPlaybackTargetContext m_context;
+    String m_name;
+    MediaPlaybackTargetContext::State m_state { MediaPlaybackTargetContext::Unknown };
+    mutable MediaPlaybackTargetContext m_context;
 };
 
 MediaPlaybackTargetMock* toMediaPlaybackTargetMock(MediaPlaybackTarget*);
@@ -55,3 +65,5 @@
 }
 
 #endif // ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
+
+#endif

Modified: trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.cpp (276119 => 276120)


--- trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.cpp	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.cpp	2021-04-16 06:49:28 UTC (rev 276120)
@@ -52,7 +52,7 @@
 bool MediaPlaybackTargetPickerMock::externalOutputDeviceAvailable()
 {
     LOG(Media, "MediaPlaybackTargetPickerMock::externalOutputDeviceAvailable");
-    return m_state == MediaPlaybackTargetContext::MockState::OutputDeviceAvailable;
+    return m_state == MediaPlaybackTargetContext::OutputDeviceAvailable;
 }
 
 Ref<MediaPlaybackTarget> MediaPlaybackTargetPickerMock::playbackTarget()
@@ -85,10 +85,10 @@
     LOG(Media, "MediaPlaybackTargetPickerMock::startingMonitoringPlaybackTargets");
 
     m_taskQueue.enqueueTask([this] {
-        if (m_state == MediaPlaybackTargetContext::MockState::OutputDeviceAvailable)
+        if (m_state == MediaPlaybackTargetContext::OutputDeviceAvailable)
             availableDevicesDidChange();
 
-        if (!m_deviceName.isEmpty() && m_state != MediaPlaybackTargetContext::MockState::Unknown)
+        if (!m_deviceName.isEmpty() && m_state != MediaPlaybackTargetContext::Unknown)
             currentDeviceDidChange();
     });
 }
@@ -101,15 +101,15 @@
 void MediaPlaybackTargetPickerMock::invalidatePlaybackTargets()
 {
     LOG(Media, "MediaPlaybackTargetPickerMock::invalidatePlaybackTargets");
-    setState(emptyString(), MediaPlaybackTargetContext::MockState::Unknown);
+    setState(emptyString(), MediaPlaybackTargetContext::Unknown);
 }
 
-void MediaPlaybackTargetPickerMock::setState(const String& deviceName, MediaPlaybackTargetContext::MockState state)
+void MediaPlaybackTargetPickerMock::setState(const String& deviceName, MediaPlaybackTargetContext::State state)
 {
     LOG(Media, "MediaPlaybackTargetPickerMock::setState - name = %s, state = 0x%x", deviceName.utf8().data(), (unsigned)state);
 
     m_taskQueue.enqueueTask([this, state, deviceName] {
-        if (deviceName != m_deviceName && state != MediaPlaybackTargetContext::MockState::Unknown) {
+        if (deviceName != m_deviceName && state != MediaPlaybackTargetContext::Unknown) {
             m_deviceName = deviceName;
             currentDeviceDidChange();
         }

Modified: trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.h (276119 => 276120)


--- trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -48,7 +48,7 @@
     void stopMonitoringPlaybackTargets() override;
     void invalidatePlaybackTargets() override;
 
-    void setState(const String&, MediaPlaybackTargetContext::MockState);
+    void setState(const String&, MediaPlaybackTargetContext::State);
     void dismissPopup();
 
 private:
@@ -57,7 +57,7 @@
 
     String m_deviceName;
     GenericTaskQueue<Timer> m_taskQueue;
-    MediaPlaybackTargetContext::MockState m_state { MediaPlaybackTargetContext::MockState::Unknown };
+    MediaPlaybackTargetContext::State m_state { MediaPlaybackTargetContext::Unknown };
     bool m_showingMenu { false };
 };
 

Modified: trunk/Source/WebCore/testing/Internals.cpp (276119 => 276120)


--- trunk/Source/WebCore/testing/Internals.cpp	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebCore/testing/Internals.cpp	2021-04-16 06:49:28 UTC (rev 276120)
@@ -559,7 +559,7 @@
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     page.setMockMediaPlaybackTargetPickerEnabled(true);
-    page.setMockMediaPlaybackTargetPickerState(emptyString(), MediaPlaybackTargetContext::MockState::Unknown);
+    page.setMockMediaPlaybackTargetPickerState(emptyString(), MediaPlaybackTargetContext::Unknown);
 #endif
 
 #if ENABLE(VIDEO)
@@ -4531,14 +4531,14 @@
     Page* page = contextDocument()->frame()->page();
     ASSERT(page);
 
-    MediaPlaybackTargetContext::MockState state = MediaPlaybackTargetContext::MockState::Unknown;
+    MediaPlaybackTargetContext::State state = MediaPlaybackTargetContext::Unknown;
 
     if (equalLettersIgnoringASCIICase(deviceState, "deviceavailable"))
-        state = MediaPlaybackTargetContext::MockState::OutputDeviceAvailable;
+        state = MediaPlaybackTargetContext::OutputDeviceAvailable;
     else if (equalLettersIgnoringASCIICase(deviceState, "deviceunavailable"))
-        state = MediaPlaybackTargetContext::MockState::OutputDeviceUnavailable;
+        state = MediaPlaybackTargetContext::OutputDeviceUnavailable;
     else if (equalLettersIgnoringASCIICase(deviceState, "unknown"))
-        state = MediaPlaybackTargetContext::MockState::Unknown;
+        state = MediaPlaybackTargetContext::Unknown;
     else
         return Exception { InvalidAccessError };
 

Modified: trunk/Source/WebKit/ChangeLog (276119 => 276120)


--- trunk/Source/WebKit/ChangeLog	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/ChangeLog	2021-04-16 06:49:28 UTC (rev 276120)
@@ -1,3 +1,17 @@
+2021-04-15  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r276107.
+        https://bugs.webkit.org/show_bug.cgi?id=224653
+
+        It broke non-Cocoa clean builds
+
+        Reverted changeset:
+
+        "[GPUP] WebContent process should not create AVOutputContext
+        instances when media in GPU Process is enabled"
+        https://bugs.webkit.org/show_bug.cgi?id=224469
+        https://trac.webkit.org/changeset/276107
+
 2021-04-15  Kate Cheney  <[email protected]>
 
         CrashTracer: com.apple.WebKit.WebContent at com.apple.WebKit: WTF::HashTableConstIterator<WTF::String, WTF::KeyValuePair<...

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp (276119 => 276120)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp	2021-04-16 06:49:28 UTC (rev 276120)
@@ -59,7 +59,6 @@
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 #include <WebCore/MediaPlaybackTargetCocoa.h>
-#include <WebCore/MediaPlaybackTargetContext.h>
 #include <WebCore/MediaPlaybackTargetMock.h>
 #endif
 
@@ -698,21 +697,20 @@
     m_player->setShouldPlayToPlaybackTarget(shouldPlay);
 }
 
-void RemoteMediaPlayerProxy::setWirelessPlaybackTarget(MediaPlaybackTargetContext&& targetContext)
+void RemoteMediaPlayerProxy::setWirelessPlaybackTarget(const WebCore::MediaPlaybackTargetContext& targetContext)
 {
     switch (targetContext.type()) {
-    case MediaPlaybackTargetContext::Type::SerializedAVOutputContext: {
-        if (targetContext.deserializeOutputContext())
-            m_player->setWirelessPlaybackTarget(MediaPlaybackTargetCocoa::create(WTFMove(targetContext)));
+    case MediaPlaybackTargetContext::AVOutputContextType:
+        m_player->setWirelessPlaybackTarget(WebCore::MediaPlaybackTargetCocoa::create(targetContext.avOutputContext()));
         break;
-    }
-    case MediaPlaybackTargetContext::Type::Mock:
 #if PLATFORM(MAC)
-        m_player->setWirelessPlaybackTarget(MediaPlaybackTargetMock::create(targetContext.deviceName(), targetContext.mockState()));
+    case MediaPlaybackTargetContext::MockType:
+        m_player->setWirelessPlaybackTarget(WebCore::MediaPlaybackTargetMock::create(targetContext.mockDeviceName(), targetContext.mockState()));
         break;
+#else
+    case MediaPlaybackTargetContext::MockType:
 #endif
-    case MediaPlaybackTargetContext::Type::AVOutputContext:
-    case MediaPlaybackTargetContext::Type::None:
+    case MediaPlaybackTargetContext::None:
         ASSERT_NOT_REACHED();
         break;
     }

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h (276119 => 276120)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -152,7 +152,7 @@
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     void setWirelessVideoPlaybackDisabled(bool);
     void setShouldPlayToPlaybackTarget(bool);
-    void setWirelessPlaybackTarget(WebCore::MediaPlaybackTargetContext&&);
+    void setWirelessPlaybackTarget(const WebCore::MediaPlaybackTargetContext&);
     void mediaPlayerCurrentPlaybackTargetIsWirelessChanged(bool) final;
 #endif
 

Modified: trunk/Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp (276119 => 276120)


--- trunk/Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp	2021-04-16 06:49:28 UTC (rev 276120)
@@ -108,11 +108,7 @@
 
 void RemoteMediaSessionHelperProxy::activeVideoRouteDidChange(SupportsAirPlayVideo supportsAirPlayVideo, Ref<WebCore::MediaPlaybackTarget>&& target)
 {
-    auto context = target->targetContext();
-    if (!context.serializeOutputContext())
-        return;
-
-    m_gpuConnection.connection().send(Messages::RemoteMediaSessionHelper::ActiveVideoRouteDidChange(supportsAirPlayVideo, context), { });
+    m_gpuConnection.connection().send(Messages::RemoteMediaSessionHelper::ActiveVideoRouteDidChange(supportsAirPlayVideo, target->targetContext()), { });
 }
 
 }

Modified: trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (276119 => 276120)


--- trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm	2021-04-16 06:49:28 UTC (rev 276120)
@@ -41,15 +41,6 @@
 #import <UIKit/UIFont.h>
 #endif
 
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
-#import <WebCore/MediaPlaybackTargetContext.h>
-#import <objc/runtime.h>
-#endif
-
-#if USE(APPLE_INTERNAL_SDK)
-#include <WebKitAdditions/WebCoreArgumentCodersCocoaAdditions.mm>
-#endif
-
 #if ENABLE(APPLE_PAY)
 #import "DataReference.h"
 #import <WebCore/PaymentAuthorizationStatus.h>
@@ -56,8 +47,8 @@
 #import <pal/cocoa/PassKitSoftLink.h>
 #endif
 
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
-#import <pal/cocoa/AVFoundationSoftLink.h>
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/WebCoreArgumentCodersCocoaAdditions.mm>
 #endif
 
 namespace IPC {
@@ -615,50 +606,4 @@
     return true;
 }
 
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
-void ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData(Encoder& encoder, const MediaPlaybackTargetContext& target)
-{
-    if (target.type() == MediaPlaybackTargetContext::Type::AVOutputContext) {
-        if ([PAL::getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])
-            encoder << target.outputContext();
-    } else if (target.type() == MediaPlaybackTargetContext::Type::SerializedAVOutputContext) {
-        encoder << target.serializedOutputContext();
-        encoder << target.hasActiveRoute();
-    } else
-        ASSERT_NOT_REACHED();
-}
-
-bool ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData(Decoder& decoder, MediaPlaybackTargetContext::Type contextType, MediaPlaybackTargetContext& target)
-{
-    ASSERT(contextType != MediaPlaybackTargetContext::Type::Mock);
-
-    if (contextType == MediaPlaybackTargetContext::Type::AVOutputContext) {
-        if (![PAL::getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])
-            return false;
-
-        auto outputContext = IPC::decode<AVOutputContext>(decoder, PAL::getAVOutputContextClass());
-        if (!outputContext)
-            return false;
-
-        target = WebCore::MediaPlaybackTargetContext { WTFMove(*outputContext) };
-        return true;
-    }
-
-    if (contextType == MediaPlaybackTargetContext::Type::SerializedAVOutputContext) {
-        RetainPtr<NSData> serializedOutputContext;
-        if (!IPC::decode(decoder, serializedOutputContext) || !serializedOutputContext)
-            return false;
-
-        bool hasActiveRoute;
-        if (!decoder.decode(hasActiveRoute))
-            return false;
-
-        target = WebCore::MediaPlaybackTargetContext { WTFMove(serializedOutputContext), hasActiveRoute };
-        return true;
-    }
-
-    return false;
-}
-#endif
-
 } // namespace IPC

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (276119 => 276120)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2021-04-16 06:49:28 UTC (rev 276120)
@@ -2457,8 +2457,8 @@
     bool hasPlatformData = target.encodingRequiresPlatformData();
     encoder << hasPlatformData;
 
-    MediaPlaybackTargetContext::Type contextType = target.type();
-    encoder << contextType;
+    int32_t targetType = target.type();
+    encoder << targetType;
 
     if (target.encodingRequiresPlatformData()) {
         encodePlatformData(encoder, target);
@@ -2465,9 +2465,9 @@
         return;
     }
 
-    ASSERT(contextType == MediaPlaybackTargetContext::Type::Mock);
-    encoder << target.deviceName();
-    encoder << target.mockState();
+    ASSERT(targetType == MediaPlaybackTargetContext::MockType);
+    encoder << target.mockDeviceName();
+    encoder << static_cast<int32_t>(target.mockState());
 }
 
 bool ArgumentCoder<MediaPlaybackTargetContext>::decode(Decoder& decoder, MediaPlaybackTargetContext& target)
@@ -2476,24 +2476,24 @@
     if (!decoder.decode(hasPlatformData))
         return false;
 
-    MediaPlaybackTargetContext::Type contextType;
-    if (!decoder.decode(contextType))
+    int32_t targetType;
+    if (!decoder.decode(targetType))
         return false;
 
     if (hasPlatformData)
-        return decodePlatformData(decoder, contextType, target);
+        return decodePlatformData(decoder, target);
 
-    ASSERT(contextType == MediaPlaybackTargetContext::Type::Mock);
-    String deviceName;
-    if (!decoder.decode(deviceName))
+    ASSERT(targetType == MediaPlaybackTargetContext::MockType);
+
+    String mockDeviceName;
+    if (!decoder.decode(mockDeviceName))
         return false;
 
-    MediaPlaybackTargetContext::MockState mockState;
+    int32_t mockState;
     if (!decoder.decode(mockState))
         return false;
 
-    target = MediaPlaybackTargetContext(deviceName, mockState);
-
+    target = MediaPlaybackTargetContext(mockDeviceName, static_cast<MediaPlaybackTargetContext::State>(mockState));
     return true;
 }
 #endif

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (276119 => 276120)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -33,7 +33,6 @@
 #include <WebCore/ImageData.h>
 #include <WebCore/IndexedDB.h>
 #include <WebCore/InputMode.h>
-#include <WebCore/MediaPlaybackTargetContext.h>
 #include <WebCore/MediaSelectionOption.h>
 #include <WebCore/NativeImage.h>
 #include <WebCore/NetworkLoadMetrics.h>
@@ -196,6 +195,10 @@
 class ContentFilterUnblockHandler;
 #endif
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+class MediaPlaybackTargetContext;
+#endif
+
 #if ENABLE(MEDIA_STREAM)
 struct MediaConstraints;
 #endif
@@ -641,7 +644,7 @@
     static void encode(Encoder&, const WebCore::MediaPlaybackTargetContext&);
     static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::MediaPlaybackTargetContext&);
     static void encodePlatformData(Encoder&, const WebCore::MediaPlaybackTargetContext&);
-    static WARN_UNUSED_RETURN bool decodePlatformData(Decoder&, WebCore::MediaPlaybackTargetContext::Type, WebCore::MediaPlaybackTargetContext&);
+    static WARN_UNUSED_RETURN bool decodePlatformData(Decoder&, WebCore::MediaPlaybackTargetContext&);
 };
 #endif
 

Modified: trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm (276119 => 276120)


--- trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm	2021-04-16 06:49:28 UTC (rev 276120)
@@ -42,6 +42,12 @@
 #import <wtf/MachSendRight.h>
 #import <wtf/cf/TypeCastsCF.h>
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+#import <WebCore/MediaPlaybackTargetContext.h>
+#import <objc/runtime.h>
+#import <pal/cocoa/AVFoundationSoftLink.h>
+#endif
+
 namespace IPC {
 
 void ArgumentCoder<WebCore::CertificateInfo>::encode(Encoder& encoder, const WebCore::CertificateInfo& certificateInfo)
@@ -397,6 +403,29 @@
 
 #endif
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+
+void ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData(Encoder& encoder, const WebCore::MediaPlaybackTargetContext& target)
+{
+    if ([PAL::getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])
+        encoder << target.avOutputContext();
+}
+
+bool ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData(Decoder& decoder, WebCore::MediaPlaybackTargetContext& target)
+{
+    if (![PAL::getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])
+        return false;
+
+    auto context = IPC::decode<AVOutputContext>(decoder, PAL::getAVOutputContextClass());
+    if (!context)
+        return false;
+
+    target = WebCore::MediaPlaybackTargetContext { context->get() };
+    return true;
+}
+
+#endif
+
 #if ENABLE(VIDEO)
 void ArgumentCoder<WebCore::SerializedPlatformDataCueValue>::encodePlatformData(Encoder& encoder, const WebCore::SerializedPlatformDataCueValue& value)
 {

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (276119 => 276120)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-04-16 06:49:28 UTC (rev 276120)
@@ -7844,6 +7844,14 @@
     });
     return services;
 }
+
+static const Vector<ASCIILiteral>& temporaryMachServices()
+{
+    static const auto services = makeNeverDestroyed(Vector<ASCIILiteral> {
+        "com.apple.coremedia.routingcontext.xpc"_s // Remove after <rdar://76403302> is fixed.
+    });
+    return services;
+}
 #endif
 
 WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& process, DrawingAreaProxy& drawingArea, RefPtr<API::WebsitePolicies>&& websitePolicies)
@@ -7939,6 +7947,9 @@
         // FIXME(207716): The following should be removed when the GPU process is complete.
         parameters.mediaExtensionHandles = SandboxExtension::createHandlesForMachLookup(mediaRelatedMachServices(), WTF::nullopt);
         parameters.mediaIOKitExtensionHandles = SandboxExtension::createHandlesForIOKitClassExtensions(mediaRelatedIOKitClasses(), WTF::nullopt);
+    } else {
+        // FIXME(224327): Remove this else clause once <rdar://76403302> is fixed.
+        parameters.mediaExtensionHandles = SandboxExtension::createHandlesForMachLookup(temporaryMachServices(), WTF::nullopt);
     }
 
     if (!preferences().useGPUProcessForMediaEnabled()
@@ -9404,7 +9415,7 @@
     pageClient().mediaSessionManager().setMockMediaPlaybackTargetPickerEnabled(enabled);
 }
 
-void WebPageProxy::setMockMediaPlaybackTargetPickerState(const String& name, WebCore::MediaPlaybackTargetContext::MockState state)
+void WebPageProxy::setMockMediaPlaybackTargetPickerState(const String& name, WebCore::MediaPlaybackTargetContext::State state)
 {
     pageClient().mediaSessionManager().setMockMediaPlaybackTargetPickerState(name, state);
 }
@@ -9419,12 +9430,7 @@
     if (!hasRunningProcess())
         return;
 
-    auto context = target->targetContext();
-    ASSERT(context.type() != MediaPlaybackTargetContext::Type::SerializedAVOutputContext);
-    if (preferences().useGPUProcessForMediaEnabled())
-        context.serializeOutputContext();
-
-    send(Messages::WebPage::PlaybackTargetSelected(contextId, context));
+    send(Messages::WebPage::PlaybackTargetSelected(contextId, target->targetContext()));
 }
 
 void WebPageProxy::externalOutputDeviceAvailableDidChange(PlaybackTargetClientContextIdentifier contextId, bool available)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (276119 => 276120)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -1567,7 +1567,7 @@
     void showPlaybackTargetPicker(WebCore::PlaybackTargetClientContextIdentifier, const WebCore::FloatRect&, bool hasVideo);
     void playbackTargetPickerClientStateDidChange(WebCore::PlaybackTargetClientContextIdentifier, WebCore::MediaProducer::MediaStateFlags);
     void setMockMediaPlaybackTargetPickerEnabled(bool);
-    void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::MockState);
+    void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::State);
     void mockMediaPlaybackTargetPickerDismissPopup();
 
     // WebMediaSessionManagerClient

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (276119 => 276120)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-04-16 06:49:28 UTC (rev 276120)
@@ -476,7 +476,7 @@
     ShowPlaybackTargetPicker(WebCore::PlaybackTargetClientContextIdentifier contextId, WebCore::FloatRect pickerLocation, bool hasVideo)
     PlaybackTargetPickerClientStateDidChange(WebCore::PlaybackTargetClientContextIdentifier contextId, unsigned mediaState)
     SetMockMediaPlaybackTargetPickerEnabled(bool enabled)
-    SetMockMediaPlaybackTargetPickerState(String name, enum:uint8_t WebCore::MediaPlaybackTargetContext::MockState pickerState)
+    SetMockMediaPlaybackTargetPickerState(String name, unsigned pickerState)
     MockMediaPlaybackTargetPickerDismissPopup()
 #endif
 

Modified: trunk/Source/WebKit/WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp (276119 => 276120)


--- trunk/Source/WebKit/WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp	2021-04-16 06:49:28 UTC (rev 276120)
@@ -81,11 +81,12 @@
 
 void RemoteMediaSessionHelper::activeVideoRouteDidChange(SupportsAirPlayVideo supportsAirPlayVideo, MediaPlaybackTargetContext&& targetContext)
 {
-    ASSERT(targetContext.type() != MediaPlaybackTargetContext::Type::AVOutputContext);
-    if (targetContext.type() == MediaPlaybackTargetContext::Type::AVOutputContext)
+    if (targetContext.type() != MediaPlaybackTargetContext::AVOutputContextType) {
+        ASSERT_NOT_REACHED();
         return;
+    }
 
-    WebCore::MediaSessionHelper::activeVideoRouteDidChange(supportsAirPlayVideo, WebCore::MediaPlaybackTargetCocoa::create(WTFMove(targetContext)));
+    WebCore::MediaSessionHelper::activeVideoRouteDidChange(supportsAirPlayVideo, WebCore::MediaPlaybackTargetCocoa::create(targetContext.avOutputContext()));
 }
 
 }

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (276119 => 276120)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2021-04-16 06:49:28 UTC (rev 276120)
@@ -1352,7 +1352,7 @@
     m_page.send(Messages::WebPageProxy::SetMockMediaPlaybackTargetPickerEnabled(enabled));
 }
 
-void WebChromeClient::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::MockState state)
+void WebChromeClient::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::State state)
 {
     m_page.send(Messages::WebPageProxy::SetMockMediaPlaybackTargetPickerState(name, state));
 }

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (276119 => 276120)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -378,7 +378,7 @@
     void showPlaybackTargetPicker(WebCore::PlaybackTargetClientContextIdentifier, const WebCore::IntPoint&, bool) final;
     void playbackTargetPickerClientStateDidChange(WebCore::PlaybackTargetClientContextIdentifier, WebCore::MediaProducer::MediaStateFlags) final;
     void setMockMediaPlaybackTargetPickerEnabled(bool) final;
-    void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::MockState) final;
+    void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::State) final;
     void mockMediaPlaybackTargetPickerDismissPopup() final;
 #endif
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (276119 => 276120)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -1791,7 +1791,7 @@
     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
-    void playbackTargetSelected(WebCore::PlaybackTargetClientContextIdentifier, WebCore::MediaPlaybackTargetContext&&) const;
+    void playbackTargetSelected(WebCore::PlaybackTargetClientContextIdentifier, const WebCore::MediaPlaybackTargetContext& outputDevice) const;
     void playbackTargetAvailabilityDidChange(WebCore::PlaybackTargetClientContextIdentifier, bool);
     void setShouldPlayToPlaybackTarget(WebCore::PlaybackTargetClientContextIdentifier, bool);
     void playbackTargetPickerWasDismissed(WebCore::PlaybackTargetClientContextIdentifier);

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (276119 => 276120)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2021-04-16 06:49:28 UTC (rev 276120)
@@ -35,6 +35,7 @@
 #import "FontInfo.h"
 #import "FrameInfoData.h"
 #import "InjectedBundleHitTestResult.h"
+#import "PDFKitSoftLink.h"
 #import "PDFPlugin.h"
 #import "PageBanner.h"
 #import "PluginView.h"
@@ -98,12 +99,9 @@
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 #import <WebCore/MediaPlaybackTargetCocoa.h>
-#import <WebCore/MediaPlaybackTargetContext.h>
 #import <WebCore/MediaPlaybackTargetMock.h>
 #endif
 
-#import "PDFKitSoftLink.h"
-
 namespace WebKit {
 using namespace WebCore;
 
@@ -1044,17 +1042,16 @@
 }
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
-void WebPage::playbackTargetSelected(PlaybackTargetClientContextIdentifier contextId, WebCore::MediaPlaybackTargetContext&& targetContext) const
+void WebPage::playbackTargetSelected(PlaybackTargetClientContextIdentifier contextId, const WebCore::MediaPlaybackTargetContext& targetContext) const
 {
     switch (targetContext.type()) {
-    case MediaPlaybackTargetContext::Type::AVOutputContext:
-    case MediaPlaybackTargetContext::Type::SerializedAVOutputContext:
-        m_page->setPlaybackTarget(contextId, MediaPlaybackTargetCocoa::create(WTFMove(targetContext)));
+    case MediaPlaybackTargetContext::AVOutputContextType:
+        m_page->setPlaybackTarget(contextId, WebCore::MediaPlaybackTargetCocoa::create(targetContext.avOutputContext()));
         break;
-    case MediaPlaybackTargetContext::Type::Mock:
-        m_page->setPlaybackTarget(contextId, MediaPlaybackTargetMock::create(targetContext.deviceName(), targetContext.mockState()));
+    case MediaPlaybackTargetContext::MockType:
+        m_page->setPlaybackTarget(contextId, WebCore::MediaPlaybackTargetMock::create(targetContext.mockDeviceName(), targetContext.mockState()));
         break;
-    case MediaPlaybackTargetContext::Type::None:
+    case MediaPlaybackTargetContext::None:
         ASSERT_NOT_REACHED();
         break;
     }

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (276119 => 276120)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2021-04-16 06:49:28 UTC (rev 276120)
@@ -1,3 +1,17 @@
+2021-04-15  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r276107.
+        https://bugs.webkit.org/show_bug.cgi?id=224653
+
+        It broke non-Cocoa clean builds
+
+        Reverted changeset:
+
+        "[GPUP] WebContent process should not create AVOutputContext
+        instances when media in GPU Process is enabled"
+        https://bugs.webkit.org/show_bug.cgi?id=224469
+        https://trac.webkit.org/changeset/276107
+
 2021-04-15  Peng Liu  <[email protected]>
 
         [GPUP] WebContent process should not create AVOutputContext instances when media in GPU Process is enabled

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h (276119 => 276120)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -243,7 +243,7 @@
     void showPlaybackTargetPicker(WebCore::PlaybackTargetClientContextIdentifier, const WebCore::IntPoint&, bool /* hasVideo */) final;
     void playbackTargetPickerClientStateDidChange(WebCore::PlaybackTargetClientContextIdentifier, WebCore::MediaProducer::MediaStateFlags) final;
     void setMockMediaPlaybackTargetPickerEnabled(bool) final;
-    void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::MockState) final;
+    void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::State) final;
     void mockMediaPlaybackTargetPickerDismissPopup() override;
 #endif
 

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm (276119 => 276120)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm	2021-04-16 06:49:28 UTC (rev 276120)
@@ -1129,7 +1129,7 @@
     [m_webView _setMockMediaPlaybackTargetPickerEnabled:enabled];
 }
 
-void WebChromeClient::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::MockState state)
+void WebChromeClient::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::State state)
 {
     [m_webView _setMockMediaPlaybackTargetPickerName:name state:state];
 }

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.h (276119 => 276120)


--- trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -53,7 +53,7 @@
     void showPlaybackTargetPicker(WebCore::PlaybackTargetClientContextIdentifier, const WebCore::FloatRect&, bool hasVideo);
     void playbackTargetPickerClientStateDidChange(WebCore::PlaybackTargetClientContextIdentifier, WebCore::MediaProducer::MediaStateFlags);
     void setMockMediaPlaybackTargetPickerEnabled(bool);
-    void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::MockState);
+    void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::State);
     void mockMediaPlaybackTargetPickerDismissPopup();
 
     void invalidate();

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.mm (276119 => 276120)


--- trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.mm	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.mm	2021-04-16 06:49:28 UTC (rev 276120)
@@ -68,7 +68,7 @@
     WebCore::WebMediaSessionManager::shared().setMockMediaPlaybackTargetPickerEnabled(enabled);
 }
 
-void WebMediaPlaybackTargetPicker::setMockMediaPlaybackTargetPickerState(const String& name, WebCore::MediaPlaybackTargetContext::MockState state)
+void WebMediaPlaybackTargetPicker::setMockMediaPlaybackTargetPickerState(const String& name, WebCore::MediaPlaybackTargetContext::State state)
 {
     WebCore::WebMediaSessionManager::shared().setMockMediaPlaybackTargetPickerState(name, state);
 }

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (276119 => 276120)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2021-04-16 06:49:28 UTC (rev 276120)
@@ -9232,7 +9232,7 @@
     [self _devicePicker]->setMockMediaPlaybackTargetPickerEnabled(enabled);
 }
 
-- (void)_setMockMediaPlaybackTargetPickerName:(NSString *)name state:(WebCore::MediaPlaybackTargetContext::MockState)state
+- (void)_setMockMediaPlaybackTargetPickerName:(NSString *)name state:(WebCore::MediaPlaybackTargetContext::State)state
 {
     [self _devicePicker]->setMockMediaPlaybackTargetPickerState(name, state);
 }

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebViewInternal.h (276119 => 276120)


--- trunk/Source/WebKitLegacy/mac/WebView/WebViewInternal.h	2021-04-16 06:25:28 UTC (rev 276119)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebViewInternal.h	2021-04-16 06:49:28 UTC (rev 276120)
@@ -327,7 +327,7 @@
 - (void)_showPlaybackTargetPicker:(WebCore::PlaybackTargetClientContextIdentifier)contextId location:(const WebCore::IntPoint&)location hasVideo:(BOOL)hasVideo;
 - (void)_playbackTargetPickerClientStateDidChange:(WebCore::PlaybackTargetClientContextIdentifier)contextId state:(WebCore::MediaProducer::MediaStateFlags)state;
 - (void)_setMockMediaPlaybackTargetPickerEnabled:(bool)enabled;
-- (void)_setMockMediaPlaybackTargetPickerName:(NSString *)name state:(WebCore::MediaPlaybackTargetContext::MockState)state;
+- (void)_setMockMediaPlaybackTargetPickerName:(NSString *)name state:(WebCore::MediaPlaybackTargetContext::State)state;
 - (void)_mockMediaPlaybackTargetPickerDismissPopup;
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to