Removes a tangle of spaghetti.

This commit is contained in:
Boris Grozev 2015-10-29 14:30:30 -05:00
parent 14fe5d09d1
commit 9111797913
2 changed files with 6 additions and 33 deletions

View File

@ -53,7 +53,6 @@ var RTC = {
audio: true,
video: true
},
localStreams: [],
remoteStreams: {},
localAudio: null,
localVideo: null,
@ -74,10 +73,6 @@ var RTC = {
var localStream =
new LocalStream(stream, type, eventEmitter, videoType, isGUMStream);
//in firefox we have only one stream object
if(this.localStreams.length === 0 ||
this.localStreams[0].getOriginalStream() != stream)
this.localStreams.push(localStream);
if(isMuted === true)
localStream.setMute(true);
@ -93,14 +88,6 @@ var RTC = {
eventEmitter.emit(eventType, localStream, isMuted);
return localStream;
},
removeLocalStream: function (stream) {
for(var i = 0; i < this.localStreams.length; i++) {
if(this.localStreams[i].getOriginalStream() === stream) {
delete this.localStreams[i];
return;
}
}
},
createRemoteStream: function (data, ssrc) {
var jid = data.peerjid || APP.xmpp.myJid();
@ -203,16 +190,6 @@ var RTC = {
}
return false;
},
switchVideoStreams: function (newStream) {
this.localVideo.stream = newStream;
this.localStreams = [];
//in firefox we have only one stream object
if (this.localAudio.getOriginalStream() != newStream)
this.localStreams.push(this.localAudio);
this.localStreams.push(this.localVideo);
},
changeLocalVideo: function (stream, isUsingScreenStream, callback) {
var oldStream = this.localVideo.getOriginalStream();
var type = (isUsingScreenStream ? "screen" : "camera");
@ -236,8 +213,6 @@ var RTC = {
// Stop the stream to trigger onended event for old stream
oldStream.stop();
this.switchVideoStreams(videoStream);
APP.xmpp.switchStreams(videoStream, oldStream,localCallback);
},
changeLocalAudio: function (stream, callback) {

View File

@ -20,7 +20,6 @@ function JingleSessionPC(me, sid, connection, service, eventEmitter) {
this.state = null;
this.localSDP = null;
this.remoteSDP = null;
this.relayedStreams = [];
this.pc_constraints = null;
this.usetrickle = true;
@ -169,13 +168,12 @@ JingleSessionPC.prototype.doInitialize = function () {
this.peerconnection.onnegotiationneeded = function (event) {
self.eventEmitter.emit(XMPPEvents.PEERCONNECTION_READY, self);
};
// add any local and relayed stream
APP.RTC.localStreams.forEach(function(stream) {
self.peerconnection.addStream(stream.getOriginalStream());
});
this.relayedStreams.forEach(function(stream) {
self.peerconnection.addStream(stream);
});
if (APP.RTC.localAudio) {
self.peerconnection.addStream(APP.RTC.localAudio.getOriginalStream());
}
if (APP.RTC.localVideo) {
self.peerconnection.addStream(APP.RTC.localVideo.getOriginalStream());
}
};
function onIceConnectionStateChange(sid, session) {