Skip to content

Commit

Permalink
[PeerConnection] Surface generated ICE candidates in localDescription.
Browse files Browse the repository at this point in the history
CL https://chromium-review.googlesource.com/c/chromium/src/+/2323359
implemented the spec-compliant behavior of having internal slots for
SDP as to not prematurely surface descriptions of pending SLD, SRD or
addIceCandidate operations.

But that CL forgot the changes to the localDescription due to ICE
candidates being generated and "onicecandidate" firing. This caused a
regression in M87.

This CL adds test coverage for this in WPT and fixes the bug by
surfacing all descriptions at OnIceCandidate.

// Fippo approved. TBR while hta is OOO
TBR=hta@chromium.org

Bug: chromium:1124384
Change-Id: Ifb11d6416772b87b9076ff6238e909928c66af6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390747
Reviewed-by: Henrik Boström <hbos@chromium.org>
Commit-Queue: Henrik Boström <hbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804267}
  • Loading branch information
henbos authored and chromium-wpt-export-bot committed Sep 3, 2020
1 parent d7d965c commit be34d90
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions webrtc/RTCPeerConnection-candidate-in-sdp.https.html
@@ -0,0 +1,26 @@
<!doctype html>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';

promise_test(async t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
let resolveIceCandidatePromise = null;
const iceCandidatePromise = new Promise(r => resolveIceCandidatePromise = r);
pc.onicecandidate = e => {
resolveIceCandidatePromise(pc.localDescription.sdp);
pc.onicecandidate = null;
}
pc.addTransceiver("audio");
await pc.setLocalDescription(await pc.createOffer());
assert_false(pc.localDescription.sdp.includes("a=candidate:"),
"localDescription is missing candidate before onicecandidate");
// The localDescription at the time of the onicecandidate event.
const localDescriptionSdp = await iceCandidatePromise;
assert_true(localDescriptionSdp.includes("a=candidate:"),
"localDescription contains candidate after onicecandidate");
}, 'localDescription contains candidates');
</script>

0 comments on commit be34d90

Please sign in to comment.