Przeglądaj źródła

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?)
j8
Boris Grozev 9 lat temu
rodzic
commit
ebdd91df4e

+ 2
- 4
modules/RTC/MediaStream.js Wyświetl plik

@@ -6,13 +6,12 @@ var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
6 6
  *
7 7
  * @param data the data object from which we obtain the stream,
8 8
  * the peerjid, etc.
9
- * @param sid the session id
10 9
  * @param ssrc the ssrc corresponding to this MediaStream
11 10
  * @param mute the whether this MediaStream is muted
12 11
  *
13 12
  * @constructor
14 13
  */
15
-function MediaStream(data, sid, ssrc, browser, eventEmitter, mute) {
14
+function MediaStream(data, ssrc, browser, eventEmitter, muted) {
16 15
 
17 16
     // XXX(gp) to minimize headaches in the future, we should build our
18 17
     // abstractions around tracks and not streams. ORTC is track based API.
@@ -24,14 +23,13 @@ function MediaStream(data, sid, ssrc, browser, eventEmitter, mute) {
24 23
     // Also, we should be able to associate multiple SSRCs with a MediaTrack as
25 24
     // a track might have an associated RTX and FEC sources.
26 25
 
27
-    this.sid = sid;
28 26
     this.stream = data.stream;
29 27
     this.peerjid = data.peerjid;
30 28
     this.videoType = data.videoType;
31 29
     this.ssrc = ssrc;
32 30
     this.type = (this.stream.getVideoTracks().length > 0)?
33 31
         MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
34
-    this.muted = mute;
32
+    this.muted = muted;
35 33
     this.eventEmitter = eventEmitter;
36 34
 }
37 35
 

+ 2
- 2
modules/RTC/RTC.js Wyświetl plik

@@ -101,7 +101,7 @@ var RTC = {
101 101
             }
102 102
         }
103 103
     },
104
-    createRemoteStream: function (data, sid, ssrc) {
104
+    createRemoteStream: function (data, ssrc) {
105 105
         var jid = data.peerjid || APP.xmpp.myJid();
106 106
 
107 107
         // check the video muted state from last stored presence if any
@@ -111,7 +111,7 @@ var RTC = {
111 111
             muted = pres.videoMuted;
112 112
         }
113 113
 
114
-        var remoteStream = new MediaStream(data, sid, ssrc,
114
+        var remoteStream = new MediaStream(data, ssrc,
115 115
             RTCBrowserType.getBrowserType(), eventEmitter, muted);
116 116
 
117 117
         if(!this.remoteStreams[jid]) {

+ 2
- 2
modules/UI/videolayout/RemoteVideo.js Wyświetl plik

@@ -204,13 +204,13 @@ RemoteVideo.prototype.waitForPlayback = function (sel, stream) {
204 204
     sel[0].onplaying = onPlayingHandler;
205 205
 };
206 206
 
207
-RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream) {
207
+RemoteVideo.prototype.addRemoteStreamElement = function (stream) {
208 208
     if (!this.container)
209 209
         return;
210 210
 
211 211
     var self = this;
212 212
     var isVideo = stream.getVideoTracks().length > 0;
213
-    var streamElement = SmallVideo.createStreamElement(sid, stream);
213
+    var streamElement = SmallVideo.createStreamElement(stream);
214 214
     var newElementId = streamElement.id;
215 215
 
216 216
     // Put new stream element always in front

+ 6
- 5
modules/UI/videolayout/SmallVideo.js Wyświetl plik

@@ -102,20 +102,21 @@ SmallVideo.prototype.setPresenceStatus = function (statusMsg) {
102 102
 };
103 103
 
104 104
 /**
105
- * Creates an audio or video stream element.
105
+ * Creates an audio or video element for a particular MediaStream.
106 106
  */
107
-SmallVideo.createStreamElement = function (sid, stream) {
107
+SmallVideo.createStreamElement = function (stream) {
108 108
     var isVideo = stream.getVideoTracks().length > 0;
109 109
 
110 110
     var element = isVideo ? document.createElement('video')
111 111
         : document.createElement('audio');
112
-    var id = (isVideo ? 'remoteVideo_' : 'remoteAudio_') + sid + '_' +
113
-        APP.RTC.getStreamID(stream);
114 112
 
115
-    element.id = id;
116 113
     if (!RTCBrowserType.isIExplorer()) {
117 114
         element.autoplay = true;
118 115
     }
116
+
117
+    element.id = (isVideo ? 'remoteVideo_' : 'remoteAudio_') +
118
+        APP.RTC.getStreamID(stream);
119
+
119 120
     element.oncontextmenu = function () { return false; };
120 121
 
121 122
     return element;

+ 1
- 3
modules/UI/videolayout/VideoLayout.js Wyświetl plik

@@ -175,9 +175,7 @@ var VideoLayout = (function (my) {
175 175
 
176 176
             var resourceJid = Strophe.getResourceFromJid(stream.peerjid);
177 177
             remoteVideos[resourceJid].addRemoteStreamElement(
178
-                stream.sid,
179
-                stream.getOriginalStream(),
180
-                stream.ssrc);
178
+                stream.getOriginalStream());
181 179
         }
182 180
     };
183 181
 

+ 3
- 4
modules/xmpp/JingleSessionPC.js Wyświetl plik

@@ -122,9 +122,8 @@ JingleSessionPC.prototype.doInitialize = function () {
122 122
         self.remoteStreamAdded(event);
123 123
     };
124 124
     this.peerconnection.onremovestream = function (event) {
125
-        // Remove the stream from remoteStreams
126
-        // FIXME: remotestreamremoved.jingle not defined anywhere(unused)
127
-        $(document).trigger('remotestreamremoved.jingle', [event, self.sid]);
125
+        // Remove the stream from remoteStreams?
126
+        console.log("We are ignoring a removestream event: " + event);
128 127
     };
129 128
     this.peerconnection.onsignalingstatechange = function (event) {
130 129
         if (!(self && self.peerconnection)) return;
@@ -1487,7 +1486,7 @@ JingleSessionPC.prototype.remoteStreamAdded = function (event) {
1487 1486
         }
1488 1487
     }
1489 1488
 
1490
-    APP.RTC.createRemoteStream(event, this.sid, ssrc);
1489
+    APP.RTC.createRemoteStream(event, ssrc);
1491 1490
 };
1492 1491
 
1493 1492
 module.exports = JingleSessionPC;

Ładowanie…
Anuluj
Zapisz