Bug 1673606 [wpt PR 26305] - webrtc wpt: add test for payload type demuxing, a=testonly

Automatic update from web-platform-tests
webrtc wpt: add test for payload type demuxing

and rename the file

BUG=webrtc:12029

Change-Id: I52753f98686715a19f910d7d0ff883e55a840722
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500842
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Reviewed-by: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823921}

--

wpt-commits: c36cb1e4eb48d0ed90ef3249ee47d26f71e234a1
wpt-pr: 26305
This commit is contained in:
Philipp Hancke 2020-11-05 14:19:57 +00:00 коммит произвёл moz-wptsync-bot
Родитель 5ce774185c
Коммит 60e4ba3636
2 изменённых файлов: 108 добавлений и 56 удалений

Просмотреть файл

@ -0,0 +1,108 @@
<!doctype html>
<meta charset=utf-8>
<title>RTCPeerConnection payload type demuxing</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../RTCPeerConnection-helper.js"></script>
<script>
'use strict';
promise_test(async t => {
const caller = new RTCPeerConnection();
t.add_cleanup(() => caller.close());
const callee = new RTCPeerConnection();
t.add_cleanup(() => callee.close());
exchangeIceCandidates(caller, callee);
const stream = await getNoiseStream({video: true});
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
stream.getTracks().forEach(track => caller.addTrack(track, stream));
stream.getTracks().forEach(track => caller.addTrack(track.clone(), stream.clone()));
let callCount = 0;
let metadataToBeLoaded = new Promise(resolve => {
callee.ontrack = (e) => {
const stream = e.streams[0];
const v = document.createElement('video');
v.autoplay = true;
v.srcObject = stream;
v.id = stream.id
v.addEventListener('loadedmetadata', () => {
if (++callCount === 2) {
resolve();
}
});
};
});
// Restrict first transceiver to VP8, second to H264.
const {codecs} = RTCRtpSender.getCapabilities('video');
const vp8 = codecs.find(c => c.mimeType === 'video/VP8');
const h264 = codecs.find(c => c.mimeType === 'video/H264');
caller.getTransceivers()[0].setCodecPreferences([vp8]);
caller.getTransceivers()[1].setCodecPreferences([h264]);
const offer = await caller.createOffer();
// Replace the mid header extension and all ssrc lines
// with bogus. The receiver will be forced to do payload type demuxing.
const sdp = offer.sdp
.replace(/rtp-hdrext:sdes/g, 'rtp-hdrext:something')
.replace(/a=ssrc:/g, 'a=notssrc');
await callee.setRemoteDescription({type: 'offer', sdp});
await caller.setLocalDescription(offer);
const answer = await callee.createAnswer();
await caller.setRemoteDescription(answer);
await callee.setLocalDescription(answer);
await metadataToBeLoaded;
}, 'Can demux two video tracks with different payload types on a bundled connection');
promise_test(async t => {
const caller = new RTCPeerConnection({bundlePolicy: 'max-compat'});
t.add_cleanup(() => caller.close());
const callee = new RTCPeerConnection();
t.add_cleanup(() => callee.close());
exchangeIceCandidates(caller, callee);
const stream = await getNoiseStream({video: true});
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
stream.getTracks().forEach(track => caller.addTrack(track, stream));
stream.getTracks().forEach(track => caller.addTrack(track.clone(), stream.clone()));
let callCount = 0;
let metadataToBeLoaded = new Promise(resolve => {
callee.ontrack = (e) => {
const stream = e.streams[0];
const v = document.createElement('video');
v.autoplay = true;
v.srcObject = stream;
v.id = stream.id
v.addEventListener('loadedmetadata', () => {
if (++callCount === 2) {
resolve();
}
});
};
});
const offer = await caller.createOffer();
// Replace BUNDLE, the mid header extension and all ssrc lines
// with bogus. The receiver will be forced to do payload type demuxing
// which is still possible because the different m-lines arrive on
// different ports/sockets.
const sdp = offer.sdp.replace('BUNDLE', 'SOMETHING')
.replace(/rtp-hdrext:sdes/g, 'rtp-hdrext:something')
.replace(/a=ssrc:/g, 'a=notssrc');
await callee.setRemoteDescription({type: 'offer', sdp});
await caller.setLocalDescription(offer);
const answer = await callee.createAnswer();
await caller.setRemoteDescription(answer);
await callee.setLocalDescription(answer);
await metadataToBeLoaded;
}, 'Can demux two video tracks with the same payload type on an unbundled connection');
</script>

Просмотреть файл

@ -1,56 +0,0 @@
<!doctype html>
<meta charset=utf-8>
<title>RTCPeerConnection payload type demuxing for unbundled connections</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../RTCPeerConnection-helper.js"></script>
<script>
'use strict';
promise_test(async t => {
const caller = new RTCPeerConnection({bundlePolicy: 'max-compat'});
t.add_cleanup(() => caller.close());
const callee = new RTCPeerConnection();
t.add_cleanup(() => callee.close());
const stream = await getNoiseStream({video: true});
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
stream.getTracks().forEach(track => caller.addTrack(track, stream));
stream.getTracks().forEach(track => caller.addTrack(track.clone(), stream.clone()));
let callCount = 0;
let metadataToBeLoaded = new Promise(resolve => {
callee.ontrack = (e) => {
const stream = e.streams[0];
const v = document.createElement('video');
v.autoplay = true;
v.srcObject = stream;
v.id = stream.id
v.addEventListener('loadedmetadata', () => {
if (++callCount === 2) {
resolve();
}
});
};
});
exchangeIceCandidates(caller, callee);
const offer = await caller.createOffer();
// Replace BUNDLE, the mid header extension and all ssrc lines
// with bogus. The receiver will be forced to do payload type demuxing
// which is still possible because the different m-lines arrive on
// different ports/sockets.
const sdp = offer.sdp.replace('BUNDLE', 'SOMETHING')
.replace(/rtp-hdrext:sdes/g, 'rtp-hdrext:something')
.replace(/a=ssrc:/g, 'a=notssrc');
await callee.setRemoteDescription({type: 'offer', sdp});
await caller.setLocalDescription(offer);
const answer = await callee.createAnswer();
await caller.setRemoteDescription(answer);
await callee.setLocalDescription(answer);
await metadataToBeLoaded;
}, 'Can demux two video tracks on an unbundled connection by payload type');
</script>