Remote simulcast reoffer can be rolled back
My starting point.
by jib1
HTML
<script src="https://jan-ivar.github.io/dummy/testharness.js"></script>
<script src="https://rawgit.com/web-platform-tests/wpt/master/webrtc/third_party/sdp/sdp.js"></script>
<script src="https://rawgit.com/web-platform-tests/wpt/master/webrtc/simulcast/simulcast.js"></script>
<script src="https://webrtchacks.github.io/adapter/adapter-latest.js"></script>
On Oct 7 2022, Chrome/Edge, Safari, and Firefox (with adapter.js) all
FAIL Remote reoffer simulcast reoffer to narrow simulcast envelope can be rolled back.: - Expected 3, got 1 failed
JavaScript
const offer2 = `v=0
o=- 3840232462471583827 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0
a=msid-semantic: WMS
m=video 9 UDP/TLS/RTP/SAVPF 96
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:Li6+
a=ice-pwd:3C05CTZBRQVmGCAq7hVasHlT
a=ice-options:trickle
a=fingerprint:sha-256 5B:D3:8E:66:0E:7D:D3:F3:8E:E6:80:28:19:FC:55:AD:58:5D:B9:3D:A8:DE:45:4A:E7:87:02:F8:3C:0B:3B:B3
a=setup:actpass
a=mid:0
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=recvonly
a=rtcp-mux
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rid:foo recv
a=rid:bar recv
a=rid:baz recv
a=simulcast:recv foo;bar
`;
const offer3 = offer2.replace('a=simulcast:recv foo;bar',
'a=simulcast:recv foo;bar;baz');
const offer1 = offer2.replace('a=simulcast:recv foo;bar',
'a=simulcast:recv foo');
const offer0 = offer2.replace('a=simulcast:recv foo;bar',
'a=noop');
promise_test(async t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
await pc.setRemoteDescription({type: 'offer', sdp: offer3});
await pc.setLocalDescription();
const transceivers = pc.getTransceivers();
assert_equals(transceivers.length, 1, 'Expected one transceiver');
const [{sender}] = transceivers;
const dump = () => console.log(`Encodings: ${sender.getParameters().encodings?.map(e => e.rid)}`);
dump();
await pc.setRemoteDescription({type: 'offer', sdp: offer1});
dump();
await pc.setRemoteDescription({type: 'rollback'});
dump();
assert_equals(sender.getParameters().encodings.length, 3);
}, "Remote reoffer simulcast reoffer to narrow simulcast envelope can be rolled back.");