Skip to content

Commit

Permalink
Bug 1903761 [wpt PR 46840] - Add tests for if codec info surfaces at …
Browse files Browse the repository at this point in the history
…the right time., a=testonly

Automatic update from web-platform-tests
Add tests for if codec info surfaces at the right time.

In support of landing this spec PR:
w3c/webrtc-pc#2972

Bug: None
Change-Id: I698276ccf739a872d791fc0923c2725ec303fbd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5642762
Commit-Queue: Harald Alvestrand <[email protected]>
Reviewed-by: Florent Castelli <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1317347}

--

wpt-commits: 4d7ec06c827c841bfe9090a92521de6a2fb265cf
wpt-pr: 46840
  • Loading branch information
alvestrand authored and moz-wptsync-bot committed Jun 24, 2024
1 parent 3522cb2 commit 6b45fe6
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="dictionary-helper.js"></script>
<script src="RTCPeerConnection-helper.js"></script>
<script src="RTCRtpParameters-helper.js"></script>
<script>
'use strict';
Expand Down Expand Up @@ -70,4 +71,31 @@
assert_greater_than(param.headerExtensions.length, 0);
assert_greater_than(param.codecs.length, 0);
}, 'getParameters() with simulcast video receiver');

promise_test(async t => {
const stream = await getNoiseStream({video: true});
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
const [track] = stream.getTracks();
const caller = new RTCPeerConnection();
t.add_cleanup(() => caller.close());
caller.addTrack(track);
const callee = new RTCPeerConnection();
t.add_cleanup(() => callee.close());
callee.addTrack(track);
var callerReceiver = caller.getTransceivers()[0].receiver;
assert_equals(callerReceiver.getParameters().codecs.length, 0);
const offer = await caller.createOffer();
await caller.setLocalDescription(offer);
await callee.setRemoteDescription(offer);
var calleeReceiver = callee.getTransceivers()[0].receiver;
assert_equals(calleeReceiver.getParameters().codecs.length, 0);
const answer = await callee.createAnswer();
await callee.setLocalDescription(answer);
assert_greater_than(calleeReceiver.getParameters().codecs.length, 0,
"callee codecs after answer");
await caller.setRemoteDescription(answer);
assert_greater_than(callerReceiver.getParameters().codecs.length, 0,
"caller codecs after answer");
}, 'getParameters() surfaces codecs on two-way receiver at the right time');

</script>
40 changes: 40 additions & 0 deletions testing/web-platform/tests/webrtc/RTCRtpSender-getParameters.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!doctype html>
<meta charset=utf-8>
<title>RTCRtpSender.prototype.getParameters</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="dictionary-helper.js"></script>
<script src="RTCPeerConnection-helper.js"></script>
<script src="RTCRtpParameters-helper.js"></script>
<script>
'use strict';

promise_test(async t => {
const stream = await getNoiseStream({video: true});
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
const [track] = stream.getTracks();
const caller = new RTCPeerConnection();
t.add_cleanup(() => caller.close());
caller.addTrack(track);
const callee = new RTCPeerConnection();
t.add_cleanup(() => callee.close());
callee.addTrack(track);
var callerSender = caller.getTransceivers()[0].sender;
assert_equals(callerSender.getParameters().codecs.length, 0);
const offer = await caller.createOffer();
await caller.setLocalDescription(offer);
await callee.setRemoteDescription(offer);
// Check that it is a single 2-way transceiver.
assert_equals(callee.getTransceivers().length, 1);
var calleeSender = callee.getTransceivers()[0].sender;
assert_equals(calleeSender.getParameters().codecs.length, 0);
const answer = await callee.createAnswer();
await callee.setLocalDescription(answer);
assert_greater_than(calleeSender.getParameters().codecs.length, 0,
"callee codecs after answer");
await caller.setRemoteDescription(answer);
assert_greater_than(callerSender.getParameters().codecs.length, 0,
"caller codecs after answer");
}, 'getParameters() surfaces codecs on two-way sender with addTrack at the right time');

</script>

0 comments on commit 6b45fe6

Please sign in to comment.