WebKit Bugzilla
Attachment 369445 Details for
Bug 197722
: Video frame resizing should be using Trim
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197722-20190508163027.patch (text/plain), 7.30 KB, created by
youenn fablet
on 2019-05-08 16:30:27 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-05-08 16:30:27 PDT
Size:
7.30 KB
patch
obsolete
>Subversion Revision: 244961 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c6a2d7efa00a578ada56853b97de5974c560a841..adc569941362f99f7ef6ab822f641f18b682f84a 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2019-05-08 Youenn Fablet <youenn@apple.com> >+ >+ Video frame resizing should be using Trim >+ https://bugs.webkit.org/show_bug.cgi?id=197722 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Move from letter box to trim mode for resizing. >+ This ensures no black stripes are present when rendering the stream. >+ >+ Test: fast/mediastream/getUserMedia-resizing.html >+ >+ * platform/cocoa/VideoToolboxSoftLink.cpp: >+ * platform/cocoa/VideoToolboxSoftLink.h: >+ * platform/graphics/cv/ImageTransferSessionVT.mm: >+ (WebCore::ImageTransferSessionVT::ImageTransferSessionVT): >+ > 2019-05-08 Youenn Fablet <youenn@apple.com> > > Use clampTo in AVVideoCaptureSource::setSizeAndFrameRateWithPreset >diff --git a/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp b/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp >index 5971d3981e94532fed0059c4b6dfc72cb0c776ba..1d56365a7f138cf893346af3198c6424656761b3 100644 >--- a/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp >+++ b/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp >@@ -64,6 +64,7 @@ SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, VideoToolbox, VTPixelTransferSessionTrans > SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, VideoToolbox, VTSessionSetProperty, OSStatus, (VTSessionRef session, CFStringRef propertyKey, CFTypeRef propertyValue), (session, propertyKey, propertyValue)) > SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTPixelTransferPropertyKey_ScalingMode, CFStringRef) > SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTScalingMode_Letterbox, CFStringRef) >+SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTScalingMode_Trim, CFStringRef) > SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTPixelTransferPropertyKey_EnableHardwareAcceleratedTransfer, CFStringRef) > SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTPixelTransferPropertyKey_EnableHighSpeedTransfer, CFStringRef) > SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTPixelTransferPropertyKey_RealTime, CFStringRef) >diff --git a/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h b/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h >index ac49247fb4652401e6700a38133c63ddefccb838..f156547a39e128962dc326b70fc3e3d5a0e1c1c7 100644 >--- a/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h >+++ b/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h >@@ -91,6 +91,8 @@ SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, VideoToolbox, kVTPixelTransferPropertyKey > #define kVTPixelTransferPropertyKey_ScalingMode get_VideoToolbox_kVTPixelTransferPropertyKey_ScalingMode() > SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, VideoToolbox, kVTScalingMode_Letterbox, CFStringRef) > #define kVTScalingMode_Letterbox get_VideoToolbox_kVTScalingMode_Letterbox() >+SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, VideoToolbox, kVTScalingMode_Trim, CFStringRef) >+#define kVTScalingMode_Trim get_VideoToolbox_kVTScalingMode_Trim() > SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, VideoToolbox, kVTPixelTransferPropertyKey_EnableHardwareAcceleratedTransfer, CFStringRef) > #define kVTPixelTransferPropertyKey_EnableHardwareAcceleratedTransfer get_VideoToolbox_kVTPixelTransferPropertyKey_EnableHardwareAcceleratedTransfer() > SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, VideoToolbox, kVTPixelTransferPropertyKey_EnableHighSpeedTransfer, CFStringRef) >diff --git a/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm b/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm >index 9c21be71081267b2cd922a692cc76e481b332d25..24aa48c41c932233b53484d4c74e7937fa8c5e69 100644 >--- a/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm >+++ b/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm >@@ -59,7 +59,7 @@ ImageTransferSessionVT::ImageTransferSessionVT(uint32_t pixelFormat) > ASSERT(transferSession); > m_transferSession = adoptCF(transferSession); > >- auto status = VTSessionSetProperty(transferSession, kVTPixelTransferPropertyKey_ScalingMode, kVTScalingMode_Letterbox); >+ auto status = VTSessionSetProperty(transferSession, kVTPixelTransferPropertyKey_ScalingMode, kVTScalingMode_Trim); > if (status != kCVReturnSuccess) > RELEASE_LOG(Media, "ImageTransferSessionVT::ImageTransferSessionVT: VTSessionSetProperty(kVTPixelTransferPropertyKey_ScalingMode) failed with error %d", static_cast<int>(status)); > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index e3427213851b7187772a25bec88775e1d255da7a..fe1e4f5c2f8843a82e3090c18cee04df7a867de3 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2019-05-08 Youenn Fablet <youenn@apple.com> >+ >+ Video frame resizing should be using Trim >+ https://bugs.webkit.org/show_bug.cgi?id=197722 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/mediastream/getUserMedia-resizing-expected.txt: Added. >+ * fast/mediastream/getUserMedia-resizing.html: Added. >+ > 2019-05-06 Youenn Fablet <youenn@apple.com> > > Video stream freeze on front camera orientation changing >diff --git a/LayoutTests/fast/mediastream/getUserMedia-resizing-expected.txt b/LayoutTests/fast/mediastream/getUserMedia-resizing-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..476cbfd5f239831a35edfaa82e198259dea51404 >--- /dev/null >+++ b/LayoutTests/fast/mediastream/getUserMedia-resizing-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS Basic video capture >+ >diff --git a/LayoutTests/fast/mediastream/getUserMedia-resizing.html b/LayoutTests/fast/mediastream/getUserMedia-resizing.html >new file mode 100644 >index 0000000000000000000000000000000000000000..857770e8870bbc8ec8dd7dd710803aafa184ac1e >--- /dev/null >+++ b/LayoutTests/fast/mediastream/getUserMedia-resizing.html >@@ -0,0 +1,48 @@ >+<!doctype html> >+<html> >+ <head> >+ <meta charset="utf-8"> >+ <title>Testing basic resizing of getUserMedia stream</title> >+ <script src="../../resources/testharness.js"></script> >+ <script src="../../resources/testharnessreport.js"></script> >+ </head> >+ <body> >+ <video id="video" autoplay=""></video> >+ <canvas id="canvas" width="640" height="480"></canvas> >+ <script> >+video = document.getElementById("video"); >+canvas = document.getElementById("canvas"); >+ >+function grabFrameData(x, y, w, h) >+{ >+ canvas.width = video.videoWidth; >+ canvas.height = video.videoHeight; >+ >+ canvas.getContext('2d').drawImage(video, x, y, w, h, x, y, w, h); >+ return canvas.getContext('2d').getImageData(x, y, w, h).data; >+} >+ >+function testImage() >+{ >+ const data = grabFrameData(0, 0, 1, 1); >+ >+ // Using trim mode, the background of the image should be gray for mock sources and there should be no black stripes. >+ assert_true(data[0] > 50, "red"); >+ assert_true(data[1] > 50, "blue"); >+ assert_true(data[2] > 50, "green"); >+} >+ >+promise_test(async (test) => { >+ if (window.testRunner) >+ testRunner.setUserMediaPermission(true); >+ >+ const localStream = await navigator.mediaDevices.getUserMedia({video: {width : 380, height: 240, facingMode: "environment"} }); >+ video.srcObject = localStream; >+ await video.play(); >+ >+ testImage(); >+}, "Basic video capture"); >+ >+ </script> >+ </body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197722
:
369445
|
369451
|
369852