Skip to content

Commit

Permalink
Wire scalabilityMode to webrtc encoding parameter scalability_mode
Browse files Browse the repository at this point in the history
Bug: 986069
Change-Id: Id1b10e9b589f947a5fcd1a08ae926bca890fe3e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2623011
Reviewed-by: Harald Alvestrand <hta@chromium.org>
Reviewed-by: Danil Chapovalov <danilchap@chromium.org>
Commit-Queue: Danil Chapovalov <danilchap@chromium.org>
Cr-Commit-Position: refs/heads/master@{#879370}
  • Loading branch information
murillo128 authored and chromium-wpt-export-bot committed May 5, 2021
1 parent 49d9c78 commit b350e86
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions webrtc-svc/RTCRtpParameters-scalability.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<script src="/resources/testharnessreport.js"></script>
<script src="/webrtc/dictionary-helper.js"></script>
<script src="/webrtc/RTCRtpParameters-helper.js"></script>
<script src="/webrtc/RTCPeerConnection-helper.js"></script>
<script>
'use strict';

Expand All @@ -19,6 +20,36 @@
return encodings[0];
}

const capabilities = RTCRtpSender.getCapabilities('video');
let index = 0;
for (const codec of capabilities.codecs) {
if ('scalabilityModes' in codec && codec.scalabilityModes.length > 0) {
for (const scalabilityMode of codec.scalabilityModes) {
promise_test(async t => {
const v = document.createElement('video');
v.autoplay = true;
const pc1 = new RTCPeerConnection();
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
t.add_cleanup(() => pc2.close());
const stream1 = await getNoiseStream({ video: { signal: 100 , width: 60, height: 60} });
const [track1] = stream1.getTracks();
t.add_cleanup(() => track1.stop());
const transceiver = pc1.addTransceiver(track1, {
sendEncodings: [{ scalabilityMode: scalabilityMode }],
});
transceiver.setCodecPreferences([codec]);
const haveTrackEvent = new Promise(r => pc2.ontrack = r);
exchangeIceCandidates(pc1, pc2);
await exchangeOfferAnswer(pc1, pc2);
v.srcObject = new MediaStream([(await haveTrackEvent).track]);
await new Promise(r => v.onloadedmetadata = r);
await detectSignal(t, v, 100);
}, `[${index++}] ${codec.mimeType} - ${scalabilityMode} should produce valid video content`);
}
}
}

promise_test(async t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
Expand Down

0 comments on commit b350e86

Please sign in to comment.