From ebdd91df4e3876aadb7f47da40887df5c89b1911 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Thu, 1 Oct 2015 15:10:55 -0500 Subject: [PATCH] Removes the sid property from MediaStream (how did we end up having a Jingle session ID in MediaStream and passing it around in the UI?) --- modules/RTC/MediaStream.js | 6 ++---- modules/RTC/RTC.js | 4 ++-- modules/UI/videolayout/RemoteVideo.js | 4 ++-- modules/UI/videolayout/SmallVideo.js | 11 ++++++----- modules/UI/videolayout/VideoLayout.js | 4 +--- modules/xmpp/JingleSessionPC.js | 7 +++---- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/modules/RTC/MediaStream.js b/modules/RTC/MediaStream.js index 9384386ca..c5e3ca7f1 100644 --- a/modules/RTC/MediaStream.js +++ b/modules/RTC/MediaStream.js @@ -6,13 +6,12 @@ var MediaStreamType = require("../../service/RTC/MediaStreamTypes"); * * @param data the data object from which we obtain the stream, * the peerjid, etc. - * @param sid the session id * @param ssrc the ssrc corresponding to this MediaStream * @param mute the whether this MediaStream is muted * * @constructor */ -function MediaStream(data, sid, ssrc, browser, eventEmitter, mute) { +function MediaStream(data, ssrc, browser, eventEmitter, muted) { // XXX(gp) to minimize headaches in the future, we should build our // abstractions around tracks and not streams. ORTC is track based API. @@ -24,14 +23,13 @@ function MediaStream(data, sid, ssrc, browser, eventEmitter, mute) { // Also, we should be able to associate multiple SSRCs with a MediaTrack as // a track might have an associated RTX and FEC sources. - this.sid = sid; this.stream = data.stream; this.peerjid = data.peerjid; this.videoType = data.videoType; this.ssrc = ssrc; this.type = (this.stream.getVideoTracks().length > 0)? MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE; - this.muted = mute; + this.muted = muted; this.eventEmitter = eventEmitter; } diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js index 081b3b7e3..901f7fd62 100644 --- a/modules/RTC/RTC.js +++ b/modules/RTC/RTC.js @@ -101,7 +101,7 @@ var RTC = { } } }, - createRemoteStream: function (data, sid, ssrc) { + createRemoteStream: function (data, 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, ssrc, + var remoteStream = new MediaStream(data, ssrc, RTCBrowserType.getBrowserType(), eventEmitter, muted); if(!this.remoteStreams[jid]) { diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index 367b1a4ed..c0185a3bc 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -204,13 +204,13 @@ RemoteVideo.prototype.waitForPlayback = function (sel, stream) { sel[0].onplaying = onPlayingHandler; }; -RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream) { +RemoteVideo.prototype.addRemoteStreamElement = function (stream) { if (!this.container) return; var self = this; var isVideo = stream.getVideoTracks().length > 0; - var streamElement = SmallVideo.createStreamElement(sid, stream); + var streamElement = SmallVideo.createStreamElement(stream); var newElementId = streamElement.id; // Put new stream element always in front diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js index cdf4b194e..20ea7ce39 100644 --- a/modules/UI/videolayout/SmallVideo.js +++ b/modules/UI/videolayout/SmallVideo.js @@ -102,20 +102,21 @@ SmallVideo.prototype.setPresenceStatus = function (statusMsg) { }; /** - * Creates an audio or video stream element. + * Creates an audio or video element for a particular MediaStream. */ -SmallVideo.createStreamElement = function (sid, stream) { +SmallVideo.createStreamElement = function (stream) { var isVideo = stream.getVideoTracks().length > 0; var element = isVideo ? document.createElement('video') : document.createElement('audio'); - var id = (isVideo ? 'remoteVideo_' : 'remoteAudio_') + sid + '_' + - APP.RTC.getStreamID(stream); - element.id = id; if (!RTCBrowserType.isIExplorer()) { element.autoplay = true; } + + element.id = (isVideo ? 'remoteVideo_' : 'remoteAudio_') + + APP.RTC.getStreamID(stream); + element.oncontextmenu = function () { return false; }; return element; diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index 4122ea660..0bc817e3d 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -175,9 +175,7 @@ var VideoLayout = (function (my) { var resourceJid = Strophe.getResourceFromJid(stream.peerjid); remoteVideos[resourceJid].addRemoteStreamElement( - stream.sid, - stream.getOriginalStream(), - stream.ssrc); + stream.getOriginalStream()); } }; diff --git a/modules/xmpp/JingleSessionPC.js b/modules/xmpp/JingleSessionPC.js index 19ee0b24a..d316050e7 100644 --- a/modules/xmpp/JingleSessionPC.js +++ b/modules/xmpp/JingleSessionPC.js @@ -122,9 +122,8 @@ JingleSessionPC.prototype.doInitialize = function () { self.remoteStreamAdded(event); }; this.peerconnection.onremovestream = function (event) { - // Remove the stream from remoteStreams - // FIXME: remotestreamremoved.jingle not defined anywhere(unused) - $(document).trigger('remotestreamremoved.jingle', [event, self.sid]); + // Remove the stream from remoteStreams? + console.log("We are ignoring a removestream event: " + event); }; this.peerconnection.onsignalingstatechange = function (event) { if (!(self && self.peerconnection)) return; @@ -1487,7 +1486,7 @@ JingleSessionPC.prototype.remoteStreamAdded = function (event) { } } - APP.RTC.createRemoteStream(event, this.sid, ssrc); + APP.RTC.createRemoteStream(event, ssrc); }; module.exports = JingleSessionPC;