WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
181333
[MediaStream] Add Mac screen capture source
https://bugs.webkit.org/show_bug.cgi?id=181333
Summary
[MediaStream] Add Mac screen capture source
Eric Carlson
Reported
2018-01-05 11:43:20 PST
Add Mac screen capture source
Attachments
Patch
(32.56 KB, patch)
2018-01-05 12:05 PST
,
Eric Carlson
no flags
Details
Formatted Diff
Diff
Patch
(36.42 KB, patch)
2018-01-05 13:10 PST
,
Eric Carlson
no flags
Details
Formatted Diff
Diff
Patch
(36.52 KB, patch)
2018-01-05 13:28 PST
,
Eric Carlson
no flags
Details
Formatted Diff
Diff
Patch
(36.36 KB, patch)
2018-01-05 15:11 PST
,
Eric Carlson
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2018-01-05 11:44:52 PST
<
rdar://problem/36323219
>
Eric Carlson
Comment 2
2018-01-05 12:05:02 PST
Created
attachment 330566
[details]
Patch
Eric Carlson
Comment 3
2018-01-05 13:10:17 PST
Created
attachment 330570
[details]
Patch
Eric Carlson
Comment 4
2018-01-05 13:28:30 PST
Created
attachment 330576
[details]
Patch
Dean Jackson
Comment 5
2018-01-05 14:01:42 PST
Comment on
attachment 330576
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=330576&action=review
> Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:103 > + auto maxDisplays = displayCount; > + CGDirectDisplayID activeDisplays[maxDisplays]; > + err = CGGetActiveDisplayList(maxDisplays, &(activeDisplays[0]), &displayCount); > + if (err) { > + RELEASE_LOG(Media, "CGGetActiveDisplayList() returned error %d when trying to get the active display list", (int)err); > + return; > + } > + if (displayCount > maxDisplays) > + displayCount = maxDisplays;
How could this last test happen? Why would the display count change within this function? Also, if displayCount has increased in size, isn't activeDisplays the wrong length (too short)?
> Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:110 > + m_displaysInternal.append({ displayID, CGDisplayIDToOpenGLDisplayMask(displayID) });
Do you ever need to remove a display? Where does m_displaysInternal get reset?
> Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:126 > + for (auto &device : m_displaysInternal) {
Nit auto& not auto &
> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:95 > + class DisplaySurface { > + public: > + DisplaySurface() = default; > + ~DisplaySurface() > + { > + if (m_surface) > + IOSurfaceDecrementUseCount(m_surface.get()); > + } > + > + DisplaySurface& operator=(IOSurfaceRef surface) > + { > + if (m_surface) > + IOSurfaceDecrementUseCount(m_surface.get()); > + if (surface) > + IOSurfaceIncrementUseCount(surface); > + m_surface = surface; > + return *this; > + } > + > + IOSurfaceRef ioSurface() const { return m_surface.get(); } > + > + private: > + RetainPtr<IOSurfaceRef> m_surface; > + };
I was going to ask why you don't use platform/graphics/cocoa/IOSurface but I don't think you'd get any benefit. Also, it seems those are intended to own a surface, whereas you're just borrowing one for a while. The name DisplaySurface through me off a bit though.
> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:52 > +static int32_t roundUpToMacroblockMultiple(int32_t size) > +{ > + return (size + 15) & ~15; > +}
I'll take your word for this :)
> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:76 > + if (displayCount > maxDisplays) > + displayCount = maxDisplays;
Same comment here. I must be missing it.
> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:83 > + for (auto display : activeDisplays) { > + if (displayMask == CGDisplayIDToOpenGLDisplayMask(display)) > + return display; > + } > +
As discussed on IRC... find_first_of
> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:143 > + screenWidth = 640; > + screenHeight = 480;
Are these numbers defined somewhere? should you put a fixme in to identify them?
> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:156 > + int depth = 6;
What is 6?
Eric Carlson
Comment 6
2018-01-05 15:02:28 PST
Comment on
attachment 330576
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=330576&action=review
>> Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:103 >> + displayCount = maxDisplays; > > How could this last test happen? Why would the display count change within this function? > > Also, if displayCount has increased in size, isn't activeDisplays the wrong length (too short)?
Both are good points, fixed.
>> Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:110 >> + m_displaysInternal.append({ displayID, CGDisplayIDToOpenGLDisplayMask(displayID) }); > > Do you ever need to remove a display? Where does m_displaysInternal get reset?
We never remove a display from our list, but if it disappears it is marked as inactive.
>> Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:126 >> + for (auto &device : m_displaysInternal) { > > Nit auto& not auto &
Fixed.
>> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:52 >> +} > > I'll take your word for this :)
:-)
>> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:76 >> + displayCount = maxDisplays; > > Same comment here. I must be missing it.
Fixed.
>> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:83 >> + > > As discussed on IRC... find_first_of
Actually I was wrong, it won't work because activeDisplays is a C-style array.
>> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:143 >> + screenHeight = 480; > > Are these numbers defined somewhere? should you put a fixme in to identify them?
I guess failing to get width or height should result in a failure. Changed.
>> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:156 >> + int depth = 6; > > What is 6?
The maximum number of frames to queue. Added a constant.
Eric Carlson
Comment 7
2018-01-05 15:11:19 PST
Created
attachment 330592
[details]
Patch
WebKit Commit Bot
Comment 8
2018-01-05 15:34:33 PST
Comment on
attachment 330592
[details]
Patch Clearing flags on attachment: 330592 Committed
r226468
: <
https://trac.webkit.org/changeset/226468
>
WebKit Commit Bot
Comment 9
2018-01-05 15:34:35 PST
All reviewed patches have been landed. Closing bug.
Simon Fraser (smfr)
Comment 10
2018-01-06 16:41:31 PST
Comment on
attachment 330592
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=330592&action=review
> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:72 > + class DisplaySurface {
Can this just use our IOSurface class?
> Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:152 > + static CGColorSpaceRef deviceRGBColorSpace = CGColorSpaceCreateDeviceRGB();
We're trying to avoid use of deviceRGB anywhere now, since it's effectively the same as sRGB. Can you change this to use sRGBColorSpaceRef() from GraphicsContextCG.h?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug