Changeset 245289 in webkit
- Timestamp:
- May 14, 2019 10:43:19 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r245286 r245289 1 2019-05-14 Youenn Fablet <youenn@apple.com> 2 3 Video frame resizing should be using Trim 4 https://bugs.webkit.org/show_bug.cgi?id=197722 5 <rdar://problem/50602188> 6 7 Reviewed by Eric Carlson. 8 9 * fast/mediastream/resize-trim-expected.txt: Renamed from LayoutTests/fast/mediastream/resize-letterbox-expected.txt. 10 * fast/mediastream/resize-trim.html: Renamed from LayoutTests/fast/mediastream/resize-letterbox.html. 11 * platform/gtk/TestExpectations: 12 1 13 2019-05-14 Antoine Quint <graouts@apple.com> 2 14 -
trunk/LayoutTests/fast/mediastream/resize-trim.html
r245288 r245289 8 8 <script> 9 9 10 const canvas = document.getElementById("canvas");11 const video = document.getElementById("video");12 13 function isPixelBlack(pixel)14 {15 return pixel[0] === 0 && pixel[1] === 0 && pixel[2] === 0 && pixel[3] === 255;16 }17 18 10 function isPixelGray(pixel) 19 11 { 20 12 return pixel[0] === 128 && pixel[1] === 128 && pixel[2] === 128 && pixel[3] === 255; 21 }22 23 function logPixel(name, pixel)24 {25 console.log(`${name}: ${pixel[0]}, ${pixel[1]}, ${pixel[2]}, ${pixel[3]}`);26 }27 28 function checkCanvas(canvas, stream)29 {30 return new Promise((resolve, reject) => {31 video.srcObject = stream;32 video.onplay = () => {33 const ctx = canvas.getContext("2d");34 ctx.drawImage(video, 0 ,0);35 36 try {37 setTimeout(() => {38 assert_true(isPixelBlack(ctx.getImageData(5, 5, 1, 1).data), "Pixel at 5x5 is NOT from camera.");39 assert_true(isPixelGray(ctx.getImageData(50, 200, 1, 1).data), "Pixel at 50x200 is from camera.");40 resolve();41 }, 500);42 } catch(err) {43 reject(err);44 return;45 }46 }47 });48 13 } 49 14 … … 58 23 59 24 stream = await navigator.mediaDevices.getUserMedia({ video: { deviceId: { exact: cameraID }, width: 480, height: 480 } }); 25 video.srcObject = stream; 26 await video.play(); 60 27 61 return checkCanvas(canvas, stream); 28 const ctx = canvas.getContext("2d"); 29 ctx.drawImage(video, 0 ,0); 62 30 31 assert_true(isPixelGray(ctx.getImageData(5, 5, 1, 1).data), "Pixel at 5x5 is not black."); 32 assert_true(isPixelGray(ctx.getImageData(10, 200, 1, 1).data), "Pixel at 10x200 is not black."); 63 33 }, "Video frames are resized in letterbox-mode when captured at non-native size."); 64 34 -
trunk/LayoutTests/platform/gtk/TestExpectations
r245074 r245289 3710 3710 3711 3711 webkit.org/b/192886 fast/mediastream/media-stream-renders-first-frame.html [ Failure ] 3712 webkit.org/b/192888 fast/mediastream/resize- letterbox.html [ Failure ]3712 webkit.org/b/192888 fast/mediastream/resize-trim.html [ Failure ] 3713 3713 3714 3714 webkit.org/b/192900 imported/w3c/web-platform-tests/eventsource/format-mime-bogus.htm [ Failure ] -
trunk/Source/WebCore/ChangeLog
r245288 r245289 1 2019-05-14 Youenn Fablet <youenn@apple.com> 2 3 Video frame resizing should be using Trim 4 https://bugs.webkit.org/show_bug.cgi?id=197722 5 <rdar://problem/50602188> 6 7 Reviewed by Eric Carlson. 8 9 Move from letter box to trim mode for resizing. 10 This ensures no black stripes are present when rendering the stream. 11 12 Test: fast/mediastream/resize-trim.html 13 14 * platform/cocoa/VideoToolboxSoftLink.cpp: 15 * platform/cocoa/VideoToolboxSoftLink.h: 16 * platform/graphics/cv/ImageTransferSessionVT.mm: 17 (WebCore::ImageTransferSessionVT::ImageTransferSessionVT): 18 1 19 2019-05-14 Yusuke Suzuki <ysuzuki@apple.com> 2 20 -
trunk/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp
r243109 r245289 65 65 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTPixelTransferPropertyKey_ScalingMode, CFStringRef) 66 66 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTScalingMode_Letterbox, CFStringRef) 67 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTScalingMode_Trim, CFStringRef) 67 68 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTPixelTransferPropertyKey_EnableHardwareAcceleratedTransfer, CFStringRef) 68 69 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTPixelTransferPropertyKey_EnableHighSpeedTransfer, CFStringRef) -
trunk/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h
r243109 r245289 92 92 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, VideoToolbox, kVTScalingMode_Letterbox, CFStringRef) 93 93 #define kVTScalingMode_Letterbox get_VideoToolbox_kVTScalingMode_Letterbox() 94 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, VideoToolbox, kVTScalingMode_Trim, CFStringRef) 95 #define kVTScalingMode_Trim get_VideoToolbox_kVTScalingMode_Trim() 94 96 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, VideoToolbox, kVTPixelTransferPropertyKey_EnableHardwareAcceleratedTransfer, CFStringRef) 95 97 #define kVTPixelTransferPropertyKey_EnableHardwareAcceleratedTransfer get_VideoToolbox_kVTPixelTransferPropertyKey_EnableHardwareAcceleratedTransfer() -
trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm
r239016 r245289 60 60 m_transferSession = adoptCF(transferSession); 61 61 62 auto status = VTSessionSetProperty(transferSession, kVTPixelTransferPropertyKey_ScalingMode, kVTScalingMode_ Letterbox);62 auto status = VTSessionSetProperty(transferSession, kVTPixelTransferPropertyKey_ScalingMode, kVTScalingMode_Trim); 63 63 if (status != kCVReturnSuccess) 64 64 RELEASE_LOG(Media, "ImageTransferSessionVT::ImageTransferSessionVT: VTSessionSetProperty(kVTPixelTransferPropertyKey_ScalingMode) failed with error %d", static_cast<int>(status));
Note: See TracChangeset
for help on using the changeset viewer.