haikuwebkit/LayoutTests/webrtc/video-rotation.html

122 lines
4.5 KiB
HTML
Raw Permalink Normal View History

RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testing video rotation in basic video exchange </title>
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<video id="localVideo" autoplay playsInline width="320" height="240"></video>
<video id="remoteVideo" autoplay playsInline width="320" height="240"></video>
<canvas id="canvas0" width="320" height="240"></canvas>
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
<canvas id="canvas1" width="320" height="240"></canvas>
<canvas id="canvas2" width="320" height="240"></canvas>
<canvas id="canvas3" width="320" height="240"></canvas>
<script src ="routines.js"></script>
<script>
function isVideoBlack(video, canvasId)
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
{
var canvas = document.getElementById(canvasId);
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
imageData = canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height);
data = imageData.data;
for (var cptr = 0; cptr < canvas.width * canvas.height; ++cptr) {
// Approximatively black pixels.
if (data[4 * cptr] > 30 || data[4 * cptr + 1] > 30 || data[4 * cptr + 2] > 30)
return false;
}
return true;
}
function pollVideoBlackCheck(expected, video, canvasId, resolve)
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
{
if (isVideoBlack(video, canvasId) === expected) {
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
resolve();
return;
}
setTimeout(() => pollVideoBlackCheck(expected, video, canvasId, resolve), 100);
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
}
function checkVideoBlack(expected, video, canvasId)
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
{
return new Promise((resolve, reject) => {
pollVideoBlackCheck(expected, video, canvasId, resolve);
setTimeout(() => reject("checkVideoBlack timed out for '" + canvasId + "', expected " + expected), 5000);
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
});
}
var track;
promise_test((test) => {
if (window.testRunner)
testRunner.setUserMediaPermission(true);
return navigator.mediaDevices.getUserMedia({video: {width: 320, height: 240, facingMode: "environment"}}).then((localStream) => {
localVideo.srcObject = localStream;
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
return new Promise((resolve, reject) => {
track = localStream.getVideoTracks()[0];
createConnections((firstConnection) => {
firstConnection.addTrack(track, localStream);
if (window.internals)
internals.applyRotationForOutgoingVideoSources(firstConnection);
}, (secondConnection) => {
secondConnection.ontrack = (trackEvent) => {
resolve(trackEvent.streams[0]);
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
};
});
setTimeout(() => reject("Test timed out"), 5000);
});
}).then((remoteStream) => {
remoteVideo.srcObject = remoteStream;
return remoteVideo.play();
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
});
}, "Setting video exchange");
promise_test(async (test) => {
await checkVideoBlack(false, remoteVideo, "canvas0");
await waitForVideoSize(remoteVideo, 320, 240);
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
}, "Track is enabled, video should not be black");
promise_test(async (test) => {
await checkVideoBlack(false, localVideo, "canvas0");
await waitForVideoSize(localVideo, 320, 240);
if (window.internals)
window.internals.setCameraMediaStreamTrackOrientation(track, 90);
Add support for camera rotation when capturing in UIProcess https://bugs.webkit.org/show_bug.cgi?id=204750 Reviewed by Eric Carlson. Source/WebKit: Make UserMediaCaptureManagerProxy have an OrientationNotifier. It is updated by each web page of the web process being notified of a device orientation change. Whenever a rotation happens, UIProcess sources are now notified to correctly compute the frame rotations. Covered by existing tests. * UIProcess/API/C/WKPage.cpp: (WKPageSetMockCameraOrientation): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): (WebKit::UserMediaCaptureManagerProxy::setOrientation): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setOrientationForMediaCapture): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::userMediaCaptureManagerProxy): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::setDeviceOrientation): Tools: Add test runner API to set the device rotation specifically for mock camera devices. * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockCameraOrientation): * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::setMockCameraOrientation): * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): LayoutTests: * webrtc/video-rotation.html: Capture in UIProcess on Cocoa port and make use of test runner API to simulate device rotation. Canonical link: https://commits.webkit.org/218010@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253045 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-03 16:28:22 +00:00
if (window.testRunner)
testRunner.setMockCameraOrientation(90);
await checkVideoBlack(false, localVideo, "canvas1");
await waitForVideoSize(localVideo, 240, 320);
}, "Track is enabled and rotated, local video should not be black and should change size");
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
promise_test((test) => {
if (window.internals)
window.internals.setCameraMediaStreamTrackOrientation(track, 90);
Add support for camera rotation when capturing in UIProcess https://bugs.webkit.org/show_bug.cgi?id=204750 Reviewed by Eric Carlson. Source/WebKit: Make UserMediaCaptureManagerProxy have an OrientationNotifier. It is updated by each web page of the web process being notified of a device orientation change. Whenever a rotation happens, UIProcess sources are now notified to correctly compute the frame rotations. Covered by existing tests. * UIProcess/API/C/WKPage.cpp: (WKPageSetMockCameraOrientation): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): (WebKit::UserMediaCaptureManagerProxy::setOrientation): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setOrientationForMediaCapture): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::userMediaCaptureManagerProxy): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::setDeviceOrientation): Tools: Add test runner API to set the device rotation specifically for mock camera devices. * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockCameraOrientation): * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::setMockCameraOrientation): * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): LayoutTests: * webrtc/video-rotation.html: Capture in UIProcess on Cocoa port and make use of test runner API to simulate device rotation. Canonical link: https://commits.webkit.org/218010@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253045 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-03 16:28:22 +00:00
if (window.testRunner)
testRunner.setMockCameraOrientation(90);
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
return checkVideoBlack(false, remoteVideo, "canvas2").then(() => {
return waitForVideoSize(remoteVideo, 240, 320);
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
});
}, "Track is enabled and rotated, remote video should not be black and should change size");
promise_test((test) => {
if (window.internals)
window.internals.setCameraMediaStreamTrackOrientation(track, 180);
Add support for camera rotation when capturing in UIProcess https://bugs.webkit.org/show_bug.cgi?id=204750 Reviewed by Eric Carlson. Source/WebKit: Make UserMediaCaptureManagerProxy have an OrientationNotifier. It is updated by each web page of the web process being notified of a device orientation change. Whenever a rotation happens, UIProcess sources are now notified to correctly compute the frame rotations. Covered by existing tests. * UIProcess/API/C/WKPage.cpp: (WKPageSetMockCameraOrientation): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): (WebKit::UserMediaCaptureManagerProxy::setOrientation): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setOrientationForMediaCapture): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::userMediaCaptureManagerProxy): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::setDeviceOrientation): Tools: Add test runner API to set the device rotation specifically for mock camera devices. * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockCameraOrientation): * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::setMockCameraOrientation): * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): LayoutTests: * webrtc/video-rotation.html: Capture in UIProcess on Cocoa port and make use of test runner API to simulate device rotation. Canonical link: https://commits.webkit.org/218010@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253045 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-03 16:28:22 +00:00
if (window.testRunner)
testRunner.setMockCameraOrientation(180);
return checkVideoBlack(false, remoteVideo, "canvas3").then(() => {
return waitForVideoSize(remoteVideo, 320, 240);
});
}, "Track is enabled and rotated again, video should not be black and should change size");
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
</script>
</body>
</html>