WebKit Bugzilla
Attachment 369852 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-20190514085053.patch (text/plain), 11.20 KB, created by
youenn fablet
on 2019-05-14 08:50:53 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-05-14 08:50:53 PDT
Size:
11.20 KB
patch
obsolete
>Subversion Revision: 245233 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0702237834a7edb1da138c7d8322d90ae5c4130e..e6e9e7663e1d30057b051cf3b36385287a896aa0 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2019-05-14 Youenn Fablet <youenn@apple.com> >+ >+ Video frame resizing should be using Trim >+ https://bugs.webkit.org/show_bug.cgi?id=197722 >+ <rdar://problem/50602188> >+ >+ 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/resize-trim.html >+ >+ * platform/cocoa/VideoToolboxSoftLink.cpp: >+ * platform/cocoa/VideoToolboxSoftLink.h: >+ * platform/graphics/cv/ImageTransferSessionVT.mm: >+ (WebCore::ImageTransferSessionVT::ImageTransferSessionVT): >+ > 2019-05-13 Darin Adler <darin@apple.com> > > WHLSLPrepare.cpp always recompiles, even if nothing was changed >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 ea00b880adeed0b9faa473d5a57554f04d2790ce..e81b9e6d018a7800de976a211e3dda11262fa908 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,15 @@ >+2019-05-14 Youenn Fablet <youenn@apple.com> >+ >+ Video frame resizing should be using Trim >+ https://bugs.webkit.org/show_bug.cgi?id=197722 >+ <rdar://problem/50602188> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/mediastream/resize-trim-expected.txt: Renamed from LayoutTests/fast/mediastream/resize-letterbox-expected.txt. >+ * fast/mediastream/resize-trim.html: Renamed from LayoutTests/fast/mediastream/resize-letterbox.html. >+ * platform/gtk/TestExpectations: >+ > 2019-05-12 Simon Fraser <simon.fraser@apple.com> > > REGRESSION (r245208): compositing/shared-backing/sharing-bounds-non-clipping-shared-layer.html asserts >diff --git a/LayoutTests/fast/mediastream/resize-letterbox-expected.txt b/LayoutTests/fast/mediastream/resize-letterbox-expected.txt >deleted file mode 100644 >index 4c018584a49045f2f6035dfb82e2be2cc89102bd..0000000000000000000000000000000000000000 >--- a/LayoutTests/fast/mediastream/resize-letterbox-expected.txt >+++ /dev/null >@@ -1,4 +0,0 @@ >- >- >-PASS Video frames are resized in letterbox-mode when captured at non-native size. >- >diff --git a/LayoutTests/fast/mediastream/resize-letterbox.html b/LayoutTests/fast/mediastream/resize-letterbox.html >deleted file mode 100644 >index c61d10665b41923a85c0f00b318843493c141b36..0000000000000000000000000000000000000000 >--- a/LayoutTests/fast/mediastream/resize-letterbox.html >+++ /dev/null >@@ -1,67 +0,0 @@ >-<!DOCTYPE html> >-<html> >- <head> >- <video id="video" autoplay width=480px height=480px controls ></video> >- <canvas id="canvas" width=480px height=480px></canvas> >- <script src="../../resources/testharness.js"></script> >- <script src="../../resources/testharnessreport.js"></script> >- <script> >- >-const canvas = document.getElementById("canvas"); >-const video = document.getElementById("video"); >- >-function isPixelBlack(pixel) >-{ >- return pixel[0] === 0 && pixel[1] === 0 && pixel[2] === 0 && pixel[3] === 255; >-} >- >-function isPixelGray(pixel) >-{ >- return pixel[0] === 128 && pixel[1] === 128 && pixel[2] === 128 && pixel[3] === 255; >-} >- >-function logPixel(name, pixel) >-{ >- console.log(`${name}: ${pixel[0]}, ${pixel[1]}, ${pixel[2]}, ${pixel[3]}`); >-} >- >-function checkCanvas(canvas, stream) >-{ >- return new Promise((resolve, reject) => { >- video.srcObject = stream; >- video.onplay = () => { >- const ctx = canvas.getContext("2d"); >- ctx.drawImage(video, 0 ,0); >- >- try { >- setTimeout(() => { >- assert_true(isPixelBlack(ctx.getImageData(5, 5, 1, 1).data), "Pixel at 5x5 is NOT from camera."); >- assert_true(isPixelGray(ctx.getImageData(50, 200, 1, 1).data), "Pixel at 50x200 is from camera."); >- resolve(); >- }, 500); >- } catch(err) { >- reject(err); >- return; >- } >- } >- }); >-} >- >-promise_test(async () => { >- let stream = await navigator.mediaDevices.getUserMedia({ video: true }); >- stream = null; >- >- const devices = await navigator.mediaDevices.enumerateDevices(); >- let cameraID = undefined; >- devices.forEach(device => { if (device.label == "Mock video device 2") cameraID = device.deviceId; }); >- assert_true(cameraID !== undefined, "Found camera2"); >- >- stream = await navigator.mediaDevices.getUserMedia({ video: { deviceId: { exact: cameraID }, width: 480, height: 480 } }); >- >- return checkCanvas(canvas, stream); >- >-}, "Video frames are resized in letterbox-mode when captured at non-native size."); >- >- </script> >- </head> >-</html> >diff --git a/LayoutTests/fast/mediastream/resize-trim-expected.txt b/LayoutTests/fast/mediastream/resize-trim-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..4c018584a49045f2f6035dfb82e2be2cc89102bd >--- /dev/null >+++ b/LayoutTests/fast/mediastream/resize-trim-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS Video frames are resized in letterbox-mode when captured at non-native size. >+ >diff --git a/LayoutTests/fast/mediastream/resize-trim.html b/LayoutTests/fast/mediastream/resize-trim.html >new file mode 100644 >index 0000000000000000000000000000000000000000..97a742373a29869e6031ecd39d18c55610ec8c6c >--- /dev/null >+++ b/LayoutTests/fast/mediastream/resize-trim.html >@@ -0,0 +1,37 @@ >+<!DOCTYPE html> >+<html> >+ <head> >+ <video id="video" autoplay width=480px height=480px controls ></video> >+ <canvas id="canvas" width=480px height=480px></canvas> >+ <script src="../../resources/testharness.js"></script> >+ <script src="../../resources/testharnessreport.js"></script> >+ <script> >+ >+function isPixelGray(pixel) >+{ >+ return pixel[0] === 128 && pixel[1] === 128 && pixel[2] === 128 && pixel[3] === 255; >+} >+ >+promise_test(async () => { >+ let stream = await navigator.mediaDevices.getUserMedia({ video: true }); >+ stream = null; >+ >+ const devices = await navigator.mediaDevices.enumerateDevices(); >+ let cameraID = undefined; >+ devices.forEach(device => { if (device.label == "Mock video device 2") cameraID = device.deviceId; }); >+ assert_true(cameraID !== undefined, "Found camera2"); >+ >+ stream = await navigator.mediaDevices.getUserMedia({ video: { deviceId: { exact: cameraID }, width: 480, height: 480 } }); >+ video.srcObject = stream; >+ await video.play(); >+ >+ const ctx = canvas.getContext("2d"); >+ ctx.drawImage(video, 0 ,0); >+ >+ assert_true(isPixelGray(ctx.getImageData(5, 5, 1, 1).data), "Pixel at 5x5 is not black."); >+ assert_true(isPixelGray(ctx.getImageData(10, 200, 1, 1).data), "Pixel at 10x200 is not black."); >+}, "Video frames are resized in letterbox-mode when captured at non-native size."); >+ >+ </script> >+ </head> >+</html> >diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations >index 4fcdaee86b175efa2262beac5c73c509089bf521..334e851bb0194e0b9a0cfd618bfac4cde9b45b11 100644 >--- a/LayoutTests/platform/gtk/TestExpectations >+++ b/LayoutTests/platform/gtk/TestExpectations >@@ -3709,7 +3709,7 @@ webkit.org/b/192883 fast/cookies/cookie-averse-document.html [ Failure ] > webkit.org/b/192883 fast/cookies/local-file-can-set-cookies.html [ Failure ] > > webkit.org/b/192886 fast/mediastream/media-stream-renders-first-frame.html [ Failure ] >-webkit.org/b/192888 fast/mediastream/resize-letterbox.html [ Failure ] >+webkit.org/b/192888 fast/mediastream/resize-trim.html [ Failure ] > > webkit.org/b/192900 imported/w3c/web-platform-tests/eventsource/format-mime-bogus.htm [ Failure ] >
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197722
:
369445
|
369451
| 369852