blob: 79653045200e667f405a749ae6f51a083dc1f99d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
<!doctype html>
<meta charset=utf-8>
<title>RTCRtpParameters rtcp</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="dictionary-helper.js"></script>
<script src="RTCRtpParameters-helper.js"></script>
<script>
'use strict';
// Test is based on the following editor draft:
// https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html
// The following helper functions are called from RTCRtpParameters-helper.js:
// validateSenderRtpParameters
/*
5.2. RTCRtpSender Interface
interface RTCRtpSender {
Promise<void> setParameters(optional RTCRtpParameters parameters);
RTCRtpParameters getParameters();
};
dictionary RTCRtpParameters {
DOMString transactionId;
sequence<RTCRtpEncodingParameters> encodings;
sequence<RTCRtpHeaderExtensionParameters> headerExtensions;
RTCRtcpParameters rtcp;
sequence<RTCRtpCodecParameters> codecs;
};
dictionary RTCRtcpParameters {
[readonly]
DOMString cname;
[readonly]
boolean reducedSize;
};
getParameters
- rtcp.cname is set to the CNAME of the associated RTCPeerConnection.
rtcp.reducedSize is set to true if reduced-size RTCP has been negotiated for
sending, and false otherwise.
*/
/*
5.2. setParameters
7. If parameters.encodings.length is different from N, or if any parameter
in the parameters argument, marked as a Read-only parameter, has a value
that is different from the corresponding parameter value returned from
sender.getParameters(), abort these steps and return a promise rejected
with a newly created InvalidModificationError. Note that this also applies
to transactionId.
*/
promise_test(t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const { sender } = pc.addTransceiver('audio');
const param = sender.getParameters();
validateSenderRtpParameters(param);
const { rtcp } = param;
if(rtcp === undefined) {
param.rtcp = { cname: 'foo' };
} else if(rtcp.cname === undefined) {
rtcp.cname = 'foo';
} else {
rtcp.cname = `${rtcp.cname}-modified`;
}
return promise_rejects_dom(t, 'InvalidModificationError',
sender.setParameters(param));
}, `setParameters() with modified rtcp.cname should reject with InvalidModificationError`);
promise_test(t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const { sender } = pc.addTransceiver('audio');
const param = sender.getParameters();
validateSenderRtpParameters(param);
const { rtcp } = param;
if(rtcp === undefined) {
param.rtcp = { reducedSize: true };
} else if(rtcp.reducedSize === undefined) {
rtcp.reducedSize = true;
} else {
rtcp.reducedSize = !rtcp.reducedSize;
}
return promise_rejects_dom(t, 'InvalidModificationError',
sender.setParameters(param));
}, `setParameters() with modified rtcp.reducedSize should reject with InvalidModificationError`);
</script>
|