Changeset 289696 in webkit
- Timestamp:
- Feb 12, 2022 8:08:49 AM (5 months ago)
- Location:
- trunk/Source
- Files:
-
- 3 added
- 17 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/PlatformHave.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/PAL/ChangeLog (modified) (1 diff)
-
WebCore/PAL/PAL.xcodeproj/project.pbxproj (modified) (4 diffs)
-
WebCore/PAL/pal/mac/ScreenCaptureKitSoftLink.h (modified) (1 diff)
-
WebCore/PAL/pal/mac/ScreenCaptureKitSoftLink.mm (modified) (1 diff)
-
WebCore/PAL/pal/spi/mac/ScreenCaptureKitSPI.h (added)
-
WebCore/SourcesCocoa.txt (modified) (1 diff)
-
WebCore/WebCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
WebCore/en.lproj/Localizable.strings (modified) (1 diff)
-
WebCore/platform/mediastream/cocoa/DisplayCaptureSourceCocoa.cpp (modified) (1 diff)
-
WebCore/platform/mediastream/cocoa/DisplayCaptureSourceCocoa.h (modified) (3 diffs)
-
WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.h (modified) (3 diffs)
-
WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.mm (modified) (9 diffs)
-
WebCore/platform/mediastream/mac/ScreenCaptureKitSharingSessionManager.h (added)
-
WebCore/platform/mediastream/mac/ScreenCaptureKitSharingSessionManager.mm (added)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Platform/spi/Cocoa/SafeBrowsingSPI.h (modified) (1 diff)
-
WebKit/UIProcess/mac/DisplayCaptureSessionManager.mm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r289683 r289696 1 2022-02-12 Eric Carlson <eric.carlson@apple.com> 2 3 [macOS] Use system window and screen picker when available 4 https://bugs.webkit.org/show_bug.cgi?id=236531 5 rdar://87111816 6 7 Reviewed by Jer Noble. 8 9 * wtf/PlatformHave.h: Define HAVE_SC_CONTENT_SHARING_SESSION. 10 1 11 2022-02-11 Nikolaos Mouchtaris <nmouchtaris@apple.com> 2 12 -
trunk/Source/WTF/wtf/PlatformHave.h
r289681 r289696 1147 1147 #endif 1148 1148 1149 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000) 1150 #define HAVE_SC_CONTENT_SHARING_SESSION 1 1151 #endif 1152 1149 1153 #if ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000) \ 1150 1154 || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 160000)) -
trunk/Source/WebCore/ChangeLog
r289693 r289696 1 2022-02-12 Eric Carlson <eric.carlson@apple.com> 2 3 [macOS] Use system window and screen picker when available 4 https://bugs.webkit.org/show_bug.cgi?id=236531 5 rdar://87111816 6 7 Reviewed by Jer Noble. 8 9 Tested manually. 10 11 * SourcesCocoa.txt: Add new files. 12 * WebCore.xcodeproj/project.pbxproj: Ditto. 13 14 * en.lproj/Localizable.strings: Update prompts. 15 16 * platform/mediastream/cocoa/DisplayCaptureSourceCocoa.cpp: 17 (WebCore::DisplayCaptureSourceCocoa::capturerConfigurationChanged): Allow a capturer 18 to notify the source of a configuration change. 19 * platform/mediastream/cocoa/DisplayCaptureSourceCocoa.h: 20 (WebCore::CapturerObserver::capturerConfigurationChanged): 21 22 * platform/mediastream/mac/ScreenCaptureKitCaptureSource.h: 23 * platform/mediastream/mac/ScreenCaptureKitCaptureSource.mm: 24 (-[WebCoreScreenCaptureKitHelper stream:didStopWithError:]): Forward delegate callbacks 25 to the capture source. 26 (-[WebCoreScreenCaptureKitHelper sessionDidEnd:]): Ditto. 27 (-[WebCoreScreenCaptureKitHelper sessionDidChangeContent:]): Ditto. 28 (-[WebCoreScreenCaptureKitHelper pickerCanceledForSession:]): Ditto. 29 (WebCore::ScreenCaptureKitCaptureSource::sessionDidChangeContent): React to a 30 reconfiguration. 31 (WebCore::ScreenCaptureKitCaptureSource::sessionDidEnd): 32 (WebCore::ScreenCaptureKitCaptureSource::startContentStream): Use the sharing 33 session manager when available. 34 (WebCore::ScreenCaptureKitCaptureSource::intrinsicSize const): Get the size from 35 the content when possible. 36 37 * platform/mediastream/mac/ScreenCaptureKitSharingSessionManager.h: Added. 38 (WebCore::ScreenCaptureKitSharingSessionManager::SharingSessionObserver::operator== const): 39 * platform/mediastream/mac/ScreenCaptureKitSharingSessionManager.mm: Added. 40 (-[WebDisplayMediaPromptHelper initWithCallback:]): 41 (-[WebDisplayMediaPromptHelper disconnect]): 42 (-[WebDisplayMediaPromptHelper startObservingSession:]): 43 (-[WebDisplayMediaPromptHelper stopObservingSession:]): 44 (-[WebDisplayMediaPromptHelper sessionDidEnd:]): 45 (-[WebDisplayMediaPromptHelper sessionDidChangeContent:]): 46 (-[WebDisplayMediaPromptHelper pickerCanceledForSession:]): 47 (WebCore::ScreenCaptureKitSharingSessionManager::isAvailable): 48 (WebCore::ScreenCaptureKitSharingSessionManager::singleton): 49 (WebCore::ScreenCaptureKitSharingSessionManager::ScreenCaptureKitSharingSessionManager): 50 (WebCore::ScreenCaptureKitSharingSessionManager::~ScreenCaptureKitSharingSessionManager): 51 (WebCore::ScreenCaptureKitSharingSessionManager::pickerCanceledForSession): 52 (WebCore::ScreenCaptureKitSharingSessionManager::sessionDidEnd): 53 (WebCore::ScreenCaptureKitSharingSessionManager::sessionDidChangeContent): 54 (WebCore::ScreenCaptureKitSharingSessionManager::showWindowPicker): 55 (WebCore::ScreenCaptureKitSharingSessionManager::showScreenPicker): 56 (WebCore::ScreenCaptureKitSharingSessionManager::promptForGetDisplayMedia): 57 (WebCore::ScreenCaptureKitSharingSessionManager::takeSharingSessionForFilter): 58 1 59 2022-02-12 Rob Buis <rbuis@igalia.com> 2 60 -
trunk/Source/WebCore/PAL/ChangeLog
r289547 r289696 1 2022-02-12 Eric Carlson <eric.carlson@apple.com> 2 3 [macOS] Use system window and screen picker when available 4 https://bugs.webkit.org/show_bug.cgi?id=236531 5 rdar://87111816 6 7 Reviewed by Jer Noble. 8 9 * PAL.xcodeproj/project.pbxproj: 10 * pal/mac/ScreenCaptureKitSoftLink.h: 11 * pal/mac/ScreenCaptureKitSoftLink.mm: 12 * pal/spi/mac/ScreenCaptureKitSPI.h: Added. 13 1 14 2022-02-10 Eric Carlson <eric.carlson@apple.com> 2 15 -
trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
r288604 r289696 22 22 23 23 /* Begin PBXBuildFile section */ 24 07035D3127A9B33000FB03E4 /* ScreenCaptureKitSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 07035D3027A9B32E00FB03E4 /* ScreenCaptureKitSPI.h */; }; 24 25 071C00372707EDF000D027C7 /* ReplayKitSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 071C00352707EDF000D027C7 /* ReplayKitSoftLink.mm */; }; 25 26 071C00382707EDF000D027C7 /* ReplayKitSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 071C00362707EDF000D027C7 /* ReplayKitSoftLink.h */; }; … … 431 432 432 433 /* Begin PBXFileReference section */ 434 07035D3027A9B32E00FB03E4 /* ScreenCaptureKitSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScreenCaptureKitSPI.h; sourceTree = "<group>"; }; 433 435 071C00352707EDF000D027C7 /* ReplayKitSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ReplayKitSoftLink.mm; sourceTree = "<group>"; }; 434 436 071C00362707EDF000D027C7 /* ReplayKitSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReplayKitSoftLink.h; sourceTree = "<group>"; }; … … 1056 1058 0C7785851F45130F00F4EBB6 /* PIPSPI.h */, 1057 1059 0C7785871F45130F00F4EBB6 /* QuickLookMacSPI.h */, 1058 A1175B481F6AFF8E00C4B9F0 /* SpeechSynthesisSPI.h */,1060 07035D3027A9B32E00FB03E4 /* ScreenCaptureKitSPI.h */, 1059 1061 71B1141F26823ACD004D6701 /* SystemPreviewSPI.h */, 1060 1062 0C7785881F45130F00F4EBB6 /* TelephonyUtilitiesSPI.h */, … … 1678 1680 BC4DDD9F273EF56E00660EBB /* SceneKitSPI.h in Headers */, 1679 1681 07789182273B14FF00E408D1 /* ScreenCaptureKitSoftLink.h in Headers */, 1682 07035D3127A9B33000FB03E4 /* ScreenCaptureKitSPI.h in Headers */, 1680 1683 570AB8F120AE2E8D00B8BE87 /* SecKeyProxySPI.h in Headers */, 1681 1684 0C2DA1581F3BEB4900DBC317 /* ServersSPI.h in Headers */, -
trunk/Source/WebCore/PAL/pal/mac/ScreenCaptureKitSoftLink.h
r289547 r289696 37 37 SOFT_LINK_CLASS_FOR_HEADER_WITH_AVAILABILITY(PAL, SCStreamConfiguration, API_AVAILABLE(macos(12.3))) 38 38 SOFT_LINK_CLASS_FOR_HEADER_WITH_AVAILABILITY(PAL, SCStream, API_AVAILABLE(macos(12.3))) 39 SOFT_LINK_CLASS_FOR_HEADER(PAL, SCContentSharingSession) 39 40 40 41 SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(PAL, ScreenCaptureKit, SCStreamFrameInfoStatus, NSString *) -
trunk/Source/WebCore/PAL/pal/mac/ScreenCaptureKitSoftLink.mm
r289547 r289696 37 37 SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT_AND_AVAILABILITY(PAL, ScreenCaptureKit, SCStreamConfiguration, PAL_EXPORT, API_AVAILABLE(macos(12.3))) 38 38 SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT_AND_AVAILABILITY(PAL, ScreenCaptureKit, SCStream, PAL_EXPORT, API_AVAILABLE(macos(12.3))) 39 SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT(PAL, ScreenCaptureKit, SCContentSharingSession, PAL_EXPORT) 39 40 40 41 SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE_WITH_EXPORT(PAL, ScreenCaptureKit, SCStreamFrameInfoStatus, NSString *, PAL_EXPORT) -
trunk/Source/WebCore/SourcesCocoa.txt
r289549 r289696 566 566 platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp 567 567 platform/mediastream/mac/ScreenCaptureKitCaptureSource.mm 568 platform/mediastream/mac/ScreenCaptureKitSharingSessionManager.mm 568 569 platform/mediastream/mac/WebAudioSourceProviderCocoa.mm 569 570 platform/mock/MediaPlaybackTargetMock.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r289637 r289696 119 119 073794FE19F5864E00E5A045 /* RTCNotifiersMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 073794F819F5864E00E5A045 /* RTCNotifiersMock.h */; }; 120 120 0738E5EC2499839000DA101C /* AVOutputDeviceMenuControllerTargetPicker.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0738E5EA249968AD00DA101C /* AVOutputDeviceMenuControllerTargetPicker.mm */; }; 121 073955BB27AB277F009A08D2 /* ScreenCaptureKitSharingSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 07035D3227A9B60B00FB03E4 /* ScreenCaptureKitSharingSessionManager.h */; settings = {ATTRIBUTES = (Private, ); }; }; 121 122 073A15542177A42600EA08F2 /* RemoteVideoSample.h in Headers */ = {isa = PBXBuildFile; fileRef = 073A15532177A39A00EA08F2 /* RemoteVideoSample.h */; settings = {ATTRIBUTES = (Private, ); }; }; 122 123 073B87671E4385AC0071C0EC /* AudioSampleBufferList.h in Headers */ = {isa = PBXBuildFile; fileRef = 073B87631E43859D0071C0EC /* AudioSampleBufferList.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 5927 5928 070334D8145A006F008D8D45 /* TrackBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrackBase.cpp; sourceTree = "<group>"; }; 5928 5929 070334E8145A1F35008D8D45 /* JSTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTrackCustom.cpp; sourceTree = "<group>"; }; 5930 07035D3227A9B60B00FB03E4 /* ScreenCaptureKitSharingSessionManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScreenCaptureKitSharingSessionManager.h; sourceTree = "<group>"; }; 5931 07035D3427A9B61100FB03E4 /* ScreenCaptureKitSharingSessionManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScreenCaptureKitSharingSessionManager.mm; sourceTree = "<group>"; }; 5929 5932 070363DA181A1CDC00C074A5 /* AVCaptureDeviceManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVCaptureDeviceManager.h; sourceTree = "<group>"; }; 5930 5933 070363DB181A1CDC00C074A5 /* AVCaptureDeviceManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVCaptureDeviceManager.mm; sourceTree = "<group>"; }; … … 18731 18734 070BED97273F415600583926 /* ScreenCaptureKitCaptureSource.h */, 18732 18735 070BED96273F415600583926 /* ScreenCaptureKitCaptureSource.mm */, 18736 07035D3227A9B60B00FB03E4 /* ScreenCaptureKitSharingSessionManager.h */, 18737 07035D3427A9B61100FB03E4 /* ScreenCaptureKitSharingSessionManager.mm */, 18733 18738 07D6373E1BB0B11300256CE9 /* WebAudioSourceProviderCocoa.h */, 18734 18739 07D6373F1BB0B11300256CE9 /* WebAudioSourceProviderCocoa.mm */, … … 37072 37077 BCEC01BE0C274DAC009F4EC9 /* Screen.h in Headers */, 37073 37078 070BED98273F415D00583926 /* ScreenCaptureKitCaptureSource.h in Headers */, 37079 073955BB27AB277F009A08D2 /* ScreenCaptureKitSharingSessionManager.h in Headers */, 37074 37080 C1E1D236203DF15400584665 /* ScreenProperties.h in Headers */, 37075 37081 A84D82C111D3474800972990 /* ScriptableDocumentParser.h in Headers */, -
trunk/Source/WebCore/en.lproj/Localizable.strings
r288604 r289696 147 147 148 148 /* Allow screen button title in window and screen sharing prompt */ 149 "Allow Observing a Screen" = "Allow Observing aScreen";149 "Allow to Share Screen" = "Allow to Share Screen"; 150 150 151 151 /* Allow window button title in window and screen sharing prompt */ 152 "Allow Observing a Window" = "Allow Observing aWindow";152 "Allow to Share Window" = "Allow to Share Window"; 153 153 154 154 /* Button title in Storage Access API prompt */ -
trunk/Source/WebCore/platform/mediastream/cocoa/DisplayCaptureSourceCocoa.cpp
r289149 r289696 325 325 } 326 326 327 void DisplayCaptureSourceCocoa::capturerConfigurationChanged() 328 { 329 m_currentSettings = { }; 330 auto capturerIntrinsicSize = m_capturer->intrinsicSize(); 331 if (this->intrinsicSize() != capturerIntrinsicSize) { 332 m_capabilities = { }; 333 setIntrinsicSize(capturerIntrinsicSize); 334 } 335 } 336 327 337 void DisplayCaptureSourceCocoa::setLogger(const Logger& logger, const void* identifier) 328 338 { -
trunk/Source/WebCore/platform/mediastream/cocoa/DisplayCaptureSourceCocoa.h
r288604 r289696 58 58 virtual void capturerIsRunningChanged(bool) { } 59 59 virtual void capturerFailed() { }; 60 virtual void capturerConfigurationChanged() { }; 60 61 }; 61 62 … … 100 101 m_observer->capturerFailed(); 101 102 } 103 void configurationChanged() 104 { 105 if (m_observer) 106 m_observer->capturerConfigurationChanged(); 107 } 102 108 103 109 private: … … 133 139 void capturerIsRunningChanged(bool isRunning) final { notifyMutedChange(!isRunning); } 134 140 void capturerFailed() final { captureFailed(); } 141 void capturerConfigurationChanged() final; 135 142 136 143 void emitFrame(); -
trunk/Source/WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.h
r289547 r289696 40 40 OBJC_CLASS SCStream; 41 41 OBJC_CLASS SCContentFilter; 42 OBJC_CLASS SCContentSharingSession; 42 43 OBJC_CLASS SCStreamConfiguration; 43 44 OBJC_CLASS SCWindow; 44 45 OBJC_CLASS WebCoreScreenCaptureKitHelper; 45 46 using CMSampleBufferRef = struct opaqueCMSampleBuffer*; 46 47 typedef struct __IOSurface* IOSurfaceRef;48 47 49 48 namespace WebCore { … … 71 70 enum class SampleType { Video }; 72 71 void streamDidOutputSampleBuffer(RetainPtr<CMSampleBufferRef>, SampleType); 72 void sessionDidChangeContent(RetainPtr<SCContentSharingSession>); 73 void sessionDidEnd(RetainPtr<SCContentSharingSession>); 73 74 74 75 private: … … 105 106 RetainPtr<SCStream> m_contentStream; 106 107 RetainPtr<SCStreamConfiguration> m_streamConfiguration; 108 RetainPtr<SCContentSharingSession> m_contentSharingSession; 107 109 OSObjectPtr<dispatch_queue_t> m_captureQueue; 108 110 BlockPtr<void(SCStream *, CMSampleBufferRef)> m_frameAvailableHandler; -
trunk/Source/WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.mm
r289547 r289696 24 24 */ 25 25 26 #i nclude"config.h"27 #i nclude"ScreenCaptureKitCaptureSource.h"26 #import "config.h" 27 #import "ScreenCaptureKitCaptureSource.h" 28 28 29 29 #if HAVE(SCREEN_CAPTURE_KIT) … … 35 35 #import "RealtimeMediaSourceCenter.h" 36 36 #import "RealtimeVideoUtilities.h" 37 #import "ScreenCaptureKitSharingSessionManager.h" 37 38 #import <ScreenCaptureKit/ScreenCaptureKit.h> 39 #import <pal/spi/mac/ScreenCaptureKitSPI.h> 38 40 #import <wtf/BlockObjCExceptions.h> 39 41 #import <wtf/BlockPtr.h> … … 92 94 93 95 using namespace WebCore; 94 @interface WebCoreScreenCaptureKitHelper : NSObject<SCStreamDelegate, WKSCStreamOutput> { 96 @interface WebCoreScreenCaptureKitHelper : NSObject<SCStreamDelegate, 97 #if HAVE(SC_CONTENT_SHARING_SESSION) 98 SCContentSharingSessionProtocol, 99 #endif 100 WKSCStreamOutput> { 95 101 WeakPtr<ScreenCaptureKitCaptureSource> _callback; 96 102 } … … 100 106 - (void)stream:(SCStream *)stream didStopWithError:(NSError *)error; 101 107 - (void)stream:(SCStream *)stream didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer ofType:(WKSCStreamOutputType)type; 108 - (void)sessionDidEnd:(SCContentSharingSession *)session; 109 - (void)sessionDidChangeContent:(SCContentSharingSession *)session; 110 - (void)pickerCanceledForSession:(SCContentSharingSession *)session; 102 111 @end 103 112 … … 120 129 - (void)stream:(SCStream *)stream didStopWithError:(NSError *)error 121 130 { 122 callOnMainRunLoop([s trongSelf = RetainPtr { self }, error = RetainPtr { error }]() mutable {123 if (! strongSelf->_callback)124 return; 125 126 strongSelf->_callback->streamFailedWithError(WTFMove(error), "-[SCStreamDelegate stream:didStopWithError:] called"_s);131 callOnMainRunLoop([self, strongSelf = RetainPtr { self }, error = RetainPtr { error }]() mutable { 132 if (!_callback) 133 return; 134 135 _callback->streamFailedWithError(WTFMove(error), "-[SCStreamDelegate stream:didStopWithError:] called"_s); 127 136 }); 128 137 } … … 138 147 } 139 148 149 - (void)sessionDidEnd:(SCContentSharingSession *)session 150 { 151 RunLoop::main().dispatch([self, strongSelf = RetainPtr { self }, session = RetainPtr { session }]() mutable { 152 if (_callback) 153 _callback->sessionDidEnd(session); 154 }); 155 } 156 157 - (void)sessionDidChangeContent:(SCContentSharingSession *)session 158 { 159 RunLoop::main().dispatch([self, strongSelf = RetainPtr { self }, session = RetainPtr { session }]() mutable { 160 if (_callback) 161 _callback->sessionDidChangeContent(session); 162 }); 163 } 164 165 - (void)pickerCanceledForSession:(SCContentSharingSession *)session 166 { 167 } 140 168 @end 141 169 … … 235 263 236 264 captureFailed(); 265 } 266 267 void ScreenCaptureKitCaptureSource::sessionDidChangeContent(RetainPtr<SCContentSharingSession> session) 268 { 269 ASSERT(isMainThread()); 270 271 if ([session content].type == SCContentFilterTypeNothing) 272 return; 273 274 std::optional<CaptureDevice> device; 275 SCContentFilter* content = [session content]; 276 switch (content.type) { 277 case SCContentFilterTypeDesktopIndependentWindow: 278 device = windowCaptureDeviceWithPersistentID(String::number(content.desktopIndependentWindowInfo.window.windowID)); 279 m_content = content.desktopIndependentWindowInfo.window; 280 break; 281 case SCContentFilterTypeDisplay: 282 device = screenCaptureDeviceWithPersistentID(String::number(content.displayInfo.display.displayID)); 283 m_content = content.displayInfo.display; 284 break; 285 case SCContentFilterTypeNothing: 286 case SCContentFilterTypeAppsAndWindowsPinnedToDisplay: 287 case SCContentFilterTypeClientShouldImplementDefault: 288 ASSERT_NOT_REACHED(); 289 return; 290 } 291 if (!device) { 292 streamFailedWithError(nil, "Failed find CaptureDevice after content change"_s); 293 return; 294 } 295 296 m_captureDevice = device.value(); 297 m_intrinsicSize = { }; 298 configurationChanged(); 299 } 300 301 void ScreenCaptureKitCaptureSource::sessionDidEnd(RetainPtr<SCContentSharingSession>) 302 { 303 streamFailedWithError(nil, "sessionDidEnd"_s); 237 304 } 238 305 … … 349 416 m_contentStream = adoptNS([PAL::allocSCStreamInstance() initWithFilter:m_contentFilter.get() captureOutputProperties:streamConfiguration().get() delegate:m_captureHelper.get()]); 350 417 418 #if HAVE(SC_CONTENT_SHARING_SESSION) 419 if (ScreenCaptureKitSharingSessionManager::isAvailable()) { 420 m_contentSharingSession = ScreenCaptureKitSharingSessionManager::singleton().takeSharingSessionForFilter(m_contentFilter.get()); 421 if (!m_contentSharingSession) { 422 streamFailedWithError(nil, "Failed to get SharingSession"_s); 423 return; 424 } 425 426 m_contentStream = adoptNS([PAL::allocSCStreamInstance() initWithSharingSession:m_contentSharingSession.get() captureOutputProperties:streamConfiguration().get() delegate:m_captureHelper.get()]); 427 } else 428 #endif 429 m_contentStream = adoptNS([PAL::allocSCStreamInstance() initWithFilter:m_contentFilter.get() captureOutputProperties:streamConfiguration().get() delegate:m_captureHelper.get()]); 430 431 351 432 if (!m_contentStream) { 352 streamFailedWithError(nil, "Failed to allocate SLContentStream"_s);433 streamFailedWithError(nil, "Failed to allocate ContentStream"_s); 353 434 return; 354 435 } … … 385 466 if (m_intrinsicSize) 386 467 return m_intrinsicSize.value(); 468 469 if (m_content) { 470 auto frame = switchOn(m_content.value(), 471 [] (const RetainPtr<SCDisplay> display) -> CGRect { 472 return [display frame]; 473 }, 474 [] (const RetainPtr<SCWindow> window) -> CGRect { 475 return [window frame]; 476 } 477 ); 478 479 return { static_cast<int>(frame.size.width), static_cast<int>(frame.size.height) }; 480 } 387 481 388 482 if (m_captureDevice.type() == CaptureDevice::DeviceType::Screen) { -
trunk/Source/WebKit/ChangeLog
r289694 r289696 1 2022-02-12 Eric Carlson <eric.carlson@apple.com> 2 3 [macOS] Use system window and screen picker when available 4 https://bugs.webkit.org/show_bug.cgi?id=236531 5 rdar://87111816 6 7 Reviewed by Jer Noble. 8 9 * Platform/spi/Cocoa/SafeBrowsingSPI.h: 10 * UIProcess/mac/DisplayCaptureSessionManager.mm: 11 (WebKit::DisplayCaptureSessionManager::alertForGetDisplayMedia): Update prompt strings. 12 (WebKit::DisplayCaptureSessionManager::showWindowPicker): Use capture session 13 manager when available. 14 (WebKit::DisplayCaptureSessionManager::showScreenPicker): Ditto. 15 1 16 2022-02-12 Kevin Turner <kevin_turner@apple.com> 2 17 -
trunk/Source/WebKit/Platform/spi/Cocoa/SafeBrowsingSPI.h
r289573 r289696 28 28 #import <Foundation/Foundation.h> 29 29 30 #if USE(APPLE_INTERNAL_SDK)30 #if 0 && USE(APPLE_INTERNAL_SDK) 31 31 32 32 #import <SafariSafeBrowsing/SafariSafeBrowsing.h> -
trunk/Source/WebKit/UIProcess/mac/DisplayCaptureSessionManager.mm
r288604 r289696 37 37 #import <WebCore/MockRealtimeMediaSourceCenter.h> 38 38 #import <WebCore/ScreenCaptureKitCaptureSource.h> 39 #import <WebCore/ScreenCaptureKitSharingSessionManager.h> 39 40 #import <WebCore/SecurityOriginData.h> 40 41 #import <wtf/BlockPtr.h> … … 142 143 143 144 NSString *alertTitle = [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” to observe one of your windows or screens?", "Message for window and screen sharing prompt"), visibleOrigin]; 144 auto *allowWindowButtonString = WEB_UI_NSSTRING(@"Allow Observing aWindow", "Allow window button title in window and screen sharing prompt");145 auto *allowScreenButtonString = WEB_UI_NSSTRING(@"Allow Observing aScreen", "Allow screen button title in window and screen sharing prompt");145 auto *allowWindowButtonString = WEB_UI_NSSTRING(@"Allow to Share Window", "Allow window button title in window and screen sharing prompt"); 146 auto *allowScreenButtonString = WEB_UI_NSSTRING(@"Allow to Share Screen", "Allow screen button title in window and screen sharing prompt"); 146 147 auto *doNotAllowButtonString = WEB_UI_NSSTRING(@"Don’t Allow (window and screen sharing)", "Disallow button title in window and screen sharing prompt"); 147 148 … … 199 200 } 200 201 202 #if HAVE(SC_CONTENT_SHARING_SESSION) 203 if (ScreenCaptureKitSharingSessionManager::isAvailable()) { 204 ScreenCaptureKitSharingSessionManager::singleton().showWindowPicker(WTFMove(completionHandler)); 205 return; 206 } 207 #endif 208 201 209 alertForWindowSelection(page, origin, [completionHandler = WTFMove(completionHandler)] (std::optional<String> windowID, std::optional<String> windowTitle) mutable { 202 210 … … 217 225 return; 218 226 } 227 228 #if HAVE(SC_CONTENT_SHARING_SESSION) 229 if (ScreenCaptureKitSharingSessionManager::isAvailable()) { 230 ScreenCaptureKitSharingSessionManager::singleton().showScreenPicker(WTFMove(completionHandler)); 231 return; 232 } 233 #endif 219 234 220 235 callOnMainRunLoop([completionHandler = WTFMove(completionHandler)] () mutable {
Note: See TracChangeset
for help on using the changeset viewer.