|
Lines 50-55
function checkVideoBlack(expected, video, canvasId)
a/LayoutTests/webrtc/video-rotation.html_sec1
|
| 50 |
}); |
50 |
}); |
| 51 |
} |
51 |
} |
| 52 |
|
52 |
|
|
|
53 |
async function waitForTrackRotation(track, angle, counter) |
| 54 |
{ |
| 55 |
if (!window.internals) |
| 56 |
return; |
| 57 |
|
| 58 |
if (!counter) { |
| 59 |
internals.observeMediaStreamTrack(track); |
| 60 |
counter = 1; |
| 61 |
} |
| 62 |
|
| 63 |
await new Promise(resolve => setTimeout(resolve, 50)); |
| 64 |
const value = await internals.mediaStreamTrackVideoFrameRotation() |
| 65 |
if (angle === value) |
| 66 |
return; |
| 67 |
|
| 68 |
if (++counter > 50) |
| 69 |
return Promise.reject("waitForTrackRotation timed out with value " + value + " while expecting " + angle); |
| 70 |
|
| 71 |
return waitForTrackRotation(track, angle, counter); |
| 72 |
} |
| 73 |
|
| 53 |
var track; |
74 |
var track; |
| 54 |
promise_test((test) => { |
75 |
promise_test((test) => { |
| 55 |
if (window.testRunner) |
76 |
if (window.testRunner) |
|
Lines 62-69
promise_test((test) => {
a/LayoutTests/webrtc/video-rotation.html_sec2
|
| 62 |
|
83 |
|
| 63 |
createConnections((firstConnection) => { |
84 |
createConnections((firstConnection) => { |
| 64 |
firstConnection.addTrack(track, localStream); |
85 |
firstConnection.addTrack(track, localStream); |
| 65 |
if (window.internals) |
|
|
| 66 |
internals.applyRotationForOutgoingVideoSources(firstConnection); |
| 67 |
}, (secondConnection) => { |
86 |
}, (secondConnection) => { |
| 68 |
secondConnection.ontrack = (trackEvent) => { |
87 |
secondConnection.ontrack = (trackEvent) => { |
| 69 |
resolve(trackEvent.streams[0]); |
88 |
resolve(trackEvent.streams[0]); |
|
Lines 95-120
promise_test(async (test) => {
a/LayoutTests/webrtc/video-rotation.html_sec3
|
| 95 |
await waitForVideoSize(localVideo, 240, 320); |
114 |
await waitForVideoSize(localVideo, 240, 320); |
| 96 |
}, "Track is enabled and rotated, local video should not be black and should change size"); |
115 |
}, "Track is enabled and rotated, local video should not be black and should change size"); |
| 97 |
|
116 |
|
| 98 |
promise_test((test) => { |
117 |
promise_test(async (test) => { |
| 99 |
if (window.internals) |
118 |
if (window.internals) |
| 100 |
window.internals.setCameraMediaStreamTrackOrientation(track, 90); |
119 |
window.internals.setCameraMediaStreamTrackOrientation(track, 90); |
| 101 |
if (window.testRunner) |
120 |
if (window.testRunner) |
| 102 |
testRunner.setMockCameraOrientation(90); |
121 |
testRunner.setMockCameraOrientation(90); |
| 103 |
|
122 |
|
| 104 |
return checkVideoBlack(false, remoteVideo, "canvas2").then(() => { |
123 |
await checkVideoBlack(false, remoteVideo, "canvas2").then(() => { |
| 105 |
return waitForVideoSize(remoteVideo, 240, 320); |
124 |
return waitForVideoSize(remoteVideo, 240, 320); |
| 106 |
}); |
125 |
}); |
|
|
126 |
|
| 127 |
await waitForTrackRotation(remoteVideo.srcObject.getVideoTracks()[0], 90); |
| 107 |
}, "Track is enabled and rotated, remote video should not be black and should change size"); |
128 |
}, "Track is enabled and rotated, remote video should not be black and should change size"); |
| 108 |
|
129 |
|
| 109 |
promise_test((test) => { |
130 |
promise_test(async (test) => { |
| 110 |
if (window.internals) |
131 |
if (window.internals) |
| 111 |
window.internals.setCameraMediaStreamTrackOrientation(track, 180); |
132 |
window.internals.setCameraMediaStreamTrackOrientation(track, 180); |
| 112 |
if (window.testRunner) |
133 |
if (window.testRunner) |
| 113 |
testRunner.setMockCameraOrientation(180); |
134 |
testRunner.setMockCameraOrientation(180); |
| 114 |
|
135 |
|
| 115 |
return checkVideoBlack(false, remoteVideo, "canvas3").then(() => { |
136 |
await checkVideoBlack(false, remoteVideo, "canvas3").then(() => { |
| 116 |
return waitForVideoSize(remoteVideo, 320, 240); |
137 |
return waitForVideoSize(remoteVideo, 320, 240); |
| 117 |
}); |
138 |
}); |
|
|
139 |
|
| 140 |
await waitForTrackRotation(remoteVideo.srcObject.getVideoTracks()[0], 180); |
| 118 |
}, "Track is enabled and rotated again, video should not be black and should change size"); |
141 |
}, "Track is enabled and rotated again, video should not be black and should change size"); |
| 119 |
</script> |
142 |
</script> |
| 120 |
</body> |
143 |
</body> |