haikuwebkit/LayoutTests/webrtc/captureCanvas-webrtc.html

103 lines
3.2 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
[WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac https://bugs.webkit.org/show_bug.cgi?id=172602 <rdar://problem/32407693> Patch by Youenn Fablet <youenn@apple.com> on 2017-06-22 Reviewed by Eric Carlson. Source/ThirdParty/libwebrtc: Adding a parameter to disable hardware encoder. * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.h: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.mm: (webrtc::H264VideoToolboxEncoder::CreateCompressionSession): Source/WebCore: Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html Add internal API to switch on/off hardware H264 encoder. Add checks for standard size. If using a software encoder and frame size is not standard, the session is destroyed and no frame is sent at all. Added tests based on captureStream. Fixed the case of capturing a canvas which size is changing. * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized): * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h: * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm: (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed): (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed): (WebCore::isUsingSoftwareEncoder): (WebCore::H264VideoToolboxEncoder::CreateCompressionSession): (isStandardFrameSize): Added. (isUsingSoftwareEncoder): Added. * testing/Internals.cpp: (WebCore::Internals::setH264HardwareEncoderAllowed): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * platform/mac-wk1/TestExpectations: Mark captureCanvas as flaky due to AVDCreateGPUAccelerator: Error loading GPU renderer" appearing on some bots. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder-expected.txt: Copied from LayoutTests/webrtc/captureCanvas-webrtc-expected.txt. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: Added. * webrtc/captureCanvas-webrtc-expected.txt: * webrtc/captureCanvas-webrtc.html: Canonical link: https://commits.webkit.org/190583@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 15:29:14 +00:00
<canvas id="canvas1" width=320px height=240px></canvas>
<video id="video" autoplay></video>
<canvas id="canvas2" width=320px height=240px></canvas>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src ="routines.js"></script>
<script>
var color = "green";
function printCanvas()
{
var context = canvas1.getContext("2d");
context.fillStyle = color;
context.fillRect(0, 0, canvas1.width, canvas1.height);
}
function printRectangleEvery50ms()
{
printCanvas();
setTimeout(printRectangleEvery50ms, 50);
}
function testCanvas(testName, canvas, isSame, count)
[WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac https://bugs.webkit.org/show_bug.cgi?id=172602 <rdar://problem/32407693> Patch by Youenn Fablet <youenn@apple.com> on 2017-06-22 Reviewed by Eric Carlson. Source/ThirdParty/libwebrtc: Adding a parameter to disable hardware encoder. * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.h: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.mm: (webrtc::H264VideoToolboxEncoder::CreateCompressionSession): Source/WebCore: Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html Add internal API to switch on/off hardware H264 encoder. Add checks for standard size. If using a software encoder and frame size is not standard, the session is destroyed and no frame is sent at all. Added tests based on captureStream. Fixed the case of capturing a canvas which size is changing. * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized): * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h: * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm: (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed): (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed): (WebCore::isUsingSoftwareEncoder): (WebCore::H264VideoToolboxEncoder::CreateCompressionSession): (isStandardFrameSize): Added. (isUsingSoftwareEncoder): Added. * testing/Internals.cpp: (WebCore::Internals::setH264HardwareEncoderAllowed): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * platform/mac-wk1/TestExpectations: Mark captureCanvas as flaky due to AVDCreateGPUAccelerator: Error loading GPU renderer" appearing on some bots. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder-expected.txt: Copied from LayoutTests/webrtc/captureCanvas-webrtc-expected.txt. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: Added. * webrtc/captureCanvas-webrtc-expected.txt: * webrtc/captureCanvas-webrtc.html: Canonical link: https://commits.webkit.org/190583@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 15:29:14 +00:00
{
var array1 = canvas.getContext("2d").getImageData(20, 20, 60, 60).data;
[WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac https://bugs.webkit.org/show_bug.cgi?id=172602 <rdar://problem/32407693> Patch by Youenn Fablet <youenn@apple.com> on 2017-06-22 Reviewed by Eric Carlson. Source/ThirdParty/libwebrtc: Adding a parameter to disable hardware encoder. * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.h: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.mm: (webrtc::H264VideoToolboxEncoder::CreateCompressionSession): Source/WebCore: Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html Add internal API to switch on/off hardware H264 encoder. Add checks for standard size. If using a software encoder and frame size is not standard, the session is destroyed and no frame is sent at all. Added tests based on captureStream. Fixed the case of capturing a canvas which size is changing. * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized): * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h: * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm: (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed): (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed): (WebCore::isUsingSoftwareEncoder): (WebCore::H264VideoToolboxEncoder::CreateCompressionSession): (isStandardFrameSize): Added. (isUsingSoftwareEncoder): Added. * testing/Internals.cpp: (WebCore::Internals::setH264HardwareEncoderAllowed): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * platform/mac-wk1/TestExpectations: Mark captureCanvas as flaky due to AVDCreateGPUAccelerator: Error loading GPU renderer" appearing on some bots. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder-expected.txt: Copied from LayoutTests/webrtc/captureCanvas-webrtc-expected.txt. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: Added. * webrtc/captureCanvas-webrtc-expected.txt: * webrtc/captureCanvas-webrtc.html: Canonical link: https://commits.webkit.org/190583@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 15:29:14 +00:00
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]) > 100) {
[WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac https://bugs.webkit.org/show_bug.cgi?id=172602 <rdar://problem/32407693> Patch by Youenn Fablet <youenn@apple.com> on 2017-06-22 Reviewed by Eric Carlson. Source/ThirdParty/libwebrtc: Adding a parameter to disable hardware encoder. * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.h: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.mm: (webrtc::H264VideoToolboxEncoder::CreateCompressionSession): Source/WebCore: Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html Add internal API to switch on/off hardware H264 encoder. Add checks for standard size. If using a software encoder and frame size is not standard, the session is destroyed and no frame is sent at all. Added tests based on captureStream. Fixed the case of capturing a canvas which size is changing. * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized): * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h: * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm: (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed): (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed): (WebCore::isUsingSoftwareEncoder): (WebCore::H264VideoToolboxEncoder::CreateCompressionSession): (isStandardFrameSize): Added. (isUsingSoftwareEncoder): Added. * testing/Internals.cpp: (WebCore::Internals::setH264HardwareEncoderAllowed): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * platform/mac-wk1/TestExpectations: Mark captureCanvas as flaky due to AVDCreateGPUAccelerator: Error loading GPU renderer" appearing on some bots. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder-expected.txt: Copied from LayoutTests/webrtc/captureCanvas-webrtc-expected.txt. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: Added. * webrtc/captureCanvas-webrtc-expected.txt: * webrtc/captureCanvas-webrtc.html: Canonical link: https://commits.webkit.org/190583@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 15:29:14 +00:00
isEqual = false;
continue;
}
}
if (isEqual === isSame)
return Promise.resolve();
[WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac https://bugs.webkit.org/show_bug.cgi?id=172602 <rdar://problem/32407693> Patch by Youenn Fablet <youenn@apple.com> on 2017-06-22 Reviewed by Eric Carlson. Source/ThirdParty/libwebrtc: Adding a parameter to disable hardware encoder. * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.h: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.mm: (webrtc::H264VideoToolboxEncoder::CreateCompressionSession): Source/WebCore: Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html Add internal API to switch on/off hardware H264 encoder. Add checks for standard size. If using a software encoder and frame size is not standard, the session is destroyed and no frame is sent at all. Added tests based on captureStream. Fixed the case of capturing a canvas which size is changing. * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized): * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h: * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm: (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed): (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed): (WebCore::isUsingSoftwareEncoder): (WebCore::H264VideoToolboxEncoder::CreateCompressionSession): (isStandardFrameSize): Added. (isUsingSoftwareEncoder): Added. * testing/Internals.cpp: (WebCore::Internals::setH264HardwareEncoderAllowed): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * platform/mac-wk1/TestExpectations: Mark captureCanvas as flaky due to AVDCreateGPUAccelerator: Error loading GPU renderer" appearing on some bots. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder-expected.txt: Copied from LayoutTests/webrtc/captureCanvas-webrtc-expected.txt. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: Added. * webrtc/captureCanvas-webrtc-expected.txt: * webrtc/captureCanvas-webrtc.html: Canonical link: https://commits.webkit.org/190583@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 15:29:14 +00:00
if (count === 20)
return Promise.reject(testName + " failed, expected " + JSON.stringify(array1) + " but got " + JSON.stringify(array2));
Remove use of mock webrtc backend factory at injected bundle reset time https://bugs.webkit.org/show_bug.cgi?id=173817 Patch by Youenn Fablet <youenn@apple.com> on 2017-06-25 Reviewed by Darin Adler. Source/WebCore: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): Resetting the peer connection backend. * testing/MockLibWebRTCPeerConnection.cpp: Doing some clean-up (WebCore::useRealRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateVideoTrack): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateAudioTrack): * testing/MockLibWebRTCPeerConnection.h: LayoutTests: Making some tests less flaky. * TestExpectations: * fast/mediastream/RTCPeerConnection-media-setup-two-dialogs-expected.txt: * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: * webrtc/audio-peer-connection-webaudio.html: * webrtc/captureCanvas-webrtc.html: * webrtc/datachannel/bufferedAmountLowThreshold-default-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold-default.html: Added. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: * webrtc/datachannel/bufferedAmountLowThreshold.html: * webrtc/routines.js: * webrtc/video-replace-muted-track.html: * webrtc/video-unmute.html: Canonical link: https://commits.webkit.org/190676@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-25 18:06:06 +00:00
return waitFor(100).then(() => {
return testCanvas(testName, canvas, isSame, ++count);
[WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac https://bugs.webkit.org/show_bug.cgi?id=172602 <rdar://problem/32407693> Patch by Youenn Fablet <youenn@apple.com> on 2017-06-22 Reviewed by Eric Carlson. Source/ThirdParty/libwebrtc: Adding a parameter to disable hardware encoder. * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.h: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.mm: (webrtc::H264VideoToolboxEncoder::CreateCompressionSession): Source/WebCore: Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html Add internal API to switch on/off hardware H264 encoder. Add checks for standard size. If using a software encoder and frame size is not standard, the session is destroyed and no frame is sent at all. Added tests based on captureStream. Fixed the case of capturing a canvas which size is changing. * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized): * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h: * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm: (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed): (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed): (WebCore::isUsingSoftwareEncoder): (WebCore::H264VideoToolboxEncoder::CreateCompressionSession): (isStandardFrameSize): Added. (isUsingSoftwareEncoder): Added. * testing/Internals.cpp: (WebCore::Internals::setH264HardwareEncoderAllowed): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * platform/mac-wk1/TestExpectations: Mark captureCanvas as flaky due to AVDCreateGPUAccelerator: Error loading GPU renderer" appearing on some bots. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder-expected.txt: Copied from LayoutTests/webrtc/captureCanvas-webrtc-expected.txt. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: Added. * webrtc/captureCanvas-webrtc-expected.txt: * webrtc/captureCanvas-webrtc.html: Canonical link: https://commits.webkit.org/190583@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 15:29:14 +00:00
});
}
promise_test((test) => {
printRectangleEvery50ms();
return new Promise((resolve, reject) => {
createConnections((firstConnection) => {
var stream = canvas1.captureStream();
firstConnection.addTrack(stream.getVideoTracks()[0], stream);
}, (secondConnection) => {
secondConnection.ontrack = (trackEvent) => {
assert_true(trackEvent.track instanceof MediaStreamTrack);
assert_true(trackEvent.receiver instanceof RTCRtpReceiver);
assert_true(Array.isArray(trackEvent.streams), "Array.isArray() should return true");
assert_true(Object.isFrozen(trackEvent.streams), "Object.isFrozen() should return true");
resolve(trackEvent.streams[0]);
};
});
setTimeout(() => reject("Test timed out"), 5000);
}).then((stream) => {
video.srcObject = stream;
return video.play();
});
}, "Setting up the connection");
promise_test((test) => {
return testCanvas("test 1", canvas1, true);
}, "Checking canvas is green");
promise_test((test) => {
color = "red";
printCanvas()
return testCanvas("test 2", canvas1, true);
}, "Checking canvas is red");
promise_test((test) => {
color = "green";
printCanvas();
return testCanvas("test 3", canvas1, true);
}, "Checking canvas is green again");
[WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac https://bugs.webkit.org/show_bug.cgi?id=172602 <rdar://problem/32407693> Patch by Youenn Fablet <youenn@apple.com> on 2017-06-22 Reviewed by Eric Carlson. Source/ThirdParty/libwebrtc: Adding a parameter to disable hardware encoder. * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.h: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.mm: (webrtc::H264VideoToolboxEncoder::CreateCompressionSession): Source/WebCore: Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html Add internal API to switch on/off hardware H264 encoder. Add checks for standard size. If using a software encoder and frame size is not standard, the session is destroyed and no frame is sent at all. Added tests based on captureStream. Fixed the case of capturing a canvas which size is changing. * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized): * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h: * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm: (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed): (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed): (WebCore::isUsingSoftwareEncoder): (WebCore::H264VideoToolboxEncoder::CreateCompressionSession): (isStandardFrameSize): Added. (isUsingSoftwareEncoder): Added. * testing/Internals.cpp: (WebCore::Internals::setH264HardwareEncoderAllowed): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * platform/mac-wk1/TestExpectations: Mark captureCanvas as flaky due to AVDCreateGPUAccelerator: Error loading GPU renderer" appearing on some bots. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder-expected.txt: Copied from LayoutTests/webrtc/captureCanvas-webrtc-expected.txt. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: Added. * webrtc/captureCanvas-webrtc-expected.txt: * webrtc/captureCanvas-webrtc.html: Canonical link: https://commits.webkit.org/190583@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 15:29:14 +00:00
promise_test((test) => {
Remove use of mock webrtc backend factory at injected bundle reset time https://bugs.webkit.org/show_bug.cgi?id=173817 Patch by Youenn Fablet <youenn@apple.com> on 2017-06-25 Reviewed by Darin Adler. Source/WebCore: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): Resetting the peer connection backend. * testing/MockLibWebRTCPeerConnection.cpp: Doing some clean-up (WebCore::useRealRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateVideoTrack): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateAudioTrack): * testing/MockLibWebRTCPeerConnection.h: LayoutTests: Making some tests less flaky. * TestExpectations: * fast/mediastream/RTCPeerConnection-media-setup-two-dialogs-expected.txt: * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: * webrtc/audio-peer-connection-webaudio.html: * webrtc/captureCanvas-webrtc.html: * webrtc/datachannel/bufferedAmountLowThreshold-default-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold-default.html: Added. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: * webrtc/datachannel/bufferedAmountLowThreshold.html: * webrtc/routines.js: * webrtc/video-replace-muted-track.html: * webrtc/video-unmute.html: Canonical link: https://commits.webkit.org/190676@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-25 18:06:06 +00:00
canvas1.width = 640;
canvas1.height = 480;
printCanvas();
Remove use of mock webrtc backend factory at injected bundle reset time https://bugs.webkit.org/show_bug.cgi?id=173817 Patch by Youenn Fablet <youenn@apple.com> on 2017-06-25 Reviewed by Darin Adler. Source/WebCore: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): Resetting the peer connection backend. * testing/MockLibWebRTCPeerConnection.cpp: Doing some clean-up (WebCore::useRealRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateVideoTrack): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateAudioTrack): * testing/MockLibWebRTCPeerConnection.h: LayoutTests: Making some tests less flaky. * TestExpectations: * fast/mediastream/RTCPeerConnection-media-setup-two-dialogs-expected.txt: * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: * webrtc/audio-peer-connection-webaudio.html: * webrtc/captureCanvas-webrtc.html: * webrtc/datachannel/bufferedAmountLowThreshold-default-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold-default.html: Added. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: * webrtc/datachannel/bufferedAmountLowThreshold.html: * webrtc/routines.js: * webrtc/video-replace-muted-track.html: * webrtc/video-unmute.html: Canonical link: https://commits.webkit.org/190676@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-25 18:06:06 +00:00
return waitForVideoSize(video, 640, 480);
[WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac https://bugs.webkit.org/show_bug.cgi?id=172602 <rdar://problem/32407693> Patch by Youenn Fablet <youenn@apple.com> on 2017-06-22 Reviewed by Eric Carlson. Source/ThirdParty/libwebrtc: Adding a parameter to disable hardware encoder. * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.h: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.mm: (webrtc::H264VideoToolboxEncoder::CreateCompressionSession): Source/WebCore: Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html Add internal API to switch on/off hardware H264 encoder. Add checks for standard size. If using a software encoder and frame size is not standard, the session is destroyed and no frame is sent at all. Added tests based on captureStream. Fixed the case of capturing a canvas which size is changing. * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized): * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h: * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm: (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed): (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed): (WebCore::isUsingSoftwareEncoder): (WebCore::H264VideoToolboxEncoder::CreateCompressionSession): (isStandardFrameSize): Added. (isUsingSoftwareEncoder): Added. * testing/Internals.cpp: (WebCore::Internals::setH264HardwareEncoderAllowed): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * platform/mac-wk1/TestExpectations: Mark captureCanvas as flaky due to AVDCreateGPUAccelerator: Error loading GPU renderer" appearing on some bots. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder-expected.txt: Copied from LayoutTests/webrtc/captureCanvas-webrtc-expected.txt. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: Added. * webrtc/captureCanvas-webrtc-expected.txt: * webrtc/captureCanvas-webrtc.html: Canonical link: https://commits.webkit.org/190583@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 15:29:14 +00:00
}, "Checking canvas size change");
</script>
</head>
</html>