Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Simplifies code, removes unused code.
Boris Grozev493477918748
diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.jsindex 6a0a1107bf..081b3b7e39 100644--- a/modules/RTC/RTC.js+++ b/modules/RTC/RTC.js@@ -101,7 +101,7 @@ var RTC = {}}},- createRemoteStream: function (data, sid, thessrc) {+ createRemoteStream: function (data, sid, ssrc) {var jid = data.peerjid || APP.xmpp.myJid();// check the video muted state from last stored presence if any@@ -111,7 +111,7 @@ var RTC = {muted = pres.videoMuted;}- var remoteStream = new MediaStream(data, sid, thessrc,+ var remoteStream = new MediaStream(data, sid, ssrc,RTCBrowserType.getBrowserType(), eventEmitter, muted);if(!this.remoteStreams[jid]) {diff --git a/modules/RTC/RTCUtils.js b/modules/RTC/RTCUtils.jsindex 19ced59859..e8448ae7a2 100644--- a/modules/RTC/RTCUtils.js+++ b/modules/RTC/RTCUtils.js@@ -259,8 +259,7 @@ function RTCUtils(RTCService, onTemasysPluginReady)attachMediaStream(elSel[0], stream);};self.getStreamID = function (stream) {- var id = APP.xmpp.filter_special_chars(stream.label);- return id;+ return APP.xmpp.filter_special_chars(stream.label);};self.getVideoSrc = function (element) {if (!element) {diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.jsindex 1d0c1ffcbd..367b1a4ed1 100644--- a/modules/UI/videolayout/RemoteVideo.js+++ b/modules/UI/videolayout/RemoteVideo.js@@ -204,7 +204,7 @@ RemoteVideo.prototype.waitForPlayback = function (sel, stream) {sel[0].onplaying = onPlayingHandler;};-RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {+RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream) {if (!this.container)return;diff --git a/modules/desktopsharing/desktopsharing.js b/modules/desktopsharing/desktopsharing.jsindex ba24d3f01c..64a93f1290 100644--- a/modules/desktopsharing/desktopsharing.js+++ b/modules/desktopsharing/desktopsharing.js@@ -135,7 +135,8 @@ module.exports = {isUsingScreenStream = false;newStreamCreated(stream);},- getVideoStreamFailed, config.resolution || '360'+ getVideoStreamFailed,+ config.resolution || '360');}},diff --git a/modules/xmpp/JingleSessionPC.js b/modules/xmpp/JingleSessionPC.jsindex f67a402233..19ee0b24a1 100644--- a/modules/xmpp/JingleSessionPC.js+++ b/modules/xmpp/JingleSessionPC.js@@ -108,16 +108,18 @@ JingleSessionPC.prototype.doInitialize = function () {self.sendIceCandidate(event.candidate);};this.peerconnection.onaddstream = function (event) {- if (event.stream.id !== 'default') {- console.log("REMOTE STREAM ADDED: ", event.stream , event.stream.id);- self.remoteStreamAdded(event);- } else {+ if (event.stream.id === 'default') {// This is a recvonly stream. Clients that implement Unified Plan,// such as Firefox use recvonly "streams/channels/tracks" for// receiving remote stream/tracks, as opposed to Plan B where there// are only 3 channels: audio, video and data.- console.log("RECVONLY REMOTE STREAM IGNORED: " + event.stream + " - " + event.stream.id);+ console.log("RECVONLY REMOTE STREAM IGNORED: " + event.stream ++ " - " + event.stream.id);+ return;}++ console.log("REMOTE STREAM ADDED: ", event.stream, event.stream.id);+ self.remoteStreamAdded(event);};this.peerconnection.onremovestream = function (event) {// Remove the stream from remoteStreams@@ -1440,24 +1442,29 @@ function sendKeyframe(pc) {);}--JingleSessionPC.prototype.remoteStreamAdded = function (data, times) {+/**+ * Handles 'onaddstream' events from the RTCPeerConnection.+ * @param event the 'onaddstream' event.+ */+JingleSessionPC.prototype.remoteStreamAdded = function (event) {var self = this;- var thessrc;- var streamId = APP.RTC.getStreamID(data.stream);+ var ssrc;+ var ssrclines;+ var streamId = APP.RTC.getStreamID(event.stream);// look up an associated JID for a stream idif (!streamId) {- console.error("No stream ID for", data.stream);- } else if (streamId && streamId.indexOf('mixedmslabel') === -1) {+ console.error("No stream ID for", event.stream);+ } else if (streamId.indexOf('mixedmslabel') === -1) {// look only at a=ssrc: and _not_ at a=ssrc-group: lines- var ssrclines- = SDPUtil.find_lines(this.peerconnection.remoteDescription.sdp, 'a=ssrc:');+ ssrclines = SDPUtil.find_lines(+ this.peerconnection.remoteDescription.sdp,+ 'a=ssrc:');ssrclines = ssrclines.filter(function (line) {// NOTE(gp) previously we filtered on the mslabel, but that property// is not always present.- // return line.indexOf('mslabel:' + data.stream.label) !== -1;+ // return line.indexOf('mslabel:' + event.stream.label) !== -1;if (RTCBrowserType.isTemasysPluginUsed()) {return ((line.indexOf('mslabel:' + streamId) !== -1));@@ -1466,33 +1473,21 @@ JingleSessionPC.prototype.remoteStreamAdded = function (data, times) {}});if (ssrclines.length) {- thessrc = ssrclines[0].substring(7).split(' ')[0];+ ssrc = ssrclines[0].substring(7).split(' ')[0];- if (!self.ssrcOwners[thessrc]) {- console.error("No SSRC owner known for: " + thessrc);+ if (!self.ssrcOwners[ssrc]) {+ console.error("No SSRC owner known for: " + ssrc);return;}- data.peerjid = self.ssrcOwners[thessrc];- console.log('associated jid', self.ssrcOwners[thessrc]);+ event.peerjid = self.ssrcOwners[ssrc];+ console.log('Adding remote stream, SSRC ' + ssrc ++ ', associated jid ' + event.peerjid);} else {console.error("No SSRC lines for ", streamId);}}- APP.RTC.createRemoteStream(data, this.sid, thessrc);-- var isVideo = data.stream.getVideoTracks().length > 0;- // an attempt to work around https://github.com/jitsi/jitmeet/issues/32- // TODO: is this hack still needed now that we announce an SSRC for- // receive-only streams?- if (isVideo &&- data.peerjid && this.peerjid === data.peerjid &&- data.stream.getVideoTracks().length === 0 &&- APP.RTC.localVideo.getTracks().length > 0) {- window.setTimeout(function () {- sendKeyframe(self.peerconnection);- }, 3000);- }+ APP.RTC.createRemoteStream(event, this.sid, ssrc);};module.exports = JingleSessionPC;