Changeset 276177 in webkit
- Timestamp:
- Apr 16, 2021, 3:54:15 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 1 deleted
- 42 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/Headers.cmake (modified) (1 diff)
-
WebCore/Modules/airplay/WebMediaSessionManager.cpp (modified) (1 diff)
-
WebCore/Modules/airplay/WebMediaSessionManager.h (modified) (1 diff)
-
WebCore/SourcesCocoa.txt (modified) (1 diff)
-
WebCore/WebCore.xcodeproj/project.pbxproj (modified) (3 diffs)
-
WebCore/page/ChromeClient.h (modified) (1 diff)
-
WebCore/page/Page.cpp (modified) (1 diff)
-
WebCore/page/Page.h (modified) (1 diff)
-
WebCore/platform/graphics/MediaPlaybackTarget.h (modified) (2 diffs)
-
WebCore/platform/graphics/MediaPlaybackTargetContext.h (deleted)
-
WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h (modified) (3 diffs)
-
WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm (modified) (3 diffs)
-
WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (modified) (4 diffs)
-
WebCore/platform/graphics/cocoa/MediaPlaybackTargetContext.h (added)
-
WebCore/platform/graphics/cocoa/MediaPlaybackTargetContext.mm (added)
-
WebCore/platform/mock/MediaPlaybackTargetMock.cpp (modified) (2 diffs)
-
WebCore/platform/mock/MediaPlaybackTargetMock.h (modified) (3 diffs)
-
WebCore/platform/mock/MediaPlaybackTargetPickerMock.cpp (modified) (3 diffs)
-
WebCore/platform/mock/MediaPlaybackTargetPickerMock.h (modified) (2 diffs)
-
WebCore/testing/Internals.cpp (modified) (2 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp (modified) (2 diffs)
-
WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h (modified) (1 diff)
-
WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp (modified) (1 diff)
-
WebKit/Scripts/webkit/messages.py (modified) (1 diff)
-
WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (modified) (3 diffs)
-
WebKit/Shared/WebCoreArgumentCoders.cpp (modified) (3 diffs)
-
WebKit/Shared/WebCoreArgumentCoders.h (modified) (3 diffs)
-
WebKit/Shared/mac/WebCoreArgumentCodersMac.mm (modified) (2 diffs)
-
WebKit/UIProcess/WebPageProxy.cpp (modified) (4 diffs)
-
WebKit/UIProcess/WebPageProxy.h (modified) (3 diffs)
-
WebKit/UIProcess/WebPageProxy.messages.in (modified) (1 diff)
-
WebKit/WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (modified) (1 diff)
-
WebKit/WebProcess/WebPage/WebPage.h (modified) (1 diff)
-
WebKit/WebProcess/WebPage/mac/WebPageMac.mm (modified) (3 diffs)
-
WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h (modified) (1 diff)
-
WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm (modified) (1 diff)
-
WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.h (modified) (1 diff)
-
WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.mm (modified) (1 diff)
-
WebKitLegacy/mac/WebView/WebView.mm (modified) (1 diff)
-
WebKitLegacy/mac/WebView/WebViewInternal.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r276169 r276177 1 2021-04-16 Peng Liu <peng.liu6@apple.com> 2 3 [GPUP] WebContent process should not create AVOutputContext instances when media in GPU Process is enabled 4 https://bugs.webkit.org/show_bug.cgi?id=224469 5 6 Reviewed by Eric Carlson. 7 8 This patch modifies `MediaPlaybackTargetContext` to provide interfaces to serialize/deserialize 9 `AVOutputContext` and modifies `MediaPlaybackTargetCocoa` to use `MediaPlaybackTargetContext` to 10 manage its `AVOutputContext` instead of keeping a pointer to the `AVOutputContext` object. 11 With these changes, a WebContent process can forward a serialized `AVOutputContext` object 12 to other processes (e.g., the GPU process) without deserializing it. Therefore, the WebContent 13 process does not need access to the CoreMedia routing service. So we can remove the fix (r275669) 14 for bug 224328. 15 16 Covered by existing tests. 17 18 * Modules/airplay/WebMediaSessionManager.cpp: 19 (WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerState): 20 * Modules/airplay/WebMediaSessionManager.h: 21 22 * Headers.cmake: 23 * SourcesCocoa.txt: 24 * WebCore.xcodeproj/project.pbxproj: 25 Modify the project file because `MediaPlaybackTargetContext` is used in Cocoa ports only. 26 27 * page/ChromeClient.h: 28 (WebCore::ChromeClient::setMockMediaPlaybackTargetPickerState): 29 * page/Page.cpp: 30 (WebCore::Page::setMockMediaPlaybackTargetPickerState): 31 * page/Page.h: 32 33 * platform/graphics/MediaPlaybackTarget.h: 34 (WebCore::MediaPlaybackTarget::hasActiveRoute const): 35 (WebCore::MediaPlaybackTarget::deviceName const): 36 (WebCore::MediaPlaybackTarget::supportsRemoteVideoPlayback): 37 (): Deleted. 38 * platform/graphics/MediaPlaybackTargetContext.h: Removed. 39 * platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h: 40 (WebCore::MediaPlaybackTargetCocoa::outputContext const): Deleted. 41 * platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm: 42 (WebCore::MediaPlaybackTargetCocoa::create): 43 (WebCore::MediaPlaybackTargetCocoa::MediaPlaybackTargetCocoa): 44 (WebCore::MediaPlaybackTargetCocoa::~MediaPlaybackTargetCocoa): 45 (WebCore::toMediaPlaybackTargetCocoa): 46 (WebCore::MediaPlaybackTargetCocoa::supportsRemoteVideoPlayback const): Deleted. 47 (WebCore::MediaPlaybackTargetCocoa::targetContext const): Deleted. 48 (WebCore::MediaPlaybackTargetCocoa::hasActiveRoute const): Deleted. 49 (WebCore::MediaPlaybackTargetCocoa::deviceName const): Deleted. 50 Don't directly use `AVOutputContext` in this class. 51 52 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 53 (WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const): 54 (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget): 55 (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget): 56 57 * platform/graphics/cocoa/MediaPlaybackTargetContext.h: Added. 58 (WebCore::MediaPlaybackTargetContext::MediaPlaybackTargetContext): 59 (WebCore::MediaPlaybackTargetContext::type const): 60 (WebCore::MediaPlaybackTargetContext::mockState const): 61 (WebCore::MediaPlaybackTargetContext::outputContext const): 62 (WebCore::MediaPlaybackTargetContext::serializedOutputContext const): 63 (WebCore::MediaPlaybackTargetContext::encodingRequiresPlatformData const): 64 * platform/graphics/cocoa/MediaPlaybackTargetContext.mm: Added. 65 (WebCore::MediaPlaybackTargetContext::MediaPlaybackTargetContext): 66 (WebCore::MediaPlaybackTargetContext::deviceName const): 67 (WebCore::MediaPlaybackTargetContext::hasActiveRoute const): 68 (WebCore::MediaPlaybackTargetContext::supportsRemoteVideoPlayback const): 69 (WebCore::MediaPlaybackTargetContext::serializeOutputContext): 70 (WebCore::MediaPlaybackTargetContext::deserializeOutputContext): 71 72 * platform/mock/MediaPlaybackTargetMock.cpp: 73 (WebCore::MediaPlaybackTargetMock::create): 74 (WebCore::MediaPlaybackTargetMock::MediaPlaybackTargetMock): 75 (WebCore::toMediaPlaybackTargetMock): 76 (WebCore::MediaPlaybackTargetMock::targetContext const): Deleted. 77 * platform/mock/MediaPlaybackTargetMock.h: 78 (WebCore::MediaPlaybackTargetMock::state const): 79 * platform/mock/MediaPlaybackTargetPickerMock.cpp: 80 (WebCore::MediaPlaybackTargetPickerMock::externalOutputDeviceAvailable): 81 (WebCore::MediaPlaybackTargetPickerMock::startingMonitoringPlaybackTargets): 82 (WebCore::MediaPlaybackTargetPickerMock::invalidatePlaybackTargets): 83 (WebCore::MediaPlaybackTargetPickerMock::setState): 84 * platform/mock/MediaPlaybackTargetPickerMock.h: 85 86 * testing/Internals.cpp: 87 (WebCore::Internals::resetToConsistentState): 88 (WebCore::Internals::setMockMediaPlaybackTargetPickerState): 89 1 90 2021-04-16 Zalan Bujtas <zalan@apple.com> 2 91 -
trunk/Source/WebCore/Headers.cmake
r276120 r276177 1270 1270 platform/graphics/MediaPlaybackTarget.h 1271 1271 platform/graphics/MediaPlaybackTargetClient.h 1272 platform/graphics/MediaPlaybackTargetContext.h1273 1272 platform/graphics/MediaPlaybackTargetPicker.h 1274 1273 platform/graphics/MediaPlayer.h -
trunk/Source/WebCore/Modules/airplay/WebMediaSessionManager.cpp
r276120 r276177 162 162 } 163 163 164 void WebMediaSessionManager::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext:: State state)164 void WebMediaSessionManager::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::MockState state) 165 165 { 166 166 ALWAYS_LOG_MEDIASESSIONMANAGER(__func__); -
trunk/Source/WebCore/Modules/airplay/WebMediaSessionManager.h
r276120 r276177 52 52 53 53 WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerEnabled(bool); 54 WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext:: State);54 WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext::MockState); 55 55 WEBCORE_EXPORT void mockMediaPlaybackTargetPickerDismissPopup(); 56 56 -
trunk/Source/WebCore/SourcesCocoa.txt
r276120 r276177 370 370 platform/graphics/cocoa/IntRectCocoa.mm 371 371 platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp 372 platform/graphics/cocoa/MediaPlaybackTargetContext.mm 372 373 platform/graphics/cocoa/RemoteGraphicsContextGLProxyBaseCocoa.mm 373 374 platform/graphics/cocoa/SourceBufferParser.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r276152 r276177 6982 6982 1D0026A82374F9D900CA6CDF /* JSEnterPictureInPictureEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEnterPictureInPictureEvent.h; sourceTree = "<group>"; }; 6983 6983 1D0026A92374F9D900CA6CDF /* JSEnterPictureInPictureEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEnterPictureInPictureEvent.cpp; sourceTree = "<group>"; }; 6984 1D008AA5262108C000EE3ADE /* MediaPlaybackTargetContext.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaPlaybackTargetContext.mm; sourceTree = "<group>"; }; 6984 6985 1D2C82B6236A3F6A0055D6C5 /* PictureInPictureSupport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PictureInPictureSupport.h; sourceTree = "<group>"; }; 6985 6986 1D47658D25CCA778007AF312 /* ImageDecoderIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageDecoderIdentifier.h; sourceTree = "<group>"; }; … … 26971 26972 07E3DFD01A9E786500764CA8 /* MediaPlaybackTarget.h */, 26972 26973 079216531AA560AA00A3C049 /* MediaPlaybackTargetClient.h */, 26973 07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */,26974 26974 078E43D71ABB6C7E001C2FA6 /* MediaPlaybackTargetPicker.cpp */, 26975 26975 078E43D81ABB6C7E001C2FA6 /* MediaPlaybackTargetPicker.h */, … … 27187 27187 CDC48AC82149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.cpp */, 27188 27188 CDC48AC72149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h */, 27189 07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */, 27190 1D008AA5262108C000EE3ADE /* MediaPlaybackTargetContext.mm */, 27189 27191 31647FA8251616BD0010F8FB /* OpenGLSoftLinkCocoa.h */, 27190 27192 31647FA9251616BD0010F8FB /* OpenGLSoftLinkCocoa.mm */, -
trunk/Source/WebCore/page/ChromeClient.h
r276120 r276177 514 514 virtual void playbackTargetPickerClientStateDidChange(PlaybackTargetClientContextIdentifier, MediaProducer::MediaStateFlags) { } 515 515 virtual void setMockMediaPlaybackTargetPickerEnabled(bool) { } 516 virtual void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext:: State) { }516 virtual void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext::MockState) { } 517 517 virtual void mockMediaPlaybackTargetPickerDismissPopup() { } 518 518 #endif -
trunk/Source/WebCore/page/Page.cpp
r276120 r276177 2953 2953 } 2954 2954 2955 void Page::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext:: State state)2955 void Page::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::MockState state) 2956 2956 { 2957 2957 chrome().client().setMockMediaPlaybackTargetPickerState(name, state); -
trunk/Source/WebCore/page/Page.h
r276120 r276177 732 732 void playbackTargetPickerClientStateDidChange(PlaybackTargetClientContextIdentifier, MediaProducer::MediaStateFlags); 733 733 WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerEnabled(bool); 734 WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext:: State);734 WEBCORE_EXPORT void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext::MockState); 735 735 WEBCORE_EXPORT void mockMediaPlaybackTargetPickerDismissPopup(); 736 736 -
trunk/Source/WebCore/platform/graphics/MediaPlaybackTarget.h
r276120 r276177 28 28 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 29 29 30 #include "MediaPlaybackTargetContext.h" 30 31 #include <wtf/Forward.h> 31 32 #include <wtf/RefCounted.h> … … 33 34 namespace WebCore { 34 35 35 class MediaPlaybackTargetContext;36 37 36 class MediaPlaybackTarget : public RefCounted<MediaPlaybackTarget> { 38 37 public: 39 38 virtual ~MediaPlaybackTarget() = default; 40 39 41 enum TargetType{ AVFoundation, Mock };40 enum class TargetType : uint8_t { AVFoundation, Mock }; 42 41 virtual TargetType targetType() const = 0; 42 virtual const MediaPlaybackTargetContext& targetContext() const = 0; 43 43 44 virtual const MediaPlaybackTargetContext& targetContext() const = 0; 45 virtual bool hasActiveRoute() const = 0; 46 virtual String deviceName() const = 0; 47 virtual bool supportsRemoteVideoPlayback() const = 0; 44 bool hasActiveRoute() const { return targetContext().hasActiveRoute(); } 45 String deviceName() const { return targetContext().deviceName(); } 46 bool supportsRemoteVideoPlayback() { return targetContext().supportsRemoteVideoPlayback(); } 48 47 }; 49 48 -
trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h
r276120 r276177 29 29 30 30 #include "MediaPlaybackTarget.h" 31 #include "MediaPlaybackTargetContext.h"32 31 #include <wtf/RetainPtr.h> 33 32 … … 37 36 public: 38 37 WEBCORE_EXPORT static Ref<MediaPlaybackTarget> create(AVOutputContext *); 38 WEBCORE_EXPORT static Ref<MediaPlaybackTarget> create(MediaPlaybackTargetContext&&); 39 39 40 40 #if PLATFORM(IOS_FAMILY) && !PLATFORM(IOS_FAMILY_SIMULATOR) && !PLATFORM(MACCATALYST) … … 44 44 virtual ~MediaPlaybackTargetCocoa(); 45 45 46 TargetType targetType() const final { return AVFoundation; } 47 48 const MediaPlaybackTargetContext& targetContext() const final; 49 bool hasActiveRoute() const final; 50 String deviceName() const final; 51 bool supportsRemoteVideoPlayback() const final; 52 53 AVOutputContext *outputContext() const { return m_outputContext.get(); } 46 TargetType targetType() const final { return TargetType::AVFoundation; } 47 const MediaPlaybackTargetContext& targetContext() const final { return m_context; } 54 48 55 49 protected: 56 MediaPlaybackTargetCocoa(AVOutputContext *); 50 explicit MediaPlaybackTargetCocoa(AVOutputContext *); 51 explicit MediaPlaybackTargetCocoa(MediaPlaybackTargetContext&&); 57 52 58 RetainPtr<AVOutputContext> m_outputContext; 59 mutable MediaPlaybackTargetContext m_context; 60 String m_deviceName; 53 MediaPlaybackTargetContext m_context; 61 54 }; 62 55 -
trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm
r276120 r276177 35 35 namespace WebCore { 36 36 37 Ref<MediaPlaybackTarget> MediaPlaybackTargetCocoa::create(AVOutputContext * context)37 Ref<MediaPlaybackTarget> MediaPlaybackTargetCocoa::create(AVOutputContext *outputContext) 38 38 { 39 return adoptRef(*new MediaPlaybackTargetCocoa( context));39 return adoptRef(*new MediaPlaybackTargetCocoa(outputContext)); 40 40 } 41 41 42 MediaPlaybackTargetCocoa::MediaPlaybackTargetCocoa(AVOutputContext *context) 43 : MediaPlaybackTarget() 44 , m_outputContext(context) 42 Ref<MediaPlaybackTarget> MediaPlaybackTargetCocoa::create(MediaPlaybackTargetContext&& context) 43 { 44 return adoptRef(*new MediaPlaybackTargetCocoa(WTFMove(context))); 45 } 46 47 MediaPlaybackTargetCocoa::MediaPlaybackTargetCocoa(AVOutputContext *outputContext) 48 : m_context(outputContext) 49 { 50 } 51 52 MediaPlaybackTargetCocoa::MediaPlaybackTargetCocoa(MediaPlaybackTargetContext&& context) 53 : m_context(WTFMove(context)) 45 54 { 46 55 } … … 54 63 #endif 55 64 56 bool MediaPlaybackTargetCocoa::supportsRemoteVideoPlayback() const57 {58 if (!m_outputContext)59 return false;60 61 if (![m_outputContext respondsToSelector:@selector(supportsMultipleOutputDevices)] || ![m_outputContext supportsMultipleOutputDevices] || ![m_outputContext respondsToSelector:@selector(outputDevices)]) {62 if (auto *outputDevice = [m_outputContext outputDevice]) {63 if (outputDevice.deviceFeatures & AVOutputDeviceFeatureVideo)64 return true;65 }66 67 return false;68 }69 70 for (AVOutputDevice *outputDevice in [m_outputContext outputDevices]) {71 if (outputDevice.deviceFeatures & AVOutputDeviceFeatureVideo)72 return true;73 }74 75 return false;76 }77 78 65 MediaPlaybackTargetCocoa::~MediaPlaybackTargetCocoa() 79 66 { 80 }81 82 const MediaPlaybackTargetContext& MediaPlaybackTargetCocoa::targetContext() const83 {84 m_context = MediaPlaybackTargetContext(m_outputContext.get());85 return m_context;86 }87 88 bool MediaPlaybackTargetCocoa::hasActiveRoute() const89 {90 if (!m_outputContext)91 return false;92 93 if ([m_outputContext respondsToSelector:@selector(supportsMultipleOutputDevices)] && [m_outputContext supportsMultipleOutputDevices] && [m_outputContext respondsToSelector:@selector(outputDevices)]) {94 for (AVOutputDevice *outputDevice in [m_outputContext outputDevices]) {95 if (outputDevice.deviceFeatures & (AVOutputDeviceFeatureVideo | AVOutputDeviceFeatureAudio))96 return true;97 }98 99 return false;100 }101 102 if ([m_outputContext respondsToSelector:@selector(outputDevice)]) {103 if (auto *outputDevice = [m_outputContext outputDevice])104 return outputDevice.deviceFeatures & (AVOutputDeviceFeatureVideo | AVOutputDeviceFeatureAudio);105 }106 107 return m_outputContext.get().deviceName;108 }109 110 String MediaPlaybackTargetCocoa::deviceName() const111 {112 if (!m_outputContext)113 return emptyString();114 115 if (![m_outputContext supportsMultipleOutputDevices])116 return [m_outputContext deviceName];117 118 auto outputDeviceNames = adoptNS([[NSMutableArray alloc] init]);119 for (AVOutputDevice *outputDevice in [m_outputContext outputDevices])120 [outputDeviceNames addObject:[outputDevice deviceName]];121 122 return [outputDeviceNames componentsJoinedByString:@" + "];123 67 } 124 68 … … 130 74 const MediaPlaybackTargetCocoa* toMediaPlaybackTargetCocoa(const MediaPlaybackTarget* rep) 131 75 { 132 ASSERT_WITH_SECURITY_IMPLICATION(rep->targetType() == MediaPlaybackTarget::AVFoundation);76 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(rep->targetType() == MediaPlaybackTarget::TargetType::AVFoundation); 133 77 return static_cast<const MediaPlaybackTargetCocoa*>(rep); 134 78 } -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r276120 r276177 2825 2825 #if !PLATFORM(IOS_FAMILY) 2826 2826 if (m_playbackTarget) { 2827 if (m_playbackTarget->targetType() == MediaPlaybackTarget:: AVFoundation)2827 if (m_playbackTarget->targetType() == MediaPlaybackTarget::TargetType::AVFoundation) 2828 2828 wirelessTarget = m_avPlayer && m_avPlayer.get().externalPlaybackActive; 2829 2829 else … … 2969 2969 m_playbackTarget = WTFMove(target); 2970 2970 2971 m_outputContext = m_playbackTarget->targetType() == MediaPlaybackTarget:: AVFoundation ? toMediaPlaybackTargetCocoa(m_playbackTarget.get())->outputContext() : nullptr;2971 m_outputContext = m_playbackTarget->targetType() == MediaPlaybackTarget::TargetType::AVFoundation ? toMediaPlaybackTargetCocoa(m_playbackTarget.get())->targetContext().outputContext() : nullptr; 2972 2972 2973 2973 INFO_LOG(LOGIDENTIFIER); … … 2989 2989 INFO_LOG(LOGIDENTIFIER, shouldPlay); 2990 2990 2991 if (m_playbackTarget->targetType() == MediaPlaybackTarget:: AVFoundation) {2991 if (m_playbackTarget->targetType() == MediaPlaybackTarget::TargetType::AVFoundation) { 2992 2992 AVOutputContext *newContext = shouldPlay ? m_outputContext.get() : nil; 2993 2993 … … 3006 3006 } 3007 3007 3008 ASSERT(m_playbackTarget->targetType() == MediaPlaybackTarget:: Mock);3008 ASSERT(m_playbackTarget->targetType() == MediaPlaybackTarget::TargetType::Mock); 3009 3009 3010 3010 setDelayCallbacks(true); -
trunk/Source/WebCore/platform/mock/MediaPlaybackTargetMock.cpp
r276120 r276177 31 31 namespace WebCore { 32 32 33 Ref<MediaPlaybackTarget> MediaPlaybackTargetMock::create(const String& name, MediaPlaybackTargetContext:: State state)33 Ref<MediaPlaybackTarget> MediaPlaybackTargetMock::create(const String& name, MediaPlaybackTargetContext::MockState state) 34 34 { 35 35 return adoptRef(*new MediaPlaybackTargetMock(name, state)); 36 36 } 37 37 38 MediaPlaybackTargetMock::MediaPlaybackTargetMock(const String& name, MediaPlaybackTargetContext::State state) 39 : MediaPlaybackTarget() 40 , m_name(name) 41 , m_state(state) 38 MediaPlaybackTargetMock::MediaPlaybackTargetMock(const String& name, MediaPlaybackTargetContext::MockState state) 39 : m_context(name, state) 42 40 { 43 41 } 44 42 45 43 MediaPlaybackTargetMock::~MediaPlaybackTargetMock() = default; 46 47 const MediaPlaybackTargetContext& MediaPlaybackTargetMock::targetContext() const48 {49 m_context = MediaPlaybackTargetContext(m_name, m_state);50 return m_context;51 }52 44 53 45 MediaPlaybackTargetMock* toMediaPlaybackTargetMock(MediaPlaybackTarget* rep) … … 58 50 const MediaPlaybackTargetMock* toMediaPlaybackTargetMock(const MediaPlaybackTarget* rep) 59 51 { 60 ASSERT_WITH_SECURITY_IMPLICATION(rep->targetType() == MediaPlaybackTarget::Mock);52 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(rep->targetType() == MediaPlaybackTarget::TargetType::Mock); 61 53 return static_cast<const MediaPlaybackTargetMock*>(rep); 62 54 } -
trunk/Source/WebCore/platform/mock/MediaPlaybackTargetMock.h
r276120 r276177 24 24 */ 25 25 26 #ifndef MediaPlaybackTargetMock_h 27 #define MediaPlaybackTargetMock_h 26 #pragma once 28 27 29 28 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY) 30 29 31 30 #include "MediaPlaybackTarget.h" 32 #include "MediaPlaybackTargetContext.h"33 31 #include <wtf/text/WTFString.h> 34 32 … … 37 35 class MediaPlaybackTargetMock : public MediaPlaybackTarget { 38 36 public: 39 WEBCORE_EXPORT static Ref<MediaPlaybackTarget> create(const String&, MediaPlaybackTargetContext:: State);37 WEBCORE_EXPORT static Ref<MediaPlaybackTarget> create(const String&, MediaPlaybackTargetContext::MockState); 40 38 41 39 virtual ~MediaPlaybackTargetMock(); 42 40 43 TargetType targetType() const final { return Mock; } 41 TargetType targetType() const final { return MediaPlaybackTarget::TargetType::Mock; } 42 const MediaPlaybackTargetContext& targetContext() const final { return m_context; } 44 43 45 const MediaPlaybackTargetContext& targetContext() const final; 46 47 bool hasActiveRoute() const final { return !m_name.isEmpty(); } 48 bool supportsRemoteVideoPlayback() const final { return !m_name.isEmpty(); } 49 50 String deviceName() const final { return m_name; } 51 52 MediaPlaybackTargetContext::State state() const; 44 MediaPlaybackTargetContext::MockState state() const { return m_context.mockState(); } 53 45 54 46 protected: 55 MediaPlaybackTargetMock(const String&, MediaPlaybackTargetContext:: State);47 MediaPlaybackTargetMock(const String&, MediaPlaybackTargetContext::MockState); 56 48 57 String m_name; 58 MediaPlaybackTargetContext::State m_state { MediaPlaybackTargetContext::Unknown }; 59 mutable MediaPlaybackTargetContext m_context; 49 MediaPlaybackTargetContext m_context; 60 50 }; 61 51 … … 66 56 67 57 #endif // ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY) 68 69 #endif -
trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.cpp
r276120 r276177 53 53 { 54 54 LOG(Media, "MediaPlaybackTargetPickerMock::externalOutputDeviceAvailable"); 55 return m_state == MediaPlaybackTargetContext:: OutputDeviceAvailable;55 return m_state == MediaPlaybackTargetContext::MockState::OutputDeviceAvailable; 56 56 } 57 57 … … 86 86 87 87 m_taskQueue.enqueueTask([this] { 88 if (m_state == MediaPlaybackTargetContext:: OutputDeviceAvailable)88 if (m_state == MediaPlaybackTargetContext::MockState::OutputDeviceAvailable) 89 89 availableDevicesDidChange(); 90 90 91 if (!m_deviceName.isEmpty() && m_state != MediaPlaybackTargetContext:: Unknown)91 if (!m_deviceName.isEmpty() && m_state != MediaPlaybackTargetContext::MockState::Unknown) 92 92 currentDeviceDidChange(); 93 93 }); … … 102 102 { 103 103 LOG(Media, "MediaPlaybackTargetPickerMock::invalidatePlaybackTargets"); 104 setState(emptyString(), MediaPlaybackTargetContext:: Unknown);104 setState(emptyString(), MediaPlaybackTargetContext::MockState::Unknown); 105 105 } 106 106 107 void MediaPlaybackTargetPickerMock::setState(const String& deviceName, MediaPlaybackTargetContext:: State state)107 void MediaPlaybackTargetPickerMock::setState(const String& deviceName, MediaPlaybackTargetContext::MockState state) 108 108 { 109 109 LOG(Media, "MediaPlaybackTargetPickerMock::setState - name = %s, state = 0x%x", deviceName.utf8().data(), (unsigned)state); 110 110 111 111 m_taskQueue.enqueueTask([this, state, deviceName] { 112 if (deviceName != m_deviceName && state != MediaPlaybackTargetContext:: Unknown) {112 if (deviceName != m_deviceName && state != MediaPlaybackTargetContext::MockState::Unknown) { 113 113 m_deviceName = deviceName; 114 114 currentDeviceDidChange(); -
trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.h
r276120 r276177 49 49 void invalidatePlaybackTargets() override; 50 50 51 void setState(const String&, MediaPlaybackTargetContext:: State);51 void setState(const String&, MediaPlaybackTargetContext::MockState); 52 52 void dismissPopup(); 53 53 … … 58 58 String m_deviceName; 59 59 GenericTaskQueue<Timer> m_taskQueue; 60 MediaPlaybackTargetContext:: State m_state { MediaPlaybackTargetContext::Unknown };60 MediaPlaybackTargetContext::MockState m_state { MediaPlaybackTargetContext::MockState::Unknown }; 61 61 bool m_showingMenu { false }; 62 62 }; -
trunk/Source/WebCore/testing/Internals.cpp
r276120 r276177 560 560 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 561 561 page.setMockMediaPlaybackTargetPickerEnabled(true); 562 page.setMockMediaPlaybackTargetPickerState(emptyString(), MediaPlaybackTargetContext:: Unknown);562 page.setMockMediaPlaybackTargetPickerState(emptyString(), MediaPlaybackTargetContext::MockState::Unknown); 563 563 #endif 564 564 … … 4532 4532 ASSERT(page); 4533 4533 4534 MediaPlaybackTargetContext:: State state = MediaPlaybackTargetContext::Unknown;4534 MediaPlaybackTargetContext::MockState state = MediaPlaybackTargetContext::MockState::Unknown; 4535 4535 4536 4536 if (equalLettersIgnoringASCIICase(deviceState, "deviceavailable")) 4537 state = MediaPlaybackTargetContext:: OutputDeviceAvailable;4537 state = MediaPlaybackTargetContext::MockState::OutputDeviceAvailable; 4538 4538 else if (equalLettersIgnoringASCIICase(deviceState, "deviceunavailable")) 4539 state = MediaPlaybackTargetContext:: OutputDeviceUnavailable;4539 state = MediaPlaybackTargetContext::MockState::OutputDeviceUnavailable; 4540 4540 else if (equalLettersIgnoringASCIICase(deviceState, "unknown")) 4541 state = MediaPlaybackTargetContext:: Unknown;4541 state = MediaPlaybackTargetContext::MockState::Unknown; 4542 4542 else 4543 4543 return Exception { InvalidAccessError }; -
trunk/Source/WebKit/ChangeLog
r276164 r276177 1 2021-04-16 Peng Liu <peng.liu6@apple.com> 2 3 [GPUP] WebContent process should not create AVOutputContext instances when media in GPU Process is enabled 4 https://bugs.webkit.org/show_bug.cgi?id=224469 5 6 Reviewed by Eric Carlson. 7 8 * Scripts/webkit/messages.py: Fix clean build failures on the WinCairo port. 9 10 * GPUProcess/media/RemoteMediaPlayerProxy.cpp: 11 (WebKit::RemoteMediaPlayerProxy::setWirelessPlaybackTarget): 12 * GPUProcess/media/RemoteMediaPlayerProxy.h: 13 14 * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp: 15 (WebKit::RemoteMediaSessionHelperProxy::activeVideoRouteDidChange): 16 17 * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: 18 (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData): 19 (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData): 20 * Shared/WebCoreArgumentCoders.cpp: 21 (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encode): 22 (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decode): 23 * Shared/WebCoreArgumentCoders.h: 24 * Shared/mac/WebCoreArgumentCodersMac.mm: 25 (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData): Deleted. 26 (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData): Deleted. 27 28 * UIProcess/WebPageProxy.cpp: 29 (WebKit::mediaRelatedIOKitClasses): 30 (WebKit::WebPageProxy::creationParameters): 31 (WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerState): 32 (WebKit::WebPageProxy::setPlaybackTarget): 33 (WebKit::temporaryMachServices): Deleted. 34 * UIProcess/WebPageProxy.h: 35 * UIProcess/WebPageProxy.messages.in: 36 37 * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp: 38 (WebKit::RemoteMediaSessionHelper::activeVideoRouteDidChange): 39 40 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 41 (WebKit::WebChromeClient::setMockMediaPlaybackTargetPickerState): 42 * WebProcess/WebCoreSupport/WebChromeClient.h: 43 44 * WebProcess/WebPage/WebPage.h: 45 * WebProcess/WebPage/mac/WebPageMac.mm: 46 (WebKit::WebPage::playbackTargetSelected const): 47 1 48 2021-04-16 Alex Christensen <achristensen@webkit.org> 2 49 -
trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp
r276120 r276177 60 60 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 61 61 #include <WebCore/MediaPlaybackTargetCocoa.h> 62 #include <WebCore/MediaPlaybackTargetContext.h> 62 63 #include <WebCore/MediaPlaybackTargetMock.h> 63 64 #endif … … 698 699 } 699 700 700 void RemoteMediaPlayerProxy::setWirelessPlaybackTarget( const WebCore::MediaPlaybackTargetContext& targetContext)701 void RemoteMediaPlayerProxy::setWirelessPlaybackTarget(MediaPlaybackTargetContext&& targetContext) 701 702 { 702 703 switch (targetContext.type()) { 703 case MediaPlaybackTargetContext::AVOutputContextType: 704 m_player->setWirelessPlaybackTarget(WebCore::MediaPlaybackTargetCocoa::create(targetContext.avOutputContext())); 704 case MediaPlaybackTargetContext::Type::SerializedAVOutputContext: { 705 if (targetContext.deserializeOutputContext()) 706 m_player->setWirelessPlaybackTarget(MediaPlaybackTargetCocoa::create(WTFMove(targetContext))); 705 707 break; 708 } 709 case MediaPlaybackTargetContext::Type::Mock: 706 710 #if PLATFORM(MAC) 707 case MediaPlaybackTargetContext::MockType: 708 m_player->setWirelessPlaybackTarget(WebCore::MediaPlaybackTargetMock::create(targetContext.mockDeviceName(), targetContext.mockState())); 711 m_player->setWirelessPlaybackTarget(MediaPlaybackTargetMock::create(targetContext.deviceName(), targetContext.mockState())); 709 712 break; 710 #else 711 case MediaPlaybackTargetContext::MockType: 712 #endif 713 case MediaPlaybackTargetContext::None: 713 #endif 714 case MediaPlaybackTargetContext::Type::AVOutputContext: 715 case MediaPlaybackTargetContext::Type::None: 714 716 ASSERT_NOT_REACHED(); 715 717 break; -
trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h
r276120 r276177 153 153 void setWirelessVideoPlaybackDisabled(bool); 154 154 void setShouldPlayToPlaybackTarget(bool); 155 void setWirelessPlaybackTarget( const WebCore::MediaPlaybackTargetContext&);155 void setWirelessPlaybackTarget(WebCore::MediaPlaybackTargetContext&&); 156 156 void mediaPlayerCurrentPlaybackTargetIsWirelessChanged(bool) final; 157 157 #endif -
trunk/Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp
r276120 r276177 109 109 void RemoteMediaSessionHelperProxy::activeVideoRouteDidChange(SupportsAirPlayVideo supportsAirPlayVideo, Ref<WebCore::MediaPlaybackTarget>&& target) 110 110 { 111 m_gpuConnection.connection().send(Messages::RemoteMediaSessionHelper::ActiveVideoRouteDidChange(supportsAirPlayVideo, target->targetContext()), { }); 111 auto context = target->targetContext(); 112 if (!context.serializeOutputContext()) 113 return; 114 115 m_gpuConnection.connection().send(Messages::RemoteMediaSessionHelper::ActiveVideoRouteDidChange(supportsAirPlayVideo, context), { }); 112 116 } 113 117 -
trunk/Source/WebKit/Scripts/webkit/messages.py
r275835 r276177 353 353 '"LayerHostingContext.h"': ["PLATFORM(COCOA)", ], 354 354 '"GestureTypes.h"': ["PLATFORM(IOS_FAMILY)"], 355 '<WebCore/MediaPlaybackTargetContext.h>': ["ENABLE(WIRELESS_PLAYBACK_TARGET)"], 355 356 } 356 357 if not header in conditions: -
trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm
r276120 r276177 42 42 #endif 43 43 44 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 45 #import <WebCore/MediaPlaybackTargetContext.h> 46 #import <objc/runtime.h> 47 #endif 48 49 #if USE(APPLE_INTERNAL_SDK) 50 #include <WebKitAdditions/WebCoreArgumentCodersCocoaAdditions.mm> 51 #endif 52 44 53 #if ENABLE(APPLE_PAY) 45 54 #import "DataReference.h" … … 48 57 #endif 49 58 50 #if USE(APPLE_INTERNAL_SDK)51 #i nclude <WebKitAdditions/WebCoreArgumentCodersCocoaAdditions.mm>59 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 60 #import <pal/cocoa/AVFoundationSoftLink.h> 52 61 #endif 53 62 … … 607 616 } 608 617 618 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 619 void ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData(Encoder& encoder, const MediaPlaybackTargetContext& target) 620 { 621 if (target.type() == MediaPlaybackTargetContext::Type::AVOutputContext) { 622 if ([PAL::getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)]) 623 encoder << target.outputContext(); 624 } else if (target.type() == MediaPlaybackTargetContext::Type::SerializedAVOutputContext) { 625 encoder << target.serializedOutputContext(); 626 encoder << target.hasActiveRoute(); 627 } else 628 ASSERT_NOT_REACHED(); 629 } 630 631 bool ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData(Decoder& decoder, MediaPlaybackTargetContext::Type contextType, MediaPlaybackTargetContext& target) 632 { 633 ASSERT(contextType != MediaPlaybackTargetContext::Type::Mock); 634 635 if (contextType == MediaPlaybackTargetContext::Type::AVOutputContext) { 636 if (![PAL::getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)]) 637 return false; 638 639 auto outputContext = IPC::decode<AVOutputContext>(decoder, PAL::getAVOutputContextClass()); 640 if (!outputContext) 641 return false; 642 643 target = WebCore::MediaPlaybackTargetContext { WTFMove(*outputContext) }; 644 return true; 645 } 646 647 if (contextType == MediaPlaybackTargetContext::Type::SerializedAVOutputContext) { 648 RetainPtr<NSData> serializedOutputContext; 649 if (!IPC::decode(decoder, serializedOutputContext) || !serializedOutputContext) 650 return false; 651 652 bool hasActiveRoute; 653 if (!decoder.decode(hasActiveRoute)) 654 return false; 655 656 target = WebCore::MediaPlaybackTargetContext { WTFMove(serializedOutputContext), hasActiveRoute }; 657 return true; 658 } 659 660 return false; 661 } 662 #endif 663 609 664 } // namespace IPC -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
r276120 r276177 2458 2458 encoder << hasPlatformData; 2459 2459 2460 int32_t targetType = target.type();2461 encoder << targetType;2460 MediaPlaybackTargetContext::Type contextType = target.type(); 2461 encoder << contextType; 2462 2462 2463 2463 if (target.encodingRequiresPlatformData()) { … … 2466 2466 } 2467 2467 2468 ASSERT( targetType == MediaPlaybackTargetContext::MockType);2469 encoder << target. mockDeviceName();2470 encoder << static_cast<int32_t>(target.mockState());2468 ASSERT(contextType == MediaPlaybackTargetContext::Type::Mock); 2469 encoder << target.deviceName(); 2470 encoder << target.mockState(); 2471 2471 } 2472 2472 … … 2477 2477 return false; 2478 2478 2479 int32_t targetType;2480 if (!decoder.decode( targetType))2479 MediaPlaybackTargetContext::Type contextType; 2480 if (!decoder.decode(contextType)) 2481 2481 return false; 2482 2482 2483 2483 if (hasPlatformData) 2484 return decodePlatformData(decoder, target); 2485 2486 ASSERT(targetType == MediaPlaybackTargetContext::MockType); 2487 2488 String mockDeviceName; 2489 if (!decoder.decode(mockDeviceName)) 2490 return false; 2491 2492 int32_t mockState; 2484 return decodePlatformData(decoder, contextType, target); 2485 2486 ASSERT(contextType == MediaPlaybackTargetContext::Type::Mock); 2487 String deviceName; 2488 if (!decoder.decode(deviceName)) 2489 return false; 2490 2491 MediaPlaybackTargetContext::MockState mockState; 2493 2492 if (!decoder.decode(mockState)) 2494 2493 return false; 2495 2494 2496 target = MediaPlaybackTargetContext(mockDeviceName, static_cast<MediaPlaybackTargetContext::State>(mockState)); 2495 target = MediaPlaybackTargetContext(deviceName, mockState); 2496 2497 2497 return true; 2498 2498 } -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h
r276120 r276177 53 53 #if USE(CURL) 54 54 #include <WebCore/CurlProxySettings.h> 55 #endif 56 57 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 58 #include <WebCore/MediaPlaybackTargetContext.h> 55 59 #endif 56 60 … … 196 200 #endif 197 201 198 #if ENABLE(WIRELESS_PLAYBACK_TARGET)199 class MediaPlaybackTargetContext;200 #endif201 202 202 #if ENABLE(MEDIA_STREAM) 203 203 struct MediaConstraints; … … 645 645 static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::MediaPlaybackTargetContext&); 646 646 static void encodePlatformData(Encoder&, const WebCore::MediaPlaybackTargetContext&); 647 static WARN_UNUSED_RETURN bool decodePlatformData(Decoder&, WebCore::MediaPlaybackTargetContext &);647 static WARN_UNUSED_RETURN bool decodePlatformData(Decoder&, WebCore::MediaPlaybackTargetContext::Type, WebCore::MediaPlaybackTargetContext&); 648 648 }; 649 649 #endif -
trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm
r276120 r276177 43 43 #import <wtf/cf/TypeCastsCF.h> 44 44 45 #if ENABLE(WIRELESS_PLAYBACK_TARGET)46 #import <WebCore/MediaPlaybackTargetContext.h>47 #import <objc/runtime.h>48 #import <pal/cocoa/AVFoundationSoftLink.h>49 #endif50 51 45 namespace IPC { 52 46 … … 404 398 #endif 405 399 406 #if ENABLE(WIRELESS_PLAYBACK_TARGET)407 408 void ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData(Encoder& encoder, const WebCore::MediaPlaybackTargetContext& target)409 {410 if ([PAL::getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])411 encoder << target.avOutputContext();412 }413 414 bool ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData(Decoder& decoder, WebCore::MediaPlaybackTargetContext& target)415 {416 if (![PAL::getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])417 return false;418 419 auto context = IPC::decode<AVOutputContext>(decoder, PAL::getAVOutputContextClass());420 if (!context)421 return false;422 423 target = WebCore::MediaPlaybackTargetContext { context->get() };424 return true;425 }426 427 #endif428 429 400 #if ENABLE(VIDEO) 430 401 void ArgumentCoder<WebCore::SerializedPlatformDataCueValue>::encodePlatformData(Encoder& encoder, const WebCore::SerializedPlatformDataCueValue& value) -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r276148 r276177 7845 7845 return services; 7846 7846 } 7847 7848 static const Vector<ASCIILiteral>& temporaryMachServices()7849 {7850 static const auto services = makeNeverDestroyed(Vector<ASCIILiteral> {7851 "com.apple.coremedia.routingcontext.xpc"_s // Remove after <rdar://76403302> is fixed.7852 });7853 return services;7854 }7855 7847 #endif 7856 7848 … … 7948 7940 parameters.mediaExtensionHandles = SandboxExtension::createHandlesForMachLookup(mediaRelatedMachServices(), WTF::nullopt); 7949 7941 parameters.mediaIOKitExtensionHandles = SandboxExtension::createHandlesForIOKitClassExtensions(mediaRelatedIOKitClasses(), WTF::nullopt); 7950 } else {7951 // FIXME(224327): Remove this else clause once <rdar://76403302> is fixed.7952 parameters.mediaExtensionHandles = SandboxExtension::createHandlesForMachLookup(temporaryMachServices(), WTF::nullopt);7953 7942 } 7954 7943 … … 9416 9405 } 9417 9406 9418 void WebPageProxy::setMockMediaPlaybackTargetPickerState(const String& name, WebCore::MediaPlaybackTargetContext:: State state)9407 void WebPageProxy::setMockMediaPlaybackTargetPickerState(const String& name, WebCore::MediaPlaybackTargetContext::MockState state) 9419 9408 { 9420 9409 pageClient().mediaSessionManager().setMockMediaPlaybackTargetPickerState(name, state); … … 9431 9420 return; 9432 9421 9433 send(Messages::WebPage::PlaybackTargetSelected(contextId, target->targetContext())); 9422 auto context = target->targetContext(); 9423 ASSERT(context.type() != MediaPlaybackTargetContext::Type::SerializedAVOutputContext); 9424 if (preferences().useGPUProcessForMediaEnabled()) 9425 context.serializeOutputContext(); 9426 9427 send(Messages::WebPage::PlaybackTargetSelected(contextId, context)); 9434 9428 } 9435 9429 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r276148 r276177 95 95 #include <WebCore/LayoutSize.h> 96 96 #include <WebCore/MediaControlsContextMenuItem.h> 97 #include <WebCore/MediaPlaybackTargetContext.h>98 97 #include <WebCore/MediaProducer.h> 99 98 #include <WebCore/PageIdentifier.h> … … 129 128 #include <wtf/Vector.h> 130 129 #include <wtf/text/WTFString.h> 130 131 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 132 #include <WebCore/MediaPlaybackTargetContext.h> 133 #endif 131 134 132 135 #if PLATFORM(IOS_FAMILY) … … 1568 1571 void playbackTargetPickerClientStateDidChange(WebCore::PlaybackTargetClientContextIdentifier, WebCore::MediaProducer::MediaStateFlags); 1569 1572 void setMockMediaPlaybackTargetPickerEnabled(bool); 1570 void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext:: State);1573 void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::MockState); 1571 1574 void mockMediaPlaybackTargetPickerDismissPopup(); 1572 1575 -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r276120 r276177 477 477 PlaybackTargetPickerClientStateDidChange(WebCore::PlaybackTargetClientContextIdentifier contextId, unsigned mediaState) 478 478 SetMockMediaPlaybackTargetPickerEnabled(bool enabled) 479 SetMockMediaPlaybackTargetPickerState(String name, unsignedpickerState)479 SetMockMediaPlaybackTargetPickerState(String name, enum:uint8_t WebCore::MediaPlaybackTargetContext::MockState pickerState) 480 480 MockMediaPlaybackTargetPickerDismissPopup() 481 481 #endif -
trunk/Source/WebKit/WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp
r276120 r276177 82 82 void RemoteMediaSessionHelper::activeVideoRouteDidChange(SupportsAirPlayVideo supportsAirPlayVideo, MediaPlaybackTargetContext&& targetContext) 83 83 { 84 if (targetContext.type() != MediaPlaybackTargetContext::AVOutputContextType) {85 ASSERT_NOT_REACHED();84 ASSERT(targetContext.type() != MediaPlaybackTargetContext::Type::AVOutputContext); 85 if (targetContext.type() == MediaPlaybackTargetContext::Type::AVOutputContext) 86 86 return; 87 }88 87 89 WebCore::MediaSessionHelper::activeVideoRouteDidChange(supportsAirPlayVideo, WebCore::MediaPlaybackTargetCocoa::create( targetContext.avOutputContext()));88 WebCore::MediaSessionHelper::activeVideoRouteDidChange(supportsAirPlayVideo, WebCore::MediaPlaybackTargetCocoa::create(WTFMove(targetContext))); 90 89 } 91 90 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r276120 r276177 1353 1353 } 1354 1354 1355 void WebChromeClient::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext:: State state)1355 void WebChromeClient::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::MockState state) 1356 1356 { 1357 1357 m_page.send(Messages::WebPageProxy::SetMockMediaPlaybackTargetPickerState(name, state)); -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
r276120 r276177 379 379 void playbackTargetPickerClientStateDidChange(WebCore::PlaybackTargetClientContextIdentifier, WebCore::MediaProducer::MediaStateFlags) final; 380 380 void setMockMediaPlaybackTargetPickerEnabled(bool) final; 381 void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext:: State) final;381 void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::MockState) final; 382 382 void mockMediaPlaybackTargetPickerDismissPopup() final; 383 383 #endif -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r276120 r276177 1792 1792 1793 1793 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY) 1794 void playbackTargetSelected(WebCore::PlaybackTargetClientContextIdentifier, const WebCore::MediaPlaybackTargetContext& outputDevice) const;1794 void playbackTargetSelected(WebCore::PlaybackTargetClientContextIdentifier, WebCore::MediaPlaybackTargetContext&&) const; 1795 1795 void playbackTargetAvailabilityDidChange(WebCore::PlaybackTargetClientContextIdentifier, bool); 1796 1796 void setShouldPlayToPlaybackTarget(WebCore::PlaybackTargetClientContextIdentifier, bool); -
trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
r276120 r276177 36 36 #import "FrameInfoData.h" 37 37 #import "InjectedBundleHitTestResult.h" 38 #import "PDFKitSoftLink.h"39 38 #import "PDFPlugin.h" 40 39 #import "PageBanner.h" … … 100 99 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 101 100 #import <WebCore/MediaPlaybackTargetCocoa.h> 101 #import <WebCore/MediaPlaybackTargetContext.h> 102 102 #import <WebCore/MediaPlaybackTargetMock.h> 103 103 #endif 104 105 #import "PDFKitSoftLink.h" 104 106 105 107 namespace WebKit { … … 1043 1045 1044 1046 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY) 1045 void WebPage::playbackTargetSelected(PlaybackTargetClientContextIdentifier contextId, const WebCore::MediaPlaybackTargetContext& targetContext) const1047 void WebPage::playbackTargetSelected(PlaybackTargetClientContextIdentifier contextId, WebCore::MediaPlaybackTargetContext&& targetContext) const 1046 1048 { 1047 1049 switch (targetContext.type()) { 1048 case MediaPlaybackTargetContext::AVOutputContextType: 1049 m_page->setPlaybackTarget(contextId, WebCore::MediaPlaybackTargetCocoa::create(targetContext.avOutputContext())); 1050 case MediaPlaybackTargetContext::Type::AVOutputContext: 1051 case MediaPlaybackTargetContext::Type::SerializedAVOutputContext: 1052 m_page->setPlaybackTarget(contextId, MediaPlaybackTargetCocoa::create(WTFMove(targetContext))); 1050 1053 break; 1051 case MediaPlaybackTargetContext:: MockType:1052 m_page->setPlaybackTarget(contextId, WebCore::MediaPlaybackTargetMock::create(targetContext.mockDeviceName(), targetContext.mockState()));1054 case MediaPlaybackTargetContext::Type::Mock: 1055 m_page->setPlaybackTarget(contextId, MediaPlaybackTargetMock::create(targetContext.deviceName(), targetContext.mockState())); 1053 1056 break; 1054 case MediaPlaybackTargetContext:: None:1057 case MediaPlaybackTargetContext::Type::None: 1055 1058 ASSERT_NOT_REACHED(); 1056 1059 break; -
trunk/Source/WebKitLegacy/mac/ChangeLog
r276120 r276177 1 2021-04-16 Peng Liu <peng.liu6@apple.com> 2 3 [GPUP] WebContent process should not create AVOutputContext instances when media in GPU Process is enabled 4 https://bugs.webkit.org/show_bug.cgi?id=224469 5 6 Reviewed by Eric Carlson. 7 8 * WebCoreSupport/WebChromeClient.h: 9 * WebCoreSupport/WebChromeClient.mm: 10 (WebChromeClient::setMockMediaPlaybackTargetPickerState): 11 * WebView/WebMediaPlaybackTargetPicker.h: 12 * WebView/WebMediaPlaybackTargetPicker.mm: 13 (WebMediaPlaybackTargetPicker::setMockMediaPlaybackTargetPickerState): 14 * WebView/WebView.mm: 15 (-[WebView _setMockMediaPlaybackTargetPickerName:state:]): 16 * WebView/WebViewInternal.h: 17 1 18 2021-04-15 Commit Queue <commit-queue@webkit.org> 2 19 -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h
r276120 r276177 244 244 void playbackTargetPickerClientStateDidChange(WebCore::PlaybackTargetClientContextIdentifier, WebCore::MediaProducer::MediaStateFlags) final; 245 245 void setMockMediaPlaybackTargetPickerEnabled(bool) final; 246 void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext:: State) final;246 void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::MockState) final; 247 247 void mockMediaPlaybackTargetPickerDismissPopup() override; 248 248 #endif -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm
r276120 r276177 1130 1130 } 1131 1131 1132 void WebChromeClient::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext:: State state)1132 void WebChromeClient::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::MockState state) 1133 1133 { 1134 1134 [m_webView _setMockMediaPlaybackTargetPickerName:name state:state]; -
trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.h
r276120 r276177 54 54 void playbackTargetPickerClientStateDidChange(WebCore::PlaybackTargetClientContextIdentifier, WebCore::MediaProducer::MediaStateFlags); 55 55 void setMockMediaPlaybackTargetPickerEnabled(bool); 56 void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext:: State);56 void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::MockState); 57 57 void mockMediaPlaybackTargetPickerDismissPopup(); 58 58 -
trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.mm
r276120 r276177 69 69 } 70 70 71 void WebMediaPlaybackTargetPicker::setMockMediaPlaybackTargetPickerState(const String& name, WebCore::MediaPlaybackTargetContext:: State state)71 void WebMediaPlaybackTargetPicker::setMockMediaPlaybackTargetPickerState(const String& name, WebCore::MediaPlaybackTargetContext::MockState state) 72 72 { 73 73 WebCore::WebMediaSessionManager::shared().setMockMediaPlaybackTargetPickerState(name, state); -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r276120 r276177 9233 9233 } 9234 9234 9235 - (void)_setMockMediaPlaybackTargetPickerName:(NSString *)name state:(WebCore::MediaPlaybackTargetContext:: State)state9235 - (void)_setMockMediaPlaybackTargetPickerName:(NSString *)name state:(WebCore::MediaPlaybackTargetContext::MockState)state 9236 9236 { 9237 9237 [self _devicePicker]->setMockMediaPlaybackTargetPickerState(name, state); -
trunk/Source/WebKitLegacy/mac/WebView/WebViewInternal.h
r276120 r276177 328 328 - (void)_playbackTargetPickerClientStateDidChange:(WebCore::PlaybackTargetClientContextIdentifier)contextId state:(WebCore::MediaProducer::MediaStateFlags)state; 329 329 - (void)_setMockMediaPlaybackTargetPickerEnabled:(bool)enabled; 330 - (void)_setMockMediaPlaybackTargetPickerName:(NSString *)name state:(WebCore::MediaPlaybackTargetContext:: State)state;330 - (void)_setMockMediaPlaybackTargetPickerName:(NSString *)name state:(WebCore::MediaPlaybackTargetContext::MockState)state; 331 331 - (void)_mockMediaPlaybackTargetPickerDismissPopup; 332 332 #endif
Note:
See TracChangeset
for help on using the changeset viewer.