diff --git a/modules/desktop_capture/mac/screen_capturer_mac.mm b/modules/desktop_capture/mac/screen_capturer_mac.mm index 8f0c68d48b..28cc410573 100644 --- a/modules/desktop_capture/mac/screen_capturer_mac.mm +++ b/modules/desktop_capture/mac/screen_capturer_mac.mm @@ -20,87 +20,6 @@ #include "rtc_base/trace_event.h" #include "sdk/objc/helpers/scoped_cftyperef.h" -// All these symbols have incorrect availability annotations in the 13.3 SDK. -// These have the correct annotation. See https://crbug.com/1431897. -// TODO(thakis): Remove this once FB12109479 is fixed and we updated to an SDK -// with the fix. - -static CGDisplayStreamRef __nullable - wrapCGDisplayStreamCreate(CGDirectDisplayID display, - size_t outputWidth, - size_t outputHeight, - int32_t pixelFormat, - CFDictionaryRef __nullable properties, - CGDisplayStreamFrameAvailableHandler __nullable handler) - CG_AVAILABLE_BUT_DEPRECATED( - 10.8, - 14.0, - "Please use ScreenCaptureKit API's initWithFilter:configuration:delegate: instead") { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - return CGDisplayStreamCreate( - display, outputWidth, outputHeight, pixelFormat, properties, handler); -#pragma clang diagnostic pop -} - -static CFRunLoopSourceRef __nullable - wrapCGDisplayStreamGetRunLoopSource(CGDisplayStreamRef cg_nullable displayStream) - CG_AVAILABLE_BUT_DEPRECATED(10.8, - 14.0, - "There is no direct replacement for this function. Please use " - "ScreenCaptureKit API's SCStream to replace CGDisplayStream") { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - return CGDisplayStreamGetRunLoopSource(displayStream); -#pragma clang diagnostic pop -} - -static CGError wrapCGDisplayStreamStart(CGDisplayStreamRef cg_nullable displayStream) - CG_AVAILABLE_BUT_DEPRECATED(10.8, - 14.0, - "Please use ScreenCaptureKit API's " - "startCaptureWithCompletionHandler: to start a stream instead") { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - return CGDisplayStreamStart(displayStream); -#pragma clang diagnostic pop -} - -static CGError wrapCGDisplayStreamStop(CGDisplayStreamRef cg_nullable displayStream) - CG_AVAILABLE_BUT_DEPRECATED(10.8, - 14.0, - "Please use ScreenCaptureKit API's " - "stopCaptureWithCompletionHandler: to stop a stream instead") { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - return CGDisplayStreamStop(displayStream); -#pragma clang diagnostic pop -} - -static CFStringRef wrapkCGDisplayStreamShowCursor() CG_AVAILABLE_BUT_DEPRECATED( - 10.8, - 14.0, - "Please use ScreenCaptureKit API's SCStreamConfiguration showsCursor property instead") { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - return kCGDisplayStreamShowCursor; -#pragma clang diagnostic pop -} - -static const CGRect* __nullable - wrapCGDisplayStreamUpdateGetRects(CGDisplayStreamUpdateRef __nullable updateRef, - CGDisplayStreamUpdateRectType rectType, - size_t* rectCount) - CG_AVAILABLE_BUT_DEPRECATED(10.8, - 14.0, - "Please use ScreenCaptureKit API's SCStreamFrameInfo with " - "SCStreamFrameInfoContentRect instead") { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - return CGDisplayStreamUpdateGetRects(updateRef, rectType, rectCount); -#pragma clang diagnostic pop -} - namespace webrtc { namespace { @@ -540,7 +459,7 @@ bool ScreenCapturerMac::RegisterRefreshAndMoveHandlers() { size_t count = 0; const CGRect* rects = - wrapCGDisplayStreamUpdateGetRects(updateRef, kCGDisplayStreamUpdateDirtyRects, &count); + CGDisplayStreamUpdateGetRects(updateRef, kCGDisplayStreamUpdateDirtyRects, &count); if (count != 0) { // According to CGDisplayStream.h, it's safe to call // CGDisplayStreamStop() from within the callback. @@ -550,20 +469,20 @@ bool ScreenCapturerMac::RegisterRefreshAndMoveHandlers() { rtc::ScopedCFTypeRef properties_dict( CFDictionaryCreate(kCFAllocatorDefault, - (const void*[]){wrapkCGDisplayStreamShowCursor()}, + (const void*[]){kCGDisplayStreamShowCursor}, (const void*[]){kCFBooleanFalse}, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); - CGDisplayStreamRef display_stream = wrapCGDisplayStreamCreate( + CGDisplayStreamRef display_stream = CGDisplayStreamCreate( display_id, pixel_width, pixel_height, 'BGRA', properties_dict.get(), handler); if (display_stream) { - CGError error = wrapCGDisplayStreamStart(display_stream); + CGError error = CGDisplayStreamStart(display_stream); if (error != kCGErrorSuccess) return false; - CFRunLoopSourceRef source = wrapCGDisplayStreamGetRunLoopSource(display_stream); + CFRunLoopSourceRef source = CGDisplayStreamGetRunLoopSource(display_stream); CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopCommonModes); display_streams_.push_back(display_stream); } @@ -576,9 +495,9 @@ void ScreenCapturerMac::UnregisterRefreshAndMoveHandlers() { RTC_DCHECK(thread_checker_.IsCurrent()); for (CGDisplayStreamRef stream : display_streams_) { - CFRunLoopSourceRef source = wrapCGDisplayStreamGetRunLoopSource(stream); + CFRunLoopSourceRef source = CGDisplayStreamGetRunLoopSource(stream); CFRunLoopRemoveSource(CFRunLoopGetCurrent(), source, kCFRunLoopCommonModes); - wrapCGDisplayStreamStop(stream); + CGDisplayStreamStop(stream); CFRelease(stream); } display_streams_.clear();