[MediaStream] Scaled video frames should be resized in letterbox mode
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Dec 2018 05:36:43 +0000 (05:36 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Dec 2018 05:36:43 +0000 (05:36 +0000)
commit547e88d27f84fb81d1ccc938d708bd7f89adfde7
tree971b56e10abd61b2711f2804a8559c3bdc556960
parentc34f93f9992ee3ffad1e5fad2625055c8581752b
[MediaStream] Scaled video frames should be resized in letterbox mode
https://bugs.webkit.org/show_bug.cgi?id=192528
<rdar://problem/46576638>

Reviewed by Darin Adler.

Source/WebCore:

Test: fast/mediastream/resize-letterbox.html

* platform/graphics/cv/ImageTransferSessionVT.mm:
(WebCore::ImageTransferSessionVT::ImageTransferSessionVT): Use letterbox resize mode, not trim.

* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::captureSize const): "Capture" at the preset size, not
necessarily at the requested size to be more like a physical camera.
(WebCore::MockRealtimeVideoSource::settingsDidChange):
(WebCore::MockRealtimeVideoSource::drawAnimation):
(WebCore::MockRealtimeVideoSource::drawBoxes):
(WebCore::MockRealtimeVideoSource::drawText):
(WebCore::MockRealtimeVideoSource::generateFrame):
(WebCore::MockRealtimeVideoSource::imageBuffer const):
* platform/mock/MockRealtimeVideoSource.h:

LayoutTests:

* fast/mediastream/resize-letterbox-expected.txt: Added.
* fast/mediastream/resize-letterbox.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/mediastream/resize-letterbox-expected.txt [new file with mode: 0644]
LayoutTests/fast/mediastream/resize-letterbox.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp
Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h
Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm
Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp
Source/WebCore/platform/mock/MockRealtimeVideoSource.h