[MediaStream] Add Mac window capture source
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 02:33:02 +0000 (02:33 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 02:33:02 +0000 (02:33 +0000)
commit96c2f9717f01f8ce0a2342daeb34d51cc4416069
tree4811cf71f7e9401e754cfc44e135c8331369d51d
parent8296f1f8634951559f49a0dc49c0c2bae30a39b0
[MediaStream] Add Mac window capture source
https://bugs.webkit.org/show_bug.cgi?id=189958
<rdar://problem/44767616>

Reviewed by Youenn Fablet.

Source/WebCore:

* SourcesCocoa.txt: Add WindowDisplayCaptureSourceMac.
* WebCore.xcodeproj/project.pbxproj: Ditto.

* platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
(WebCore::DisplayCaptureManagerCocoa::captureDevices): Include window "devices".
(WebCore::DisplayCaptureManagerCocoa::updateWindowCaptureDevices): New.
(WebCore::DisplayCaptureManagerCocoa::windowCaptureDeviceWithPersistentID): New.
(WebCore::DisplayCaptureManagerCocoa::captureDeviceWithPersistentID): Include window devices.
* platform/mediastream/mac/DisplayCaptureManagerCocoa.h:

* platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
(WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa):
(WebCore::DisplayCaptureSourceCocoa::settings): Use frameSize, report surface type and
logical surface.
(WebCore::DisplayCaptureSourceCocoa::settingsDidChange): Clear m_lastSampleBuffer when size changes.
(WebCore::DisplayCaptureSourceCocoa::frameSize const): New, return size() or intrinsic size.
(WebCore::DisplayCaptureSourceCocoa::setIntrinsicSize): New.
(WebCore::DisplayCaptureSourceCocoa::emitFrame): generateFrame now returns a CVPixelBuffer
so derived classes don't have to deal with resizing/transforming.
* platform/mediastream/mac/DisplayCaptureSourceCocoa.h:

* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:

* platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
* platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
(WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac): Add fixme.
(WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Update intrinsic size when
width/height changes.
(WebCore::ScreenDisplayCaptureSourceMac::generateFrame): Return a CVPixelBuffer.

* platform/mediastream/mac/WindowDisplayCaptureSourceMac.h: Added.
* platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm: Added.
(WebCore::anyOfCGWindow):
(WebCore::windowDescription):
(WebCore::WindowDisplayCaptureSourceMac::create):
(WebCore::WindowDisplayCaptureSourceMac::WindowDisplayCaptureSourceMac):
(WebCore::WindowDisplayCaptureSourceMac::windowImage):
(WebCore::WindowDisplayCaptureSourceMac::generateFrame):
(WebCore::WindowDisplayCaptureSourceMac::pixelBufferFromCGImage):
(WebCore::WindowDisplayCaptureSourceMac::windowCaptureDeviceWithPersistentID):
(WebCore::WindowDisplayCaptureSourceMac::windowCaptureDevices):

Source/WebKit:

* UIProcess/UserMediaPermissionRequestManagerProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::beginMonitoringCaptureDevices): Sync with webcore prefs before listening
to device changes so we listen on the correct devices.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236494 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/graphics/cv/PixelBufferResizer.mm
Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp
Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.h
Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp
Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.h
Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp
Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h
Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm
Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.h [new file with mode: 0644]
Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.h
Source/WebKit/UIProcess/WebPageProxy.cpp