Skip to content

Commit

Permalink
[macOS] Suppress the SCStream privacy alert
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=259889
rdar://113510677

Reviewed by Andy Estes.

WebKit only allows one tab to capture at a time, so the SCStream privacy alert is confusing
and unnecessary.

* Source/WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.mm:
(WebCore::ScreenCaptureKitCaptureSource::streamConfiguration): Set
`configuration.presenterOverlayPrivacyAlertSetting` to `SCPresenterOverlayAlertSettingNever`

Canonical link: https://commits.webkit.org/266661@main
  • Loading branch information
eric-carlson committed Aug 7, 2023
1 parent 3e01a64 commit 52ced8d
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability-new"

#if HAVE(SC_CONTENT_SHARING_PICKER)
// FIXME: Remove this once it is in a public header.
typedef NS_ENUM(NSInteger, SCPresenterOverlayAlertSetting);

typedef NS_ENUM(NSInteger, WK_SCPresenterOverlayAlertSetting) {
WK_SCPresenterOverlayAlertSettingSystem,
WK_SCPresenterOverlayAlertSettingNever,
WK_SCPresenterOverlayAlertSettingAlways
};

@interface SCStreamConfiguration (SCStreamConfiguration_Pending_Public_API)
@property (nonatomic, assign) SCPresenterOverlayAlertSetting presenterOverlayPrivacyAlertSetting;
@end
#endif

using namespace WebCore;
@interface WebCoreScreenCaptureKitHelper : NSObject<SCStreamDelegate, SCStreamOutput> {
WeakPtr<ScreenCaptureKitCaptureSource> _callback;
Expand Down Expand Up @@ -273,6 +288,10 @@ - (void)stream:(SCStream *)stream didOutputSampleBuffer:(CMSampleBufferRef)sampl
[m_streamConfiguration setQueueDepth:6];
[m_streamConfiguration setColorSpaceName:kCGColorSpaceSRGB];
[m_streamConfiguration setColorMatrix:kCGDisplayStreamYCbCrMatrix_SMPTE_240M_1995];
#if HAVE(SC_CONTENT_SHARING_PICKER)
if ([m_streamConfiguration respondsToSelector:@selector(setPresenterOverlayPrivacyAlertSetting:)])
[m_streamConfiguration setPresenterOverlayPrivacyAlertSetting:static_cast<SCPresenterOverlayAlertSetting>(WK_SCPresenterOverlayAlertSettingNever)];
#endif

if (m_frameRate)
[m_streamConfiguration setMinimumFrameInterval:PAL::CMTimeMakeWithSeconds(1 / m_frameRate, 1000)];
Expand Down

0 comments on commit 52ced8d

Please sign in to comment.