Diff
Modified: trunk/LayoutTests/ChangeLog (218509 => 218510)
--- trunk/LayoutTests/ChangeLog 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/LayoutTests/ChangeLog 2017-06-19 21:27:05 UTC (rev 218510)
@@ -1,3 +1,18 @@
+2017-06-19 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r218505.
+ https://bugs.webkit.org/show_bug.cgi?id=173563
+
+ "It would break internal builds" (Requested by youenn on
+ #webkit).
+
+ Reverted changeset:
+
+ "[WebRTC] Prevent capturing at unconventional resolutions when
+ using the SW encoder on Mac"
+ https://bugs.webkit.org/show_bug.cgi?id=172602
+ http://trac.webkit.org/changeset/218505
+
2017-06-19 Youenn Fablet <you...@apple.com>
[WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (218509 => 218510)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2017-06-19 21:27:05 UTC (rev 218510)
@@ -98,7 +98,7 @@
imported/w3c/web-platform-tests/webrtc [ Skip ]
webrtc [ Skip ]
webrtc/datachannel [ Pass ]
-webrtc/captureCanvas-webrtc.html [ Failure Pass ]
+webrtc/captureCanvas-webrtc.html [ Pass ]
# These tests test the Shadow DOM based HTML form validation UI but Mac WK1 is using native dialogs instead.
fast/forms/validation-message-on-listbox.html
Modified: trunk/LayoutTests/webrtc/captureCanvas-webrtc-expected.txt (218509 => 218510)
--- trunk/LayoutTests/webrtc/captureCanvas-webrtc-expected.txt 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/LayoutTests/webrtc/captureCanvas-webrtc-expected.txt 2017-06-19 21:27:05 UTC (rev 218510)
@@ -1,8 +1,7 @@
-
+
PASS Setting up the connection
PASS Checking canvas is green
PASS Checking canvas is red
PASS Checking canvas is green again
-PASS Checking canvas size change
Modified: trunk/LayoutTests/webrtc/captureCanvas-webrtc.html (218509 => 218510)
--- trunk/LayoutTests/webrtc/captureCanvas-webrtc.html 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/LayoutTests/webrtc/captureCanvas-webrtc.html 2017-06-19 21:27:05 UTC (rev 218510)
@@ -1,50 +1,27 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
- <canvas id="canvas1" width=320px height=240px></canvas>
- <video id="video" autoplay></video>
- <canvas id="canvas2" width=320px height=240px></canvas>
+ <canvas id="canvas1" width=100px height=100px></canvas>
+ <video id="video" autoplay width=100px height=100px></video>
+ <canvas id="canvas2" width=100px height=100px></canvas>
<script src=""
<script src=""
<script src =""
<script>
+var canvas1 = document.getElementById("canvas1");
+var canvas2 = document.getElementById("canvas2");
+var video = document.getElementById("video");
+
var color = "green";
function printRectangle()
{
var context = canvas1.getContext("2d");
context.fillStyle = color;
- context.fillRect(0, 0, 320, 240);
+ context.fillRect(0, 0, 100, 100);
setTimeout(printRectangle, 50);
}
-function testCanvas(testName, array1, isSame, count)
-{
- if (count === undefined)
- count = 0;
- canvas2.getContext("2d").drawImage(video, 0 ,0);
- array2 = canvas2.getContext("2d").getImageData(20, 20, 60, 60).data;
- var isEqual = true;
- var index = 0;
- for (index = 0; index < array1.length; ++index) {
- // Rough comparison since we are compressing data.
- // This test still catches errors since we are going from green to blue to red.
- if (Math.abs(array1[index] - array2[index]) > 40) {
- isEqual = false;
- continue;
- }
- }
- if (isEqual === isSame)
- return;
-
- if (count === 20)
- return Promise.reject(testName + " failed, expected " + JSON.stringify(array1) + " but got " + JSON.stringify(array2));
-
- return waitFor(50).then(() => {
- return testCanvas(testName, array1, isSame, ++count);
- });
-}
-
promise_test((test) => {
printRectangle();
return new Promise((resolve, reject) => {
@@ -69,7 +46,8 @@
promise_test((test) => {
return waitFor(100).then(() => {
- return testCanvas("test 1", canvas1.getContext("2d").getImageData(20, 20, 60, 60).data, true);
+ canvas2.getContext("2d").drawImage(video, 0 ,0);
+ assert_array_equals(canvas2.getContext("2d").getImageData(20 ,20, 60, 60), canvas1.getContext("2d").getImageData(20, 20, 60, 60));
});
}, "Checking canvas is green");
@@ -76,7 +54,8 @@
promise_test((test) => {
color = "red";
return waitFor(300).then(() => {
- return testCanvas("test 2", canvas1.getContext("2d").getImageData(20, 20, 60, 60).data, true);
+ canvas2.getContext("2d").drawImage(video, 0 ,0);
+ assert_array_equals(canvas2.getContext("2d").getImageData(20 ,20, 60, 60), canvas1.getContext("2d").getImageData(20, 20, 60, 60));
});
}, "Checking canvas is red");
@@ -84,15 +63,10 @@
promise_test((test) => {
color = "green";
return waitFor(300).then(() => {
- return testCanvas("test 3", canvas1.getContext("2d").getImageData(20, 20, 60, 60).data, true);
+ canvas2.getContext("2d").drawImage(video, 0 ,0);
+ assert_array_equals(canvas2.getContext("2d").getImageData(20 ,20, 60, 60), canvas1.getContext("2d").getImageData(20, 20, 60, 60));
});
}, "Checking canvas is green again");
-
-promise_test((test) => {
- canvas1.width = 640;
- canvas1.height = 480;
- return waitForVideoSize(video, 640, 480);
-}, "Checking canvas size change");
</script>
</head>
</html>
Modified: trunk/LayoutTests/webrtc/routines.js (218509 => 218510)
--- trunk/LayoutTests/webrtc/routines.js 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/LayoutTests/webrtc/routines.js 2017-06-19 21:27:05 UTC (rev 218510)
@@ -141,7 +141,7 @@
if (count === undefined)
count = 0;
if (++count > 20)
- return Promise.reject("waitForVideoSize timed out, expected " + width + "x"+ height + " but got " + video.videoWidth + "x" + video.videoHeight);
+ return Promise.reject("waitForVideoSize timed out");
return waitFor(50).then(() => {
return waitForVideoSize(video, width, height, count);
Modified: trunk/LayoutTests/webrtc/video.html (218509 => 218510)
--- trunk/LayoutTests/webrtc/video.html 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/LayoutTests/webrtc/video.html 2017-06-19 21:27:05 UTC (rev 218510)
@@ -43,7 +43,7 @@
if (window.testRunner)
testRunner.setUserMediaPermission(true);
- return navigator.mediaDevices.getUserMedia({video: {advanced: [{width:{min:1280}}, {height:{min:720} } ]}}).then((stream) => {
+ return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => {
return new Promise((resolve, reject) => {
createConnections((firstConnection) => {
var track = stream.getVideoTracks()[0];
Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (218509 => 218510)
--- trunk/Source/ThirdParty/libwebrtc/ChangeLog 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog 2017-06-19 21:27:05 UTC (rev 218510)
@@ -1,3 +1,18 @@
+2017-06-19 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r218505.
+ https://bugs.webkit.org/show_bug.cgi?id=173563
+
+ "It would break internal builds" (Requested by youenn on
+ #webkit).
+
+ Reverted changeset:
+
+ "[WebRTC] Prevent capturing at unconventional resolutions when
+ using the SW encoder on Mac"
+ https://bugs.webkit.org/show_bug.cgi?id=172602
+ http://trac.webkit.org/changeset/218505
+
2017-06-19 Youenn Fablet <you...@apple.com>
[WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h (218509 => 218510)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h 2017-06-19 21:27:05 UTC (rev 218510)
@@ -69,12 +69,12 @@
ScalingSettings GetScalingSettings() const override;
protected:
- virtual int CreateCompressionSession(VTCompressionSessionRef&, VTCompressionOutputCallback, int32_t width, int32_t height, bool useHardwareAcceleratedVideoEncoder = true);
- void DestroyCompressionSession();
+ virtual int CreateCompressionSession(VTCompressionSessionRef&, VTCompressionOutputCallback, int32_t width, int32_t height);
private:
int ResetCompressionSession();
void ConfigureCompressionSession();
+ void DestroyCompressionSession();
rtc::scoped_refptr<VideoFrameBuffer> GetScaledBufferOnEncode(
const rtc::scoped_refptr<VideoFrameBuffer>& frame);
void SetBitrateBps(uint32_t bitrate_bps);
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.mm (218509 => 218510)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.mm 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.mm 2017-06-19 21:27:05 UTC (rev 218510)
@@ -533,7 +533,7 @@
return WEBRTC_VIDEO_CODEC_OK;
}
-int H264VideoToolboxEncoder::CreateCompressionSession(VTCompressionSessionRef& compressionSession, VTCompressionOutputCallback outputCallback, int32_t width, int32_t height, bool useHardwareAcceleratedVideoEncoder) {
+int H264VideoToolboxEncoder::CreateCompressionSession(VTCompressionSessionRef& compressionSession, VTCompressionOutputCallback outputCallback, int32_t width, int32_t height) {
// Set source image buffer attributes. These attributes will be present on
// buffers retrieved from the encoder's pixel buffer pool.
const size_t attributes_size = 3;
@@ -566,7 +566,7 @@
#if defined(WEBRTC_USE_VTB_HARDWARE_ENCODER)
CFTypeRef sessionKeys[] = {kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder};
- CFTypeRef sessionValues[] = {useHardwareAcceleratedVideoEncoder ? kCFBooleanTrue : kCFBooleanFalse};
+ CFTypeRef sessionValues[] = {kCFBooleanTrue};
CFDictionaryRef encoderSpecification = internal::CreateCFDictionary(sessionKeys, sessionValues, 1);
#else
CFDictionaryRef encoderSpecification = nullptr;
Modified: trunk/Source/WebCore/ChangeLog (218509 => 218510)
--- trunk/Source/WebCore/ChangeLog 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/Source/WebCore/ChangeLog 2017-06-19 21:27:05 UTC (rev 218510)
@@ -1,3 +1,18 @@
+2017-06-19 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r218505.
+ https://bugs.webkit.org/show_bug.cgi?id=173563
+
+ "It would break internal builds" (Requested by youenn on
+ #webkit).
+
+ Reverted changeset:
+
+ "[WebRTC] Prevent capturing at unconventional resolutions when
+ using the SW encoder on Mac"
+ https://bugs.webkit.org/show_bug.cgi?id=172602
+ http://trac.webkit.org/changeset/218505
+
2017-06-19 Zalan Bujtas <za...@apple.com>
Opening certain mails brings up a mail that grows indefinitely.
Modified: trunk/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp (218509 => 218510)
--- trunk/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp 2017-06-19 21:27:05 UTC (rev 218510)
@@ -115,8 +115,6 @@
m_settings.setWidth(m_canvas->width());
m_settings.setHeight(m_canvas->height());
-
- settingsDidChange();
}
void CanvasCaptureMediaStreamTrack::Source::canvasChanged(HTMLCanvasElement& canvas, const FloatRect&)
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h (218509 => 218510)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h 2017-06-19 21:27:05 UTC (rev 218510)
@@ -35,11 +35,9 @@
class H264VideoToolboxEncoder final : public webrtc::H264VideoToolboxEncoder {
public:
explicit H264VideoToolboxEncoder(const cricket::VideoCodec& codec) : webrtc::H264VideoToolboxEncoder(codec) { }
- WEBCORE_EXPORT static void setHardwareEncoderForWebRTCAllowed(bool);
- static bool hardwareEncoderForWebRTCAllowed();
private:
- int CreateCompressionSession(VTCompressionSessionRef&, VTCompressionOutputCallback, int32_t width, int32_t height, bool useHardwareAcceleratedVideoEncoder) final;
+ int CreateCompressionSession(VTCompressionSessionRef&, VTCompressionOutputCallback, int32_t width, int32_t height) final;
};
}
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm (218509 => 218510)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm 2017-06-19 21:27:05 UTC (rev 218510)
@@ -26,54 +26,8 @@
#include "config.h"
#include "H264VideoToolBoxEncoder.h"
-#include "Logging.h"
-
#if USE(LIBWEBRTC) && PLATFORM(COCOA)
-namespace WebCore {
-
-static bool isHardwareEncoderForWebRTCAllowed = true;
-
-void H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed(bool allowed)
-{
- isHardwareEncoderForWebRTCAllowed = allowed;
-}
-
-bool H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed()
-{
- return isHardwareEncoderForWebRTCAllowed;
-}
-
-#if PLATFORM(MAC) && ENABLE(MAC_VIDEO_TOOLBOX)
-static inline bool isStandardFrameSize(int32_t width, int32_t height)
-{
- // FIXME: Envision relaxing this rule, something like width and height dividable by 4 or 8 should be good enough.
- if (width == 1280)
- return height == 720;
- if (width == 720)
- return height == 1280;
- if (width == 960)
- return height == 540;
- if (width == 540)
- return height == 960;
- if (width == 640)
- return height == 480;
- if (width == 480)
- return height == 640;
- if (width == 288)
- return height == 352;
- if (width == 352)
- return height == 288;
- if (width == 320)
- return height == 240;
- if (width == 240)
- return height == 320;
- return false;
-}
-#endif
-
-}
-
#if ENABLE(MAC_VIDEO_TOOLBOX) && USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/VideoToolBoxEncoderMac.mm>)
#import <WebKitAdditions/VideoToolBoxEncoderMac.mm>
#else
@@ -80,41 +34,10 @@
namespace WebCore {
-#if PLATFORM(MAC) && ENABLE(MAC_VIDEO_TOOLBOX)
-static inline bool isUsingSoftwareEncoder(VTCompressionSessionRef& compressionSession)
+int H264VideoToolboxEncoder::CreateCompressionSession(VTCompressionSessionRef& compressionSession, VTCompressionOutputCallback outputCallback, int32_t width, int32_t height)
{
- CFNumberRef useHardwareEncoderValue = nullptr;
- OSStatus statusGetter = VTSessionCopyProperty(compressionSession, kVTCompressionPropertyKey_UsingHardwareAcceleratedVideoEncoder, nullptr, &useHardwareEncoderValue);
- if (statusGetter || !useHardwareEncoderValue)
- return true;
-
- int useHardwareEncoder = 0;
- CFNumberGetValue(useHardwareEncoderValue, kCFNumberIntType, &useHardwareEncoder);
- CFRelease(useHardwareEncoderValue);
-
- return useHardwareEncoder;
+ return webrtc::H264VideoToolboxEncoder::CreateCompressionSession(compressionSession, outputCallback, width, height);
}
-#endif
-
-int H264VideoToolboxEncoder::CreateCompressionSession(VTCompressionSessionRef& compressionSession, VTCompressionOutputCallback outputCallback, int32_t width, int32_t height, bool useHardwareAcceleratedVideoEncoder)
-{
- int result = webrtc::H264VideoToolboxEncoder::CreateCompressionSession(compressionSession, outputCallback, width, height, hardwareEncoderForWebRTCAllowed() ? useHardwareAcceleratedVideoEncoder : false);
- if (result)
- return result;
-
-#if PLATFORM(MAC) && ENABLE(MAC_VIDEO_TOOLBOX)
- if (!isUsingSoftwareEncoder(compressionSession))
- return 0;
-
- if (!isStandardFrameSize(width, height)) {
- RELEASE_LOG(WebRTC, "Using H264 software encoder with non standard size is not supported");
- DestroyCompressionSession();
- return -1;
- }
- RELEASE_LOG(WebRTC, "Using H264 software encoder");
-#endif
- return 0;
-}
}
#endif
Modified: trunk/Source/WebCore/testing/Internals.cpp (218509 => 218510)
--- trunk/Source/WebCore/testing/Internals.cpp 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/Source/WebCore/testing/Internals.cpp 2017-06-19 21:27:05 UTC (rev 218510)
@@ -209,10 +209,6 @@
#include "MockMediaPlayerMediaSource.h"
#endif
-#if USE(LIBWEBRTC) && PLATFORM(COCOA)
-#include "H264VideoToolboxEncoder.h"
-#endif
-
#if PLATFORM(MAC)
#include "DictionaryLookup.h"
#endif
@@ -4042,17 +4038,6 @@
page.setActivityState(state);
}
-#if ENABLE(WEB_RTC)
-void Internals::setH264HardwareEncoderAllowed(bool allowed)
-{
-#if PLATFORM(MAC)
- H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed(allowed);
-#else
- UNUSED_PARAM(allowed);
-#endif
-}
-#endif
-
#if ENABLE(MEDIA_STREAM)
void Internals::setCameraMediaStreamTrackOrientation(MediaStreamTrack& track, int orientation)
Modified: trunk/Source/WebCore/testing/Internals.h (218509 => 218510)
--- trunk/Source/WebCore/testing/Internals.h 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/Source/WebCore/testing/Internals.h 2017-06-19 21:27:05 UTC (rev 218510)
@@ -579,10 +579,6 @@
void setPageVisibility(bool isVisible);
-#if ENABLE(WEB_RTC)
- void setH264HardwareEncoderAllowed(bool allowed);
-#endif
-
#if ENABLE(MEDIA_STREAM)
void setCameraMediaStreamTrackOrientation(MediaStreamTrack&, int orientation);
ExceptionOr<void> setMediaDeviceState(const String& id, const String& property, bool value);
Modified: trunk/Source/WebCore/testing/Internals.idl (218509 => 218510)
--- trunk/Source/WebCore/testing/Internals.idl 2017-06-19 21:22:56 UTC (rev 218509)
+++ trunk/Source/WebCore/testing/Internals.idl 2017-06-19 21:27:05 UTC (rev 218510)
@@ -537,7 +537,6 @@
void setPageVisibility(boolean isVisible);
- [Conditional=WEB_RTC] void setH264HardwareEncoderAllowed(boolean allowed);
[Conditional=WEB_RTC] void applyRotationForOutgoingVideoSources(RTCPeerConnection connection);
[Conditional=MEDIA_STREAM] void setCameraMediaStreamTrackOrientation(MediaStreamTrack track, short orientation);