Browse Source

Moved from offerConstraints to offerOptions which follows latest spec. This fixes offer creation in Firefox >=43.

pull/247/head
Simon Eisenmann 10 years ago
parent
commit
ce9f8f9874
  1. 15
      static/js/mediastream/peercall.js
  2. 5
      static/js/mediastream/peerscreenshare.js
  3. 5
      static/js/mediastream/peerxfer.js
  4. 17
      static/js/mediastream/webrtc.js

15
static/js/mediastream/peercall.js

@ -34,9 +34,8 @@ define(['jquery', 'underscore', 'mediastream/utils', 'mediastream/peerconnection @@ -34,9 +34,8 @@ define(['jquery', 'underscore', 'mediastream/utils', 'mediastream/peerconnection
this.mediaConstraints = $.extend(true, {}, this.webrtc.settings.mediaConstraints);
this.pcConfig = $.extend(true, {}, this.webrtc.settings.pcConfig);
this.pcConstraints = $.extend(true, {}, this.webrtc.settings.pcConstraints);
this.sdpConstraints = $.extend(true, {}, this.webrtc.settings.sdpConstraints);
this.offerConstraints = $.extend(true, {}, this.webrtc.settings.offerConstraints);
this.sdpParams = $.extend(true, {}, this.webrtc.settings.sdpParams);
this.offerOptions = $.extend(true, {}, this.webrtc.settings.offerOptions);
this.peerconnection = null;
this.datachannels = {};
@ -69,17 +68,17 @@ define(['jquery', 'underscore', 'mediastream/utils', 'mediastream/peerconnection @@ -69,17 +68,17 @@ define(['jquery', 'underscore', 'mediastream/utils', 'mediastream/peerconnection
PeerCall.prototype.createOffer = function(cb) {
var constraints = utils.mergeConstraints(this.offerConstraints, this.sdpConstraints);
console.log('Creating offer with constraints: \n' +
' \'' + JSON.stringify(constraints, null, '\t') + '\'.', this.negotiationNeeded);
this.peerconnection.createOffer(_.bind(this.onCreateAnswerOffer, this, cb), _.bind(this.onErrorAnswerOffer, this), constraints);
var options = this.offerOptions;
console.log('Creating offer with options: \n' +
' \'' + JSON.stringify(options, null, '\t') + '\'.', this.negotiationNeeded);
this.peerconnection.createOffer(_.bind(this.onCreateAnswerOffer, this, cb), _.bind(this.onErrorAnswerOffer, this), options);
};
PeerCall.prototype.createAnswer = function(cb) {
console.log("Creating answer.", this.negotiationNeeded);
this.peerconnection.createAnswer(_.bind(this.onCreateAnswerOffer, this, cb), _.bind(this.onErrorAnswerOffer, this), this.peerconnection.sdpConstraints);
this.peerconnection.createAnswer(_.bind(this.onCreateAnswerOffer, this, cb), _.bind(this.onErrorAnswerOffer, this));
};
@ -151,7 +150,7 @@ define(['jquery', 'underscore', 'mediastream/utils', 'mediastream/peerconnection @@ -151,7 +150,7 @@ define(['jquery', 'underscore', 'mediastream/utils', 'mediastream/peerconnection
streams++;
}
}, this));
if (streams === 0 && this.sdpConstraints.mandatory && (this.sdpConstraints.mandatory.OfferToReceiveAudio || this.sdpConstraints.mandatory.OfferToReceiveVideo)) {
if (streams === 0 && (this.offerOptions.offerToReceiveAudio || this.offerOptions.offerToReceiveVideo)) {
// We assume that we will eventually receive a stream, so we trigger the event to let the UI prepare for it.
this.e.triggerHandler("remoteStreamAdded", [null, this]);
}

5
static/js/mediastream/peerscreenshare.js

@ -51,9 +51,6 @@ define(['jquery', 'underscore', 'mediastream/peercall', 'mediastream/tokens'], f @@ -51,9 +51,6 @@ define(['jquery', 'underscore', 'mediastream/peercall', 'mediastream/tokens'], f
audio: false,
video: false
}
this.sdpConstraints.mandatory.OfferToReceiveAudio = false;
this.sdpConstraints.mandatory.OfferToReceiveVideo = true;
// SCTP is supported from Chrome M31.
// No need to pass DTLS constraint as it is on by default in Chrome M31.
// For SCTP, reliable and ordered is true by default.
@ -61,6 +58,8 @@ define(['jquery', 'underscore', 'mediastream/peercall', 'mediastream/tokens'], f @@ -61,6 +58,8 @@ define(['jquery', 'underscore', 'mediastream/peercall', 'mediastream/tokens'], f
mandatory: {},
optional: []
};
this.offerOptions.offerToReceiveAudio = false;
this.offerOptions.offerToReceiveVideo = true;
// Inject token into sessiondescription and ice candidate data.
this.e.on("sessiondescription icecandidate", _.bind(function(event, data) {

5
static/js/mediastream/peerxfer.js

@ -49,10 +49,6 @@ define(['jquery', 'underscore', 'mediastream/peercall', 'mediastream/tokens', 'w @@ -49,10 +49,6 @@ define(['jquery', 'underscore', 'mediastream/peercall', 'mediastream/tokens', 'w
audio: false,
video: false
};
this.sdpConstraints = {
mandatory: {},
optional: []
};
// SCTP is supported from Chrome M31.
// No need to pass DTLS constraint as it is on by default in Chrome M31.
// For SCTP, reliable and ordered is true by default.
@ -60,6 +56,7 @@ define(['jquery', 'underscore', 'mediastream/peercall', 'mediastream/tokens', 'w @@ -60,6 +56,7 @@ define(['jquery', 'underscore', 'mediastream/peercall', 'mediastream/tokens', 'w
mandatory: {},
optional: []
};
this.offerOptions = {};
// Inject token into sessiondescription and ice candidate data.
this.e.on("sessiondescription icecandidate", _.bind(function(event, data) {

17
static/js/mediastream/webrtc.js

@ -80,18 +80,6 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u @@ -80,18 +80,6 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u
mandatory: {},
optional: []
},
// Set up audio and video regardless of what devices are present.
sdpConstraints: {
mandatory: {
OfferToReceiveAudio: true,
OfferToReceiveVideo: true
},
optional: []
},
offerConstraints: {
mandatory: {},
optional: []
},
screensharing: {
mediaConstraints: {
audio: false,
@ -115,6 +103,11 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u @@ -115,6 +103,11 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u
//videoRecvBitrate: ,
//videoRecvCodec
},
// Set up audio and video regardless of what devices are present.
offerOptions: {
offerToReceiveAudio: true,
offerToReceiveVideo: true
},
renegotiation: true
};

Loading…
Cancel
Save