| 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 tabView = null; | 5 var tabView = null; |
| 6 var ssrcInfoManager = null; | 6 var ssrcInfoManager = null; |
| 7 var peerConnectionUpdateTable = null; | 7 var peerConnectionUpdateTable = null; |
| 8 var statsTable = null; | 8 var statsTable = null; |
| 9 var dumpCreator = null; | 9 var dumpCreator = null; |
| 10 /** A map from peer connection id to the PeerConnectionRecord. */ | 10 /** A map from peer connection id to the PeerConnectionRecord. */ |
| 11 var peerConnectionDataStore = {}; | 11 var peerConnectionDataStore = {}; |
| 12 /** A list of getUserMedia requests. */ | 12 /** A list of getUserMedia requests. */ |
| 13 var userMediaRequests = []; | 13 var userMediaRequests = []; |
| 14 | 14 |
| 15 /** A simple class to store the updates and stats data for a peer connection. */ | 15 /** A simple class to store the updates and stats data for a peer connection. */ |
| 16 var PeerConnectionRecord = (function() { | 16 var PeerConnectionRecord = (function() { |
| 17 /** @constructor */ | 17 /** @constructor */ |
| 18 function PeerConnectionRecord() { | 18 function PeerConnectionRecord() { |
| 19 /** @private */ | 19 /** @private */ |
| 20 this.record_ = { | 20 this.record_ = { |
| 21 constraints: {}, | 21 constraints: {}, |
| 22 servers: [], | 22 rtcConfiguration: [], |
| 23 stats: {}, | 23 stats: {}, |
| 24 updateLog: [], | 24 updateLog: [], |
| 25 url: '', | 25 url: '', |
| 26 }; | 26 }; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 PeerConnectionRecord.prototype = { | 29 PeerConnectionRecord.prototype = { |
| 30 /** @override */ | 30 /** @override */ |
| 31 toJSON: function() { | 31 toJSON: function() { |
| 32 return this.record_; | 32 return this.record_; |
| 33 }, | 33 }, |
| 34 | 34 |
| 35 /** | 35 /** |
| 36 * Adds the initilization info of the peer connection. | 36 * Adds the initilization info of the peer connection. |
| 37 * @param {string} url The URL of the web page owning the peer connection. | 37 * @param {string} url The URL of the web page owning the peer connection. |
| 38 * @param {Array} servers STUN servers used by the peer connection. | 38 * @param {Array} rtcConfiguration |
| 39 * @param {!Object} constraints Media constraints. | 39 * @param {!Object} constraints Media constraints. |
| 40 */ | 40 */ |
| 41 initialize: function(url, servers, constraints) { | 41 initialize: function(url, rtcConfiguration, constraints) { |
| 42 this.record_.url = url; | 42 this.record_.url = url; |
| 43 this.record_.servers = servers; | 43 this.record_.rtcConfiguration = rtcConfiguration; |
| 44 this.record_.constraints = constraints; | 44 this.record_.constraints = constraints; |
| 45 }, | 45 }, |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * @param {string} dataSeriesId The TimelineDataSeries identifier. | 48 * @param {string} dataSeriesId The TimelineDataSeries identifier. |
| 49 * @return {!TimelineDataSeries} | 49 * @return {!TimelineDataSeries} |
| 50 */ | 50 */ |
| 51 getDataSeries: function(dataSeriesId) { | 51 getDataSeries: function(dataSeriesId) { |
| 52 return this.record_.stats[dataSeriesId]; | 52 return this.record_.stats[dataSeriesId]; |
| 53 }, | 53 }, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 if (element) { | 165 if (element) { |
| 166 delete peerConnectionDataStore[element.id]; | 166 delete peerConnectionDataStore[element.id]; |
| 167 tabView.removeTab(element.id); | 167 tabView.removeTab(element.id); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 /** | 172 /** |
| 173 * Adds a peer connection. | 173 * Adds a peer connection. |
| 174 * | 174 * |
| 175 * @param {!Object} data The object containing the pid, lid, url, servers, and | 175 * @param {!Object} data The object containing the pid, lid, url, |
| 176 * constraints of a peer connection. | 176 * rtcConfiguration, and constraints of a peer connection. |
| 177 */ | 177 */ |
| 178 function addPeerConnection(data) { | 178 function addPeerConnection(data) { |
| 179 var id = getPeerConnectionId(data); | 179 var id = getPeerConnectionId(data); |
| 180 | 180 |
| 181 if (!peerConnectionDataStore[id]) { | 181 if (!peerConnectionDataStore[id]) { |
| 182 peerConnectionDataStore[id] = new PeerConnectionRecord(); | 182 peerConnectionDataStore[id] = new PeerConnectionRecord(); |
| 183 } | 183 } |
| 184 peerConnectionDataStore[id].initialize( | 184 peerConnectionDataStore[id].initialize( |
| 185 data.url, data.servers, data.constraints); | 185 data.url, data.rtcConfiguration, data.constraints); |
| 186 | 186 |
| 187 var peerConnectionElement = $(id); | 187 var peerConnectionElement = $(id); |
| 188 if (!peerConnectionElement) { | 188 if (!peerConnectionElement) { |
| 189 peerConnectionElement = tabView.addTab(id, data.url); | 189 peerConnectionElement = tabView.addTab(id, data.url); |
| 190 } | 190 } |
| 191 peerConnectionElement.innerHTML = | 191 peerConnectionElement.innerHTML = |
| 192 '<p>' + data.url + ' ' + data.servers + ' ' + data.constraints + | 192 '<p>' + data.url + ' ' + data.rtcConfiguration + ' ' + data.constraints + |
| 193 '</p>'; | 193 '</p>'; |
| 194 | 194 |
| 195 return peerConnectionElement; | 195 return peerConnectionElement; |
| 196 } | 196 } |
| 197 | 197 |
| 198 | 198 |
| 199 /** | 199 /** |
| 200 * Adds a peer connection update. | 200 * Adds a peer connection update. |
| 201 * | 201 * |
| 202 * @param {!PeerConnectionUpdateEntry} data The peer connection update data. | 202 * @param {!PeerConnectionUpdateEntry} data The peer connection update data. |
| 203 */ | 203 */ |
| 204 function updatePeerConnection(data) { | 204 function updatePeerConnection(data) { |
| 205 var peerConnectionElement = $(getPeerConnectionId(data)); | 205 var peerConnectionElement = $(getPeerConnectionId(data)); |
| 206 addPeerConnectionUpdate(peerConnectionElement, data); | 206 addPeerConnectionUpdate(peerConnectionElement, data); |
| 207 } | 207 } |
| 208 | 208 |
| 209 | 209 |
| 210 /** | 210 /** |
| 211 * Adds the information of all peer connections created so far. | 211 * Adds the information of all peer connections created so far. |
| 212 * | 212 * |
| 213 * @param {Array.<!Object>} data An array of the information of all peer | 213 * @param {Array.<!Object>} data An array of the information of all peer |
| 214 * connections. Each array item contains pid, lid, url, servers, | 214 * connections. Each array item contains pid, lid, url, rtcConfiguration, |
| 215 * constraints, and an array of updates as the log. | 215 * constraints, and an array of updates as the log. |
| 216 */ | 216 */ |
| 217 function updateAllPeerConnections(data) { | 217 function updateAllPeerConnections(data) { |
| 218 for (var i = 0; i < data.length; ++i) { | 218 for (var i = 0; i < data.length; ++i) { |
| 219 var peerConnection = addPeerConnection(data[i]); | 219 var peerConnection = addPeerConnection(data[i]); |
| 220 | 220 |
| 221 var log = data[i].log; | 221 var log = data[i].log; |
| 222 if (!log) | 222 if (!log) |
| 223 continue; | 223 continue; |
| 224 for (var j = 0; j < log.length; ++j) { | 224 for (var j = 0; j < log.length; ++j) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 dumpCreator.disableAecRecording(); | 285 dumpCreator.disableAecRecording(); |
| 286 } | 286 } |
| 287 | 287 |
| 288 | 288 |
| 289 /** | 289 /** |
| 290 * Set | 290 * Set |
| 291 */ | 291 */ |
| 292 function enableAecRecording() { | 292 function enableAecRecording() { |
| 293 dumpCreator.enableAecRecording(); | 293 dumpCreator.enableAecRecording(); |
| 294 } | 294 } |
| OLD | NEW |