summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webrtc-priority/RTCRtpParameters-encodings.html
blob: 1519ee84f736c1a4be4e87834fcf069c7c80ac7b (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
<!doctype html>
<meta charset=utf-8>
<title>RTCRtpParameters encodings</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../webrtc/dictionary-helper.js"></script>
<script src="../webrtc/RTCRtpParameters-helper.js"></script>
<script>
  'use strict';

  promise_test(async t => {
    const pc = new RTCPeerConnection();
    t.add_cleanup(() => pc.close());
    const { sender } = pc.addTransceiver('video', {
      sendEncodings: [{
        active: false,
        priority: 'low',
        networkPriority: 'low',
        maxBitrate: 8,
        maxFramerate: 25,
        rid: 'foo'
      }]
    });
    await doOfferAnswerExchange(t, pc);

    const param = sender.getParameters();
    validateSenderRtpParameters(param);
    const encoding = param.encodings[0];

    assert_equals(encoding.active, false);
    assert_equals(encoding.priority, 'low');
    assert_equals(encoding.networkPriority, 'low');
  }, `sender.getParameters() should return sendEncodings set by addTransceiver()`);

  test_modified_encoding('audio', 'active', false, true,
    'setParameters() with modified encoding.active should succeed');

  test_modified_encoding('audio', 'priority', 'very-low', 'high',
    'setParameters() with modified encoding.priority should succeed');

  test_modified_encoding('audio', 'networkPriority', 'very-low', 'high',
    'setParameters() with modified encoding.networkPriority should succeed');

</script>