Skip to content

Commit 5990ba4

Browse files
authored
trickle-ice: show url and relayProtocol if present (#1561)
* trickle-ice: show url and relayProtocol if present note: this will work in M105+ once https://chromiumdash.appspot.com/commit/1fe14f2752a35932bea6d6ccff7433a6716c6391 is available It will attempt to polyfill the url attribute from stats
1 parent 83ff607 commit 5990ba4

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

src/content/peerconnection/trickle-ice/css/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,7 @@ th:nth-child(6),td:nth-child(6) {
6969
#error-note {
7070
display: none;
7171
}
72+
73+
div#container {
74+
max-width: 90em;
75+
}

src/content/peerconnection/trickle-ice/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,11 @@ <h2>ICE options</h2>
125125
<th>Address</th>
126126
<th>Port</th>
127127
<th>Priority</th>
128+
<th>relayProtocol (if present)</th>
128129
<th>Mid</th>
129130
<th>MLine Index</th>
130131
<th>Username Fragment</th>
132+
<th>URL (if present)</th>
131133
</tr>
132134
</thead>
133135
<tbody id="candidatesBody"></tbody>

src/content/peerconnection/trickle-ice/js/main.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,7 @@ function getFinalResult() {
202202
const server = JSON.parse(servers[0].value);
203203

204204
// get the candidates types (host, srflx, relay)
205-
const types = candidates.map(function(cand) {
206-
return cand.type;
207-
});
205+
const types = candidates.map((cand) => cand.type);
208206

209207
// If the server is a TURN server we should have a relay candidate.
210208
// If we did not get a relay candidate but a srflx candidate
@@ -231,7 +229,7 @@ function getFinalResult() {
231229
return result;
232230
}
233231

234-
function iceCallback(event) {
232+
async function iceCallback(event) {
235233
const elapsed = ((window.performance.now() - begin) / 1000).toFixed(3);
236234
const row = document.createElement('tr');
237235
appendCell(row, elapsed);
@@ -240,16 +238,31 @@ function iceCallback(event) {
240238
return;
241239
}
242240
const {candidate} = event;
241+
let url;
242+
// Until url is available from the candidate, to to polyfill.
243+
if (['srflx', 'relay'].includes(candidate.type) && !candidate.url) {
244+
const stats = await pc.getStats();
245+
stats.forEach(report => {
246+
if (!url && report.type === 'local-candidate' &&
247+
report.address === candidate.address &&
248+
report.port === candidate.port) {
249+
url = report.url;
250+
}
251+
});
252+
}
253+
243254
appendCell(row, candidate.component);
244255
appendCell(row, candidate.type);
245256
appendCell(row, candidate.foundation);
246257
appendCell(row, candidate.protocol);
247258
appendCell(row, candidate.address);
248259
appendCell(row, candidate.port);
249260
appendCell(row, formatPriority(candidate.priority));
261+
appendCell(row, candidate.relayProtocol || '');
250262
appendCell(row, candidate.sdpMid);
251263
appendCell(row, candidate.sdpMLineIndex);
252264
appendCell(row, candidate.usernameFragment);
265+
appendCell(row, candidate.url || url || '');
253266
candidates.push(candidate);
254267
}
255268
candidateTBody.appendChild(row);

0 commit comments

Comments
 (0)