[MediaStream] Consolidate all image conversion and resizing into one class
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2018 21:55:36 +0000 (21:55 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2018 21:55:36 +0000 (21:55 +0000)
commite0209c1a605c79926808d9f4fdb0d9ed327f5e41
treebb2dae4f23b84bc5ebe45be7fe65defc80d37b60
parent005f7204040b3dee57556183a20b729ff8f12293
[MediaStream] Consolidate all image conversion and resizing into one class
https://bugs.webkit.org/show_bug.cgi?id=190519
<rdar://problem/45224307>

Reviewed by Youenn Fablet.

No new tests, no functional change.

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

* platform/MediaSample.h:
(WebCore::MediaSample::videoPixelFormat const): New.

* platform/cocoa/VideoToolboxSoftLink.cpp: Add new kVTPixelTransferProperty keys.
* platform/cocoa/VideoToolboxSoftLink.h:

* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
(WebCore::MediaSampleAVFObjC::create): Remove unimplemented variant.
* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
(WebCore::MediaSampleAVFObjC::videoPixelFormat const): New.

* platform/graphics/cv/ImageTransferSessionVT.h: Added.
(WebCore::ImageTransferSessionVT::create):
* platform/graphics/cv/ImageTransferSessionVT.mm: Added.
(WebCore::ImageTransferSessionVT::ImageTransferSessionVT):
(WebCore::ImageTransferSessionVT::~ImageTransferSessionVT):
(WebCore::ImageTransferSessionVT::setSize):
(WebCore::ImageTransferSessionVT::createPixelBuffer):
(WebCore::ImageTransferSessionVT::createCMSampleBuffer):
(WebCore::roundUpToMacroblockMultiple):
(WebCore::ImageTransferSessionVT::ioSurfacePixelBufferCreationOptions):
(WebCore::ImageTransferSessionVT::createMediaSample):

* platform/graphics/cv/PixelBufferResizer.h: Removed.
* platform/graphics/cv/PixelBufferResizer.mm: Removed.

* platform/mediastream/mac/AVVideoCaptureSource.h:
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::prefersPreset):
(WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection): Remove
the resizing logic, it is handled by the base class.

* platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
(WebCore::DisplayCaptureSourceCocoa::capabilities):
(WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
(WebCore::DisplayCaptureSourceCocoa::setIntrinsicSize):
(WebCore::DisplayCaptureSourceCocoa::emitFrame): Remove resizing logic, just use a transfer
session to create an image from the capture source native output format.
(WebCore::DisplayCaptureSourceCocoa::sampleBufferFromPixelBuffer): Deleted.
(WebCore::roundUpToMacroblockMultiple): Deleted.
(WebCore::DisplayCaptureSourceCocoa::pixelBufferFromIOSurface): Deleted.
* platform/mediastream/mac/DisplayCaptureSourceCocoa.h:

* platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
* platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
(WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer): Use image transfer session.
(WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): Deleted.
(WebCore::MockRealtimeVideoSourceMac::pixelBufferFromCGImage const): Deleted.
(WebCore::MockRealtimeVideoSourceMac::setSizeAndFrameRateWithPreset): Deleted.

* platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
* platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
(WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
(WebCore::ScreenDisplayCaptureSourceMac::generateFrame): Return the IOSurface directly.

* platform/mediastream/mac/WindowDisplayCaptureSourceMac.h:
* platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm:
(WebCore::WindowDisplayCaptureSourceMac::generateFrame): Return the CGImage directly.
(WebCore::WindowDisplayCaptureSourceMac::pixelBufferFromCGImage): Deleted.

* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::capabilities): Only the camera supports device ID.
(WebCore::MockRealtimeVideoSource::settings): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237236 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
Source/WebCore/ChangeLog
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/MediaSample.h
Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp
Source/WebCore/platform/cocoa/CoreVideoSoftLink.h
Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp
Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm
Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.h [new file with mode: 0644]
Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm [new file with mode: 0644]
Source/WebCore/platform/graphics/cv/PixelBufferResizer.h [deleted file]
Source/WebCore/platform/graphics/cv/PixelBufferResizer.mm [deleted file]
Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp
Source/WebCore/platform/mediastream/RealtimeMediaSource.h
Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h
Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp
Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.h
Source/WebCore/platform/mediastream/mac/MockRealtimeVideoSourceMac.h
Source/WebCore/platform/mediastream/mac/MockRealtimeVideoSourceMac.mm
Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h
Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm
Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.h
Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm
Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp