Bug 192379 - [MediaStream] Cleanup up Mac screen capture class
Summary: [MediaStream] Cleanup up Mac screen capture class
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks: 192514
  Show dependency treegraph
 
Reported: 2018-12-04 14:13 PST by Eric Carlson
Modified: 2018-12-07 14:04 PST (History)
4 users (show)

See Also:


Attachments
Patch (6.75 KB, patch)
2018-12-04 14:20 PST, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch for landing. (6.80 KB, patch)
2018-12-05 11:54 PST, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2018-12-04 14:13:42 PST
Minor cleanup.
Comment 1 Radar WebKit Bug Importer 2018-12-04 14:14:04 PST
<rdar://problem/46465458>
Comment 2 Eric Carlson 2018-12-04 14:20:50 PST
Created attachment 356532 [details]
Patch
Comment 3 youenn fablet 2018-12-04 18:44:01 PST
Comment on attachment 356532 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=356532&action=review

> Source/WebCore/ChangeLog:12
> +        (WebCore::DisplayCaptureManagerCocoa::captureDevices): Initialize Display devices first.

Maybe document why we need to do this

> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:156
>              weakThis->frameAvailable(status, displayTime, frameSurface, updateRef);

This is existing code but the weakThis check is not thread safe here. weakThis may be dead between if and next call.

> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:-167
> -        });

Do we need the call to frameAvailable to be in a background thread?
Comment 4 Eric Carlson 2018-12-05 11:54:22 PST
Created attachment 356632 [details]
Patch for landing.
Comment 5 WebKit Commit Bot 2018-12-05 12:22:02 PST
Comment on attachment 356632 [details]
Patch for landing.

Clearing flags on attachment: 356632

Committed r238904: <https://trac.webkit.org/changeset/238904>
Comment 6 WebKit Commit Bot 2018-12-05 12:22:04 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Darin Adler 2018-12-06 12:44:16 PST
Comment on attachment 356632 [details]
Patch for landing.

View in context: https://bugs.webkit.org/attachment.cgi?id=356632&action=review

> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:144
> +        CFDictionaryRef streamOptions = (__bridge CFDictionaryRef) @{

Doing the cast here may be incompatible with ARC. Instead the local variable should be an NSDictionary * and the cast to CFDictionaryRef should go below at the call site. Or we can use two local variables.

> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:148
> +            (__bridge NSString *)kCGDisplayStreamMinimumFrameTime :@(1 / frameRate()),
> +            (__bridge NSString *)kCGDisplayStreamQueueDepth:@(screenQueueMaximumLength),
> +            (__bridge NSString *)kCGDisplayStreamColorSpace:(__bridge id)sRGBColorSpaceRef(),
> +            (__bridge NSString *)kCGDisplayStreamShowCursor : @(YES),

Formatting here is a little messy, inconsistent about whether there is a space before and after the colon.
Comment 8 Eric Carlson 2018-12-07 14:04:22 PST
(In reply to Darin Adler from comment #7)
> Comment on attachment 356632 [details]
> Patch for landing.
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=356632&action=review
> 
> > Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:144
> > +        CFDictionaryRef streamOptions = (__bridge CFDictionaryRef) @{
> 
> Doing the cast here may be incompatible with ARC. Instead the local variable
> should be an NSDictionary * and the cast to CFDictionaryRef should go below
> at the call site. Or we can use two local variables.
> 
> > Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:148
> > +            (__bridge NSString *)kCGDisplayStreamMinimumFrameTime :@(1 / frameRate()),
> > +            (__bridge NSString *)kCGDisplayStreamQueueDepth:@(screenQueueMaximumLength),
> > +            (__bridge NSString *)kCGDisplayStreamColorSpace:(__bridge id)sRGBColorSpaceRef(),
> > +            (__bridge NSString *)kCGDisplayStreamShowCursor : @(YES),
> 
> Formatting here is a little messy, inconsistent about whether there is a
> space before and after the colon.

Thanks, I will fix these in bug 192514.