| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var USER_MEDIA_TAB_ID = 'user-media-tab-id'; | 5 var USER_MEDIA_TAB_ID = 'user-media-tab-id'; |
| 6 | 6 |
| 7 var tabView = null; | 7 var tabView = null; |
| 8 var ssrcInfoManager = null; | 8 var ssrcInfoManager = null; |
| 9 var peerConnectionUpdateTable = null; | 9 var peerConnectionUpdateTable = null; |
| 10 var statsTable = null; | 10 var statsTable = null; |
| 11 var dumpCreator = null; | 11 var dumpCreator = null; |
| 12 /** A map from peer connection id to the PeerConnectionRecord. */ | 12 /** A map from peer connection id to the PeerConnectionRecord. */ |
| 13 var peerConnectionDataStore = {}; | 13 var peerConnectionDataStore = {}; |
| 14 /** A list of getUserMedia requests. */ | 14 /** A list of getUserMedia requests. */ |
| 15 var userMediaRequests = []; | 15 var userMediaRequests = []; |
| 16 | 16 |
| 17 /** A simple class to store the updates and stats data for a peer connection. */ | 17 /** A simple class to store the updates and stats data for a peer connection. */ |
| 18 var PeerConnectionRecord = (function() { | 18 var PeerConnectionRecord = (function() { |
| 19 /** @constructor */ | 19 /** @constructor */ |
| 20 function PeerConnectionRecord() { | 20 function PeerConnectionRecord() { |
| 21 /** @private */ | 21 /** @private */ |
| 22 this.record_ = { | 22 this.record_ = { |
| 23 constraints: {}, | 23 constraints: {}, |
| 24 servers: [], | 24 rtcConfiguration: [], |
| 25 stats: {}, | 25 stats: {}, |
| 26 updateLog: [], | 26 updateLog: [], |
| 27 url: '', | 27 url: '', |
| 28 }; | 28 }; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 PeerConnectionRecord.prototype = { | 31 PeerConnectionRecord.prototype = { |
| 32 /** @override */ | 32 /** @override */ |
| 33 toJSON: function() { | 33 toJSON: function() { |
| 34 return this.record_; | 34 return this.record_; |
| 35 }, | 35 }, |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Adds the initilization info of the peer connection. | 38 * Adds the initilization info of the peer connection. |
| 39 * @param {string} url The URL of the web page owning the peer connection. | 39 * @param {string} url The URL of the web page owning the peer connection. |
| 40 * @param {Array} servers STUN servers used by the peer connection. | 40 * @param {Array} rtcConfiguration |
| 41 * @param {!Object} constraints Media constraints. | 41 * @param {!Object} constraints Media constraints. |
| 42 */ | 42 */ |
| 43 initialize: function(url, servers, constraints) { | 43 initialize: function(url, rtcConfiguration, constraints) { |
| 44 this.record_.url = url; | 44 this.record_.url = url; |
| 45 this.record_.servers = servers; | 45 this.record_.rtcConfiguration = rtcConfiguration; |
| 46 this.record_.constraints = constraints; | 46 this.record_.constraints = constraints; |
| 47 }, | 47 }, |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * @param {string} dataSeriesId The TimelineDataSeries identifier. | 50 * @param {string} dataSeriesId The TimelineDataSeries identifier. |
| 51 * @return {!TimelineDataSeries} | 51 * @return {!TimelineDataSeries} |
| 52 */ | 52 */ |
| 53 getDataSeries: function(dataSeriesId) { | 53 getDataSeries: function(dataSeriesId) { |
| 54 return this.record_.stats[dataSeriesId]; | 54 return this.record_.stats[dataSeriesId]; |
| 55 }, | 55 }, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 if (element) { | 182 if (element) { |
| 183 delete peerConnectionDataStore[element.id]; | 183 delete peerConnectionDataStore[element.id]; |
| 184 tabView.removeTab(element.id); | 184 tabView.removeTab(element.id); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 | 188 |
| 189 /** | 189 /** |
| 190 * Adds a peer connection. | 190 * Adds a peer connection. |
| 191 * | 191 * |
| 192 * @param {!Object} data The object containing the pid, lid, url, servers, and | 192 * @param {!Object} data The object containing the pid, lid, url, |
| 193 * constraints of a peer connection. | 193 * rtcConfiguration, and constraints of a peer connection. |
| 194 */ | 194 */ |
| 195 function addPeerConnection(data) { | 195 function addPeerConnection(data) { |
| 196 var id = getPeerConnectionId(data); | 196 var id = getPeerConnectionId(data); |
| 197 | 197 |
| 198 if (!peerConnectionDataStore[id]) { | 198 if (!peerConnectionDataStore[id]) { |
| 199 peerConnectionDataStore[id] = new PeerConnectionRecord(); | 199 peerConnectionDataStore[id] = new PeerConnectionRecord(); |
| 200 } | 200 } |
| 201 peerConnectionDataStore[id].initialize( | 201 peerConnectionDataStore[id].initialize( |
| 202 data.url, data.servers, data.constraints); | 202 data.url, data.rtcConfiguration, data.constraints); |
| 203 | 203 |
| 204 var peerConnectionElement = $(id); | 204 var peerConnectionElement = $(id); |
| 205 if (!peerConnectionElement) { | 205 if (!peerConnectionElement) { |
| 206 peerConnectionElement = tabView.addTab(id, data.url + ' [' + id + ']'); | 206 peerConnectionElement = tabView.addTab(id, data.url + ' [' + id + ']'); |
| 207 } | 207 } |
| 208 peerConnectionElement.innerHTML = | 208 peerConnectionElement.innerHTML = |
| 209 '<p>' + data.url + ' ' + data.servers + ' ' + data.constraints + | 209 '<p>' + data.url + ' ' + data.rtcConfiguration + ' ' + data.constraints + |
| 210 '</p>'; | 210 '</p>'; |
| 211 | 211 |
| 212 return peerConnectionElement; | 212 return peerConnectionElement; |
| 213 } | 213 } |
| 214 | 214 |
| 215 | 215 |
| 216 /** | 216 /** |
| 217 * Adds a peer connection update. | 217 * Adds a peer connection update. |
| 218 * | 218 * |
| 219 * @param {!PeerConnectionUpdateEntry} data The peer connection update data. | 219 * @param {!PeerConnectionUpdateEntry} data The peer connection update data. |
| 220 */ | 220 */ |
| 221 function updatePeerConnection(data) { | 221 function updatePeerConnection(data) { |
| 222 var peerConnectionElement = $(getPeerConnectionId(data)); | 222 var peerConnectionElement = $(getPeerConnectionId(data)); |
| 223 addPeerConnectionUpdate(peerConnectionElement, data); | 223 addPeerConnectionUpdate(peerConnectionElement, data); |
| 224 } | 224 } |
| 225 | 225 |
| 226 | 226 |
| 227 /** | 227 /** |
| 228 * Adds the information of all peer connections created so far. | 228 * Adds the information of all peer connections created so far. |
| 229 * | 229 * |
| 230 * @param {Array.<!Object>} data An array of the information of all peer | 230 * @param {Array.<!Object>} data An array of the information of all peer |
| 231 * connections. Each array item contains pid, lid, url, servers, | 231 * connections. Each array item contains pid, lid, url, rtcConfiguration, |
| 232 * constraints, and an array of updates as the log. | 232 * constraints, and an array of updates as the log. |
| 233 */ | 233 */ |
| 234 function updateAllPeerConnections(data) { | 234 function updateAllPeerConnections(data) { |
| 235 for (var i = 0; i < data.length; ++i) { | 235 for (var i = 0; i < data.length; ++i) { |
| 236 var peerConnection = addPeerConnection(data[i]); | 236 var peerConnection = addPeerConnection(data[i]); |
| 237 | 237 |
| 238 var log = data[i].log; | 238 var log = data[i].log; |
| 239 if (!log) | 239 if (!log) |
| 240 continue; | 240 continue; |
| 241 for (var j = 0; j < log.length; ++j) { | 241 for (var j = 0; j < log.length; ++j) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 dumpCreator.disableAecRecording(); | 328 dumpCreator.disableAecRecording(); |
| 329 } | 329 } |
| 330 | 330 |
| 331 | 331 |
| 332 /** | 332 /** |
| 333 * Set | 333 * Set |
| 334 */ | 334 */ |
| 335 function enableAecRecording() { | 335 function enableAecRecording() { |
| 336 dumpCreator.enableAecRecording(); | 336 dumpCreator.enableAecRecording(); |
| 337 } | 337 } |
| OLD | NEW |