Switches the order of the parameters of desktopsharing.addListener to match the rest of the code. Renames variables.

This commit is contained in:
Boris Grozev 2015-08-24 14:59:26 -05:00
parent 767f1828b6
commit 555dc8ad36
2 changed files with 16 additions and 15 deletions

View File

@ -22,10 +22,10 @@ function RTC(room, options) {
this.eventEmitter = new EventEmitter();
var self = this;
this.options = options || {};
desktopsharing.addListener(
desktopsharing.addListener(DesktopSharingEventTypes.NEW_STREAM_CREATED,
function (stream, isUsingScreenStream, callback) {
self.changeLocalVideo(stream, isUsingScreenStream, callback);
}, DesktopSharingEventTypes.NEW_STREAM_CREATED);
});
room.addPresenceListener("videomuted", function (values, from) {
if(self.remoteStreams[from])
self.remoteStreams[from][JitsiTrack.VIDEO].setMute(values.value == "true");
@ -208,13 +208,13 @@ RTC.prototype.muteRemoteVideoStream = function (jid, value) {
return false;
};
RTC.prototype.switchVideoStreams = function (new_stream) {
this.localVideo.stream = new_stream;
RTC.prototype.switchVideoStreams = function (newStream) {
this.localVideo.stream = newStream;
this.localStreams = [];
//in firefox we have only one stream object
if (this.localAudio.getOriginalStream() != new_stream)
if (this.localAudio.getOriginalStream() != newStream)
this.localStreams.push(this.localAudio);
this.localStreams.push(this.localVideo);
};

View File

@ -1067,28 +1067,29 @@ JingleSessionPC.prototype._modifySources = function (successCallback, queueCallb
/**
* Switches video streams.
* @param new_stream new stream that will be used as video of this session.
* @param newStream new stream that will be used as video of this session.
* @param oldStream old video stream of this session.
* @param success_callback callback executed after successful stream switch.
* @param successCallback callback executed after successful stream switch.
*/
JingleSessionPC.prototype.switchStreams = function (new_stream, oldStream, success_callback, isAudio) {
JingleSessionPC.prototype.switchStreams =
function (newStream, oldStream, successCallback) {
var self = this;
// Remember SDP to figure out added/removed SSRCs
var oldSdp = null;
if(self.peerconnection) {
if(self.peerconnection.localDescription) {
if (self.peerconnection) {
if (self.peerconnection.localDescription) {
oldSdp = new SDP(self.peerconnection.localDescription.sdp);
}
self.peerconnection.removeStream(oldStream, true);
if(new_stream)
self.peerconnection.addStream(new_stream);
if (newStream)
self.peerconnection.addStream(newStream);
}
// Conference is not active
if(!oldSdp || !self.peerconnection) {
success_callback();
if (!oldSdp) {
successCallback();
return;
}
@ -1096,7 +1097,7 @@ JingleSessionPC.prototype.switchStreams = function (new_stream, oldStream, succe
self.modifySourcesQueue.push(function() {
logger.log('modify sources done');
success_callback();
successCallback();
var newSdp = new SDP(self.peerconnection.localDescription.sdp);
logger.log("SDPs", oldSdp, newSdp);