зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1665933 [wpt PR 25624] - [VideoStreamEncoder] Add a WPT that reproduces a VSE crash., a=testonly
Automatic update from web-platform-tests [VideoStreamEncoder] Add a WPT that reproduces a VSE crash. When we are encoding the same MediaStreamTrack multiple times there is a race that causes VideoStreamEncoder to crash. To aid debugging, this CL adds WPT test coverage for it. Bug: webrtc:11485 Change-Id: I0cb2b1b1528521755c18d5c6117b60fc053480dd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2418376 Commit-Queue: Henrik Boström <hbos@chromium.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@chromium.org> Cr-Commit-Position: refs/heads/master@{#808796} -- wpt-commits: 7445e5a1333218b9f7a193d1b2d7c7e5f4419402 wpt-pr: 25624
This commit is contained in:
Родитель
f21544e835
Коммит
2d7ec17f70
|
@ -0,0 +1,66 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title></title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="RTCPeerConnection-helper.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
// A generous testing duration that will not time out on bots.
|
||||
const kEncodeDurationMs = 10000;
|
||||
|
||||
// The crash this test aims to repro was easy to reproduce using a normal
|
||||
// getUserMedia() track when running the browser normally, e.g. by navigating
|
||||
// to https://jsfiddle.net/henbos/fc7gk3ve/11/. But for some reason, the fake
|
||||
// tracks returned by getUserMedia() when inside this testing environment had
|
||||
// a much harder time with reproducibility.
|
||||
//
|
||||
// By creating a high FPS canvas capture track we are able to repro reliably
|
||||
// in this WPT environment as well.
|
||||
function whiteNoise(width, height) {
|
||||
const canvas =
|
||||
Object.assign(document.createElement('canvas'), {width, height});
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
const p = ctx.getImageData(0, 0, width, height);
|
||||
requestAnimationFrame(function draw () {
|
||||
for (let i = 0; i < p.data.length; i++) {
|
||||
const color = Math.random() * 255;
|
||||
p.data[i++] = color;
|
||||
p.data[i++] = color;
|
||||
p.data[i++] = color;
|
||||
}
|
||||
ctx.putImageData(p, 0, 0);
|
||||
requestAnimationFrame(draw);
|
||||
});
|
||||
return canvas.captureStream();
|
||||
}
|
||||
|
||||
promise_test(async t => {
|
||||
const pc1 = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc1.close());
|
||||
const pc2 = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc2.close());
|
||||
|
||||
const stream = whiteNoise(640, 480);
|
||||
const [track] = stream.getTracks();
|
||||
const t1 = pc1.addTransceiver("video", {direction:"sendonly"});
|
||||
const t2 = pc1.addTransceiver("video", {direction:"sendonly"});
|
||||
await t1.sender.replaceTrack(track);
|
||||
await t2.sender.replaceTrack(track);
|
||||
|
||||
exchangeIceCandidates(pc1, pc2);
|
||||
await pc1.setLocalDescription();
|
||||
await pc2.setRemoteDescription(pc1.localDescription);
|
||||
await pc2.setLocalDescription();
|
||||
await pc1.setRemoteDescription(pc2.localDescription);
|
||||
|
||||
// In Chromium, each sender instantiates a VideoStreamEncoder during
|
||||
// negotiation. This test reproduces https://crbug.com/webrtc/11485 where a
|
||||
// race causes a crash when multiple VideoStreamEncoders are encoding the
|
||||
// same MediaStreamTrack.
|
||||
await new Promise(resolve => t.step_timeout(resolve, kEncodeDurationMs));
|
||||
}, "Two RTCRtpSenders encoding the same track");
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче