Check pcConfig (which can be null) before use.
BUG= TEST=manully with pc1.html R=juberti@google.com Review URL: https://webrtc-codereview.appspot.com/9079004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5603 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
91cbaa477c
commit
78ea3d50e0
@ -13,13 +13,15 @@ function trace(text) {
|
||||
console.log((performance.now() / 1000).toFixed(3) + ": " + text);
|
||||
}
|
||||
function maybeFixConfiguration(pcConfig) {
|
||||
if (pcConfig == null) {
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < pcConfig.iceServers.length; i++) {
|
||||
if (pcConfig.iceServers[i].hasOwnProperty('urls')){
|
||||
pcConfig.iceServers[i]['url'] = pcConfig.iceServers[i]['urls'];
|
||||
delete pcConfig.iceServers[i]['urls'];
|
||||
}
|
||||
}
|
||||
return pcConfig;
|
||||
}
|
||||
|
||||
if (navigator.mozGetUserMedia) {
|
||||
@ -33,7 +35,7 @@ if (navigator.mozGetUserMedia) {
|
||||
// The RTCPeerConnection object.
|
||||
var RTCPeerConnection = function(pcConfig, pcConstraints) {
|
||||
// .urls is not supported in FF yet.
|
||||
pcConfig = maybeFixConfiguration(pcConfig);
|
||||
maybeFixConfiguration(pcConfig);
|
||||
return new mozRTCPeerConnection(pcConfig, pcConstraints);
|
||||
}
|
||||
|
||||
@ -165,7 +167,7 @@ if (navigator.mozGetUserMedia) {
|
||||
var RTCPeerConnection = function(pcConfig, pcConstraints) {
|
||||
// .urls is supported since Chrome M34.
|
||||
if (webrtcDetectedVersion < 34) {
|
||||
pcConfig = maybeFixConfiguration(pcConfig);
|
||||
maybeFixConfiguration(pcConfig);
|
||||
}
|
||||
return new webkitRTCPeerConnection(pcConfig, pcConstraints);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user