diff --git a/static/js/mediastream/peerconnection.js b/static/js/mediastream/peerconnection.js index 56defc76..24b36580 100644 --- a/static/js/mediastream/peerconnection.js +++ b/static/js/mediastream/peerconnection.js @@ -268,6 +268,16 @@ define(['jquery', 'underscore', 'webrtc.adapter'], function($, _) { }; + PeerConnection.prototype.hasRemoteDescription = function() { + + // NOTE(longsleep): Chrome seems to return empty sdp even if no remoteDescription was set. + if (!this.pc || !this.pc.remoteDescription || !this.pc.remoteDescription.sdp) { + return false + } + return true; + + }; + PeerConnection.prototype.setRemoteDescription = function() { return this.pc.setRemoteDescription.apply(this.pc, arguments); diff --git a/static/js/mediastream/webrtc.js b/static/js/mediastream/webrtc.js index 01923a48..946bbae0 100644 --- a/static/js/mediastream/webrtc.js +++ b/static/js/mediastream/webrtc.js @@ -237,7 +237,7 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u console.log("Offer process."); targetcall = this.findTargetCall(from); if (targetcall) { - if (!this.settings.renegotiation && targetcall.peerconnection && targetcall.peerconnection.pc && targetcall.peerconnection.pc.remoteDescription) { + if (!this.settings.renegotiation && targetcall.peerconnection && targetcall.peerconnection.hasRemoteDescription()) { // Call replace support without renegotiation. this.doHangup("unsupported", from); console.error("Processing new offers is not implemented without renegotiation.");