Переглянути джерело

Moves SSRC owner signaling from MUC presence to Jingle.

master
paweldomas 10 роки тому
джерело
коміт
a1b0677442

+ 1
- 1
index.html Переглянути файл

22
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
22
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
23
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
23
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
24
     <script src="interface_config.js?v=5"></script>
24
     <script src="interface_config.js?v=5"></script>
25
-    <script src="libs/app.bundle.js?v=99"></script>
25
+    <script src="libs/app.bundle.js?v=100"></script>
26
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
26
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
27
     <link rel="stylesheet" href="css/font.css?v=7"/>
27
     <link rel="stylesheet" href="css/font.css?v=7"/>
28
     <link rel="stylesheet" href="css/toastr.css?v=1">
28
     <link rel="stylesheet" href="css/toastr.css?v=1">

+ 20753
- 20823
libs/app.bundle.js
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 1
- 10
modules/RTC/MediaStream.js Переглянути файл

28
     this.sid = sid;
28
     this.sid = sid;
29
     this.stream = data.stream;
29
     this.stream = data.stream;
30
     this.peerjid = data.peerjid;
30
     this.peerjid = data.peerjid;
31
+    this.videoType = data.videoType;
31
     this.ssrc = ssrc;
32
     this.ssrc = ssrc;
32
     this.type = (this.stream.getVideoTracks().length > 0)?
33
     this.type = (this.stream.getVideoTracks().length > 0)?
33
         MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
34
         MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
34
-    this.videoType = null;
35
     this.muted = false;
35
     this.muted = false;
36
     this.eventEmitter = eventEmitter;
36
     this.eventEmitter = eventEmitter;
37
 }
37
 }
48
     this.muted = value;
48
     this.muted = value;
49
 };
49
 };
50
 
50
 
51
-MediaStream.prototype.setVideoType = function (value) {
52
-    if(this.videoType === value)
53
-        return;
54
-    this.videoType = value;
55
-    this.eventEmitter.emit(StreamEventType.EVENT_TYPE_REMOTE_CHANGED,
56
-        this.peerjid);
57
-};
58
-
59
-
60
 module.exports = MediaStream;
51
 module.exports = MediaStream;

+ 0
- 14
modules/RTC/RTC.js Переглянути файл

148
             function (stream, isUsingScreenStream, callback) {
148
             function (stream, isUsingScreenStream, callback) {
149
                 self.changeLocalVideo(stream, isUsingScreenStream, callback);
149
                 self.changeLocalVideo(stream, isUsingScreenStream, callback);
150
             }, DesktopSharingEventTypes.NEW_STREAM_CREATED);
150
             }, DesktopSharingEventTypes.NEW_STREAM_CREATED);
151
-        APP.xmpp.addListener(XMPPEvents.STREAMS_CHANGED, function (jid, changedStreams) {
152
-            for(var i = 0; i < changedStreams.length; i++) {
153
-                var type = changedStreams[i].type;
154
-                if (type != "audio") {
155
-                    var peerStreams = self.remoteStreams[jid];
156
-                    if(!peerStreams)
157
-                        continue;
158
-                    var videoStream = peerStreams[MediaStreamType.VIDEO_TYPE];
159
-                    if(!videoStream)
160
-                        continue;
161
-                    videoStream.setVideoType(changedStreams[i].type);
162
-                }
163
-            }
164
-        });
165
         APP.xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) {
151
         APP.xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) {
166
             DataChannels.init(event.peerconnection, eventEmitter);
152
             DataChannels.init(event.peerconnection, eventEmitter);
167
         });
153
         });

+ 0
- 18
modules/UI/UI.js Переглянути файл

249
     APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) {
249
     APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) {
250
         Avatar.setUserAvatar(from, id);
250
         Avatar.setUserAvatar(from, id);
251
     });
251
     });
252
-    APP.xmpp.addListener(XMPPEvents.STREAMS_CHANGED, function (jid, changedStreams) {
253
-        for(stream in changedStreams)
254
-        {
255
-            // might need to update the direction if participant just went from sendrecv to recvonly
256
-            if (stream.type === 'video' || stream.type === 'screen') {
257
-                var el = $('#participant_' + Strophe.getResourceFromJid(jid) + '>' + APP.RTC.getVideoElementName());
258
-                switch (stream.direction) {
259
-                    case 'sendrecv':
260
-                        el.show();
261
-                        break;
262
-                    case 'recvonly':
263
-                        el.hide();
264
-                        break;
265
-                }
266
-            }
267
-        }
268
-
269
-    });
270
     APP.xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, onDisplayNameChanged);
252
     APP.xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, onDisplayNameChanged);
271
     APP.xmpp.addListener(XMPPEvents.MUC_JOINED, onMucJoined);
253
     APP.xmpp.addListener(XMPPEvents.MUC_JOINED, onMucJoined);
272
     APP.xmpp.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, onLocalRoleChanged);
254
     APP.xmpp.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, onLocalRoleChanged);

+ 7
- 0
modules/UI/videolayout/VideoLayout.js Переглянути файл

532
         } else {
532
         } else {
533
             VideoLayout.ensurePeerContainerExists(jid);
533
             VideoLayout.ensurePeerContainerExists(jid);
534
             remoteVideos[Strophe.getResourceFromJid(jid)].showVideoIndicator(value);
534
             remoteVideos[Strophe.getResourceFromJid(jid)].showVideoIndicator(value);
535
+
536
+            var el = $('#participant_'  + Strophe.getResourceFromJid(jid)
537
+                        + '>' + APP.RTC.getVideoElementName());
538
+            if (!value)
539
+                el.show();
540
+            else
541
+                el.hide();
535
         }
542
         }
536
     };
543
     };
537
 
544
 

+ 76
- 56
modules/xmpp/JingleSession.js Переглянути файл

48
 
48
 
49
     this.wait = true;
49
     this.wait = true;
50
     this.localStreamsSSRC = null;
50
     this.localStreamsSSRC = null;
51
+    this.ssrcOwners = {};
52
+    this.ssrcVideoTypes = {};
51
     this.eventEmitter = eventEmitter;
53
     this.eventEmitter = eventEmitter;
52
 
54
 
53
     /**
55
     /**
189
     }
191
     }
190
 }
192
 }
191
 
193
 
194
+JingleSession.prototype.getVideoType = function () {
195
+    return APP.desktopsharing.isUsingScreenStream() ? 'screen' : 'camera';
196
+};
197
+
192
 JingleSession.prototype.accept = function () {
198
 JingleSession.prototype.accept = function () {
193
     this.state = 'active';
199
     this.state = 'active';
194
 
200
 
216
             initiator: this.initiator,
222
             initiator: this.initiator,
217
             responder: this.responder,
223
             responder: this.responder,
218
             sid: this.sid });
224
             sid: this.sid });
219
-    prsdp.toJingle(accept, this.initiator == this.me ? 'initiator' : 'responder', this.localStreamsSSRC);
225
+    // FIXME why do we generate session-accept in 3 different places ?
226
+    prsdp.toJingle(
227
+        accept,
228
+        this.initiator == this.me ? 'initiator' : 'responder',
229
+        this.localStreamsSSRC,
230
+        self.getVideoType());
220
     var sdp = this.peerconnection.localDescription.sdp;
231
     var sdp = this.peerconnection.localDescription.sdp;
221
     while (SDPUtil.find_line(sdp, 'a=inactive')) {
232
     while (SDPUtil.find_line(sdp, 'a=inactive')) {
222
         // FIXME: change any inactive to sendrecv or whatever they were originally
233
         // FIXME: change any inactive to sendrecv or whatever they were originally
303
         //console.log('sendIceCandidate: last candidate.');
314
         //console.log('sendIceCandidate: last candidate.');
304
         if (!this.usetrickle) {
315
         if (!this.usetrickle) {
305
             //console.log('should send full offer now...');
316
             //console.log('should send full offer now...');
317
+            //FIXME why do we generate session-accept in 3 different places ?
306
             var init = $iq({to: this.peerjid,
318
             var init = $iq({to: this.peerjid,
307
                 type: 'set'})
319
                 type: 'set'})
308
                 .c('jingle', {xmlns: 'urn:xmpp:jingle:1',
320
                 .c('jingle', {xmlns: 'urn:xmpp:jingle:1',
314
             var sendJingle = function (ssrc) {
326
             var sendJingle = function (ssrc) {
315
                 if(!ssrc)
327
                 if(!ssrc)
316
                     ssrc = {};
328
                     ssrc = {};
317
-                self.localSDP.toJingle(init, self.initiator == self.me ? 'initiator' : 'responder', ssrc);
329
+                self.localSDP.toJingle(
330
+                    init,
331
+                    self.initiator == self.me ? 'initiator' : 'responder',
332
+                    ssrc,
333
+                    self.getVideoType());
318
                 self.connection.sendIQ(init,
334
                 self.connection.sendIQ(init,
319
                     function () {
335
                     function () {
320
                         //console.log('session initiate ack');
336
                         //console.log('session initiate ack');
414
     );
430
     );
415
 };
431
 };
416
 
432
 
433
+// FIXME createdOffer is never used in jitsi-meet
417
 JingleSession.prototype.createdOffer = function (sdp) {
434
 JingleSession.prototype.createdOffer = function (sdp) {
418
     //console.log('createdOffer', sdp);
435
     //console.log('createdOffer', sdp);
419
     var self = this;
436
     var self = this;
426
                 action: 'session-initiate',
443
                 action: 'session-initiate',
427
                 initiator: this.initiator,
444
                 initiator: this.initiator,
428
                 sid: this.sid});
445
                 sid: this.sid});
429
-        self.localSDP.toJingle(init, this.initiator == this.me ? 'initiator' : 'responder', this.localStreamsSSRC);
446
+        self.localSDP.toJingle(
447
+            init,
448
+            this.initiator == this.me ? 'initiator' : 'responder',
449
+            this.localStreamsSSRC,
450
+            self.getVideoType());
430
         self.connection.sendIQ(init,
451
         self.connection.sendIQ(init,
431
             function () {
452
             function () {
432
                 var ack = {};
453
                 var ack = {};
471
     }
492
     }
472
 };
493
 };
473
 
494
 
495
+JingleSession.prototype.readSsrcInfo = function (contents) {
496
+    var self = this;
497
+    $(contents).each(function (idx, content) {
498
+        var name = $(content).attr('name');
499
+        var mediaType = this.getAttribute('name');
500
+        var ssrcs = $(content).find('description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]');
501
+        ssrcs.each(function () {
502
+            var ssrc = this.getAttribute('ssrc');
503
+            $(this).find('>ssrc-info[xmlns="http://jitsi.org/jitmeet"]').each(
504
+                function () {
505
+                    var owner = this.getAttribute('owner');
506
+                    var videoType = this.getAttribute('video-type');
507
+                    self.ssrcOwners[ssrc] = owner;
508
+                    self.ssrcVideoTypes[ssrc] = videoType;
509
+                }
510
+            );
511
+        });
512
+    });
513
+};
514
+
515
+JingleSession.prototype.getSsrcOwner = function (ssrc) {
516
+    return this.ssrcOwners[ssrc];
517
+};
518
+
474
 JingleSession.prototype.setRemoteDescription = function (elem, desctype) {
519
 JingleSession.prototype.setRemoteDescription = function (elem, desctype) {
475
     //console.log('setting remote description... ', desctype);
520
     //console.log('setting remote description... ', desctype);
476
     this.remoteSDP = new SDP('');
521
     this.remoteSDP = new SDP('');
477
     this.remoteSDP.fromJingle(elem);
522
     this.remoteSDP.fromJingle(elem);
523
+    this.readSsrcInfo($(elem).find(">content"));
478
     if (this.peerconnection.remoteDescription !== null) {
524
     if (this.peerconnection.remoteDescription !== null) {
479
         console.log('setRemoteDescription when remote description is not null, should be pranswer', this.peerconnection.remoteDescription);
525
         console.log('setRemoteDescription when remote description is not null, should be pranswer', this.peerconnection.remoteDescription);
480
         if (this.peerconnection.remoteDescription.type == 'pranswer') {
526
         if (this.peerconnection.remoteDescription.type == 'pranswer') {
655
     }
701
     }
656
     var self = this;
702
     var self = this;
657
     var sendJingle = function (ssrcs) {
703
     var sendJingle = function (ssrcs) {
658
-
704
+                // FIXME why do we generate session-accept in 3 different places ?
659
                 var accept = $iq({to: self.peerjid,
705
                 var accept = $iq({to: self.peerjid,
660
                     type: 'set'})
706
                     type: 'set'})
661
                     .c('jingle', {xmlns: 'urn:xmpp:jingle:1',
707
                     .c('jingle', {xmlns: 'urn:xmpp:jingle:1',
663
                         initiator: self.initiator,
709
                         initiator: self.initiator,
664
                         responder: self.responder,
710
                         responder: self.responder,
665
                         sid: self.sid });
711
                         sid: self.sid });
666
-                self.localSDP.toJingle(accept, self.initiator == self.me ? 'initiator' : 'responder', ssrcs);
712
+                self.localSDP.toJingle(
713
+                    accept,
714
+                    self.initiator == self.me ? 'initiator' : 'responder',
715
+                    ssrcs,
716
+                    self.getVideoType());
667
                 self.connection.sendIQ(accept,
717
                 self.connection.sendIQ(accept,
668
                     function () {
718
                     function () {
669
                         var ack = {};
719
                         var ack = {};
762
 
812
 
763
     console.log('addssrc', new Date().getTime());
813
     console.log('addssrc', new Date().getTime());
764
     console.log('ice', this.peerconnection.iceConnectionState);
814
     console.log('ice', this.peerconnection.iceConnectionState);
815
+
816
+    this.readSsrcInfo(elem);
817
+
765
     var sdp = new SDP(this.peerconnection.remoteDescription.sdp);
818
     var sdp = new SDP(this.peerconnection.remoteDescription.sdp);
766
     var mySdp = new SDP(this.peerconnection.localDescription.sdp);
819
     var mySdp = new SDP(this.peerconnection.localDescription.sdp);
767
 
820
 
1085
             sid: this.sid
1138
             sid: this.sid
1086
         }
1139
         }
1087
     );
1140
     );
1088
-    var added = sdpDiffer.toJingle(add);
1141
+    var added = sdpDiffer.toJingle(add, this.getVideoType());
1089
     if (added) {
1142
     if (added) {
1090
         this.connection.sendIQ(add,
1143
         this.connection.sendIQ(add,
1091
             function (res) {
1144
             function (res) {
1245
 }
1298
 }
1246
 
1299
 
1247
 JingleSession.prototype.setLocalDescription = function () {
1300
 JingleSession.prototype.setLocalDescription = function () {
1248
-    // put our ssrcs into presence so other clients can identify our stream
1301
+    var self = this;
1249
     var newssrcs = [];
1302
     var newssrcs = [];
1250
     var session = transform.parse(this.peerconnection.localDescription.sdp);
1303
     var session = transform.parse(this.peerconnection.localDescription.sdp);
1251
     session.media.forEach(function (media) {
1304
     session.media.forEach(function (media) {
1258
                 }
1311
                 }
1259
                 newssrcs.push({
1312
                 newssrcs.push({
1260
                     'ssrc': ssrc.id,
1313
                     'ssrc': ssrc.id,
1261
-                    'type': media.type,
1262
-                    'direction': media.direction
1314
+                    'type': media.type
1263
                 });
1315
                 });
1264
             });
1316
             });
1265
         }
1317
         }
1266
-        else if(this.localStreamsSSRC && this.localStreamsSSRC[media.type])
1318
+        else if(self.localStreamsSSRC && self.localStreamsSSRC[media.type])
1267
         {
1319
         {
1268
             newssrcs.push({
1320
             newssrcs.push({
1269
-                'ssrc': this.localStreamsSSRC[media.type],
1270
-                'type': media.type,
1271
-                'direction': media.direction
1321
+                'ssrc': self.localStreamsSSRC[media.type],
1322
+                'type': media.type
1272
             });
1323
             });
1273
         }
1324
         }
1274
 
1325
 
1276
 
1327
 
1277
     console.log('new ssrcs', newssrcs);
1328
     console.log('new ssrcs', newssrcs);
1278
 
1329
 
1279
-    // Have to clear presence map to get rid of removed streams
1280
-    this.connection.emuc.clearPresenceMedia();
1281
-
1330
+    // Bind us as local SSRCs owner
1282
     if (newssrcs.length > 0) {
1331
     if (newssrcs.length > 0) {
1283
         for (var i = 1; i <= newssrcs.length; i ++) {
1332
         for (var i = 1; i <= newssrcs.length; i ++) {
1284
-            // Change video type to screen
1285
-            if (newssrcs[i-1].type === 'video' && APP.desktopsharing.isUsingScreenStream()) {
1286
-                newssrcs[i-1].type = 'screen';
1333
+            var ssrc = newssrcs[i-1].ssrc;
1334
+            var myJid = self.connection.emuc.myroomjid;
1335
+            self.ssrcOwners[ssrc] = myJid;
1336
+            if (newssrcs[i-1].type === 'video'){
1337
+                self.ssrcVideoTypes[ssrc] = self.getVideoType();
1287
             }
1338
             }
1288
-            this.connection.emuc.addMediaToPresence(i,
1289
-                newssrcs[i-1].type, newssrcs[i-1].ssrc, newssrcs[i-1].direction);
1290
         }
1339
         }
1291
-
1292
-        this.connection.emuc.sendPresence();
1293
     }
1340
     }
1294
 }
1341
 }
1295
 
1342
 
1331
 JingleSession.prototype.remoteStreamAdded = function (data, times) {
1378
 JingleSession.prototype.remoteStreamAdded = function (data, times) {
1332
     var self = this;
1379
     var self = this;
1333
     var thessrc;
1380
     var thessrc;
1334
-    var ssrc2jid = this.connection.emuc.ssrc2jid;
1335
     var streamId = APP.RTC.getStreamID(data.stream);
1381
     var streamId = APP.RTC.getStreamID(data.stream);
1336
 
1382
 
1337
     // look up an associated JID for a stream id
1383
     // look up an associated JID for a stream id
1354
         if (ssrclines.length) {
1400
         if (ssrclines.length) {
1355
             thessrc = ssrclines[0].substring(7).split(' ')[0];
1401
             thessrc = ssrclines[0].substring(7).split(' ')[0];
1356
 
1402
 
1357
-            // We signal our streams (through Jingle to the focus) before we set
1358
-            // our presence (through which peers associate remote streams to
1359
-            // jids). So, it might arrive that a remote stream is added but
1360
-            // ssrc2jid is not yet updated and thus data.peerjid cannot be
1361
-            // successfully set. Here we wait for up to a second for the
1362
-            // presence to arrive.
1363
-
1364
-            if (!ssrc2jid[thessrc]) {
1365
-
1366
-                if (typeof times === 'undefined')
1367
-                {
1368
-                    times = 0;
1369
-                }
1370
-
1371
-                if (times > 10)
1372
-                {
1373
-                    console.warning('Waiting for jid timed out', thessrc);
1374
-                }
1375
-                else
1376
-                {
1377
-                    setTimeout(function(d) {
1378
-                        return function() {
1379
-                            self.remoteStreamAdded(d, times++);
1380
-                        }
1381
-                    }(data), 250);
1382
-                }
1403
+            if (!self.ssrcOwners[thessrc]) {
1404
+                console.error("No SSRC owner known for: " + thessrc);
1383
                 return;
1405
                 return;
1384
             }
1406
             }
1385
-
1386
-            // ok to overwrite the one from focus? might save work in colibri.js
1387
-            console.log('associated jid', ssrc2jid[thessrc], thessrc);
1388
-            if (ssrc2jid[thessrc]) {
1389
-                data.peerjid = ssrc2jid[thessrc];
1390
-            }
1407
+            data.peerjid = self.ssrcOwners[thessrc];
1408
+            data.videoType = self.ssrcVideoTypes[thessrc]
1409
+            console.log('associated jid', self.ssrcOwners[thessrc],
1410
+                                          thessrc, data.videoType);
1391
         }
1411
         }
1392
     }
1412
     }
1393
 
1413
 

+ 10
- 5
modules/xmpp/SDP.js Переглянути файл

125
 }
125
 }
126
 
126
 
127
 // add content's to a jingle element
127
 // add content's to a jingle element
128
-SDP.prototype.toJingle = function (elem, thecreator, ssrcs) {
128
+SDP.prototype.toJingle = function (elem, thecreator, ssrcs, videoType) {
129
 //    console.log("SSRC" + ssrcs["audio"] + " - " + ssrcs["video"]);
129
 //    console.log("SSRC" + ssrcs["audio"] + " - " + ssrcs["video"]);
130
     var i, j, k, mline, ssrc, rtpmap, tmp, line, lines;
130
     var i, j, k, mline, ssrc, rtpmap, tmp, line, lines;
131
     var self = this;
131
     var self = this;
227
                         }
227
                         }
228
                         elem.up();
228
                         elem.up();
229
                     });
229
                     });
230
-                    elem.up();
231
                 }
230
                 }
232
                 else
231
                 else
233
                 {
232
                 {
257
                         elem.c('parameter');
256
                         elem.c('parameter');
258
                         elem.attrs({name: "label", value:msid});
257
                         elem.attrs({name: "label", value:msid});
259
                         elem.up();
258
                         elem.up();
260
-                        elem.up();
261
                     }
259
                     }
262
-
263
-
264
                 }
260
                 }
261
+                // Video type
262
+                if (videoType && mline.media == "video") {
263
+                    elem.c('ssrc-info',
264
+                        {
265
+                            xmlns: 'http://jitsi.org/jitmeet',
266
+                            'video-type': videoType
267
+                        }).up();
268
+                }
269
+                elem.up();
265
 
270
 
266
                 // XEP-0339 handle ssrc-group attributes
271
                 // XEP-0339 handle ssrc-group attributes
267
                 var ssrc_group_lines = SDPUtil.find_lines(this.media[i], 'a=ssrc-group:');
272
                 var ssrc_group_lines = SDPUtil.find_lines(this.media[i], 'a=ssrc-group:');

+ 10
- 1
modules/xmpp/SDPDiffer.js Переглянути файл

106
  * @param toJid destination Jid
106
  * @param toJid destination Jid
107
  * @param isAdd indicates if this is remove or add operation.
107
  * @param isAdd indicates if this is remove or add operation.
108
  */
108
  */
109
-SDPDiffer.prototype.toJingle = function(modify) {
109
+SDPDiffer.prototype.toJingle = function(modify, videoType) {
110
     var sdpMediaSsrcs = this.getNewMedia();
110
     var sdpMediaSsrcs = this.getNewMedia();
111
     var self = this;
111
     var self = this;
112
 
112
 
141
                 }
141
                 }
142
                 modify.up(); // end of parameter
142
                 modify.up(); // end of parameter
143
             });
143
             });
144
+            // indicate video type
145
+            if (videoType && media.mid == 'video') {
146
+                modify.c('ssrc-info',
147
+                    {
148
+                        xmlns: 'http://jitsi.org/jitmeet',
149
+                        'video-type': videoType
150
+                    })
151
+                    .up();
152
+            }
144
             modify.up(); // end of source
153
             modify.up(); // end of source
145
         });
154
         });
146
 
155
 

+ 0
- 69
modules/xmpp/strophe.emuc.js Переглянути файл

21
         isOwner: false,
21
         isOwner: false,
22
         role: null,
22
         role: null,
23
         focusMucJid: null,
23
         focusMucJid: null,
24
-        ssrc2jid: {},
25
         init: function (conn) {
24
         init: function (conn) {
26
             this.connection = conn;
25
             this.connection = conn;
27
         },
26
         },
280
                 return true;
279
                 return true;
281
             }
280
             }
282
 
281
 
283
-            var self = this;
284
-            // Remove old ssrcs coming from the jid
285
-            Object.keys(this.ssrc2jid).forEach(function (ssrc) {
286
-                if (self.ssrc2jid[ssrc] == from) {
287
-                    delete self.ssrc2jid[ssrc];
288
-                }
289
-            });
290
-
291
             // Status code 110 indicates that this notification is "self-presence".
282
             // Status code 110 indicates that this notification is "self-presence".
292
             if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
283
             if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
293
                 delete this.members[from];
284
                 delete this.members[from];
514
                     .c('current').t(this.presMap['prezicurrent']).up().up();
505
                     .c('current').t(this.presMap['prezicurrent']).up().up();
515
             }
506
             }
516
 
507
 
517
-            if (this.presMap['medians']) {
518
-                pres.c('media', {xmlns: this.presMap['medians']});
519
-                var sourceNumber = 0;
520
-                Object.keys(this.presMap).forEach(function (key) {
521
-                    if (key.indexOf('source') >= 0) {
522
-                        sourceNumber++;
523
-                    }
524
-                });
525
-                if (sourceNumber > 0)
526
-                    for (var i = 1; i <= sourceNumber / 3; i++) {
527
-                        pres.c('source',
528
-                            {type: this.presMap['source' + i + '_type'],
529
-                                ssrc: this.presMap['source' + i + '_ssrc'],
530
-                                direction: this.presMap['source' + i + '_direction']
531
-                                    || 'sendrecv' }
532
-                        ).up();
533
-                    }
534
-                pres.up();
535
-            }
536
-
537
             if(this.presMap["startMuted"] !== undefined)
508
             if(this.presMap["startMuted"] !== undefined)
538
             {
509
             {
539
                 pres.c("startmuted", {audio: this.presMap["startMuted"].audio,
510
                 pres.c("startmuted", {audio: this.presMap["startMuted"].audio,
548
         addDisplayNameToPresence: function (displayName) {
519
         addDisplayNameToPresence: function (displayName) {
549
             this.presMap['displayName'] = displayName;
520
             this.presMap['displayName'] = displayName;
550
         },
521
         },
551
-        addMediaToPresence: function (sourceNumber, mtype, ssrcs, direction) {
552
-            if (!this.presMap['medians'])
553
-                this.presMap['medians'] = 'http://estos.de/ns/mjs';
554
-
555
-            this.presMap['source' + sourceNumber + '_type'] = mtype;
556
-            this.presMap['source' + sourceNumber + '_ssrc'] = ssrcs;
557
-            this.presMap['source' + sourceNumber + '_direction'] = direction;
558
-        },
559
         addDevicesToPresence: function (devices) {
522
         addDevicesToPresence: function (devices) {
560
             this.presMap['devices'] = devices;
523
             this.presMap['devices'] = devices;
561
         },
524
         },
562
-        clearPresenceMedia: function () {
563
-            var self = this;
564
-            Object.keys(this.presMap).forEach(function (key) {
565
-                if (key.indexOf('source') != -1) {
566
-                    delete self.presMap[key];
567
-                }
568
-            });
569
-        },
570
         addPreziToPresence: function (url, currentSlide) {
525
         addPreziToPresence: function (url, currentSlide) {
571
             this.presMap['prezins'] = 'http://jitsi.org/jitmeet/prezi';
526
             this.presMap['prezins'] = 'http://jitsi.org/jitmeet/prezi';
572
             this.presMap['preziurl'] = url;
527
             this.presMap['preziurl'] = url;
650
             if(memeber.isFocus)
605
             if(memeber.isFocus)
651
                 return;
606
                 return;
652
 
607
 
653
-            var self = this;
654
-            // Remove old ssrcs coming from the jid
655
-            Object.keys(this.ssrc2jid).forEach(function (ssrc) {
656
-                if (self.ssrc2jid[ssrc] == from) {
657
-                    delete self.ssrc2jid[ssrc];
658
-                }
659
-            });
660
-
661
-            var changedStreams = [];
662
-            $(pres).find('>media[xmlns="http://estos.de/ns/mjs"]>source').each(function (idx, ssrc) {
663
-                //console.log(jid, 'assoc ssrc', ssrc.getAttribute('type'), ssrc.getAttribute('ssrc'));
664
-                var ssrcV = ssrc.getAttribute('ssrc');
665
-                self.ssrc2jid[ssrcV] = from;
666
-
667
-                var type = ssrc.getAttribute('type');
668
-
669
-                var direction = ssrc.getAttribute('direction');
670
-
671
-                changedStreams.push({type: type, direction: direction});
672
-
673
-            });
674
-
675
-            eventEmitter.emit(XMPPEvents.STREAMS_CHANGED, from, changedStreams);
676
-
677
             var displayName = !config.displayJids
608
             var displayName = !config.displayJids
678
                 ? memeber.displayName : Strophe.getResourceFromJid(from);
609
                 ? memeber.displayName : Strophe.getResourceFromJid(from);
679
 
610
 

+ 2
- 2
modules/xmpp/xmpp.js Переглянути файл

594
         return connection.emuc.members;
594
         return connection.emuc.members;
595
     },
595
     },
596
     getJidFromSSRC: function (ssrc) {
596
     getJidFromSSRC: function (ssrc) {
597
-        if(!connection)
597
+        if (!this.isConferenceInProgress())
598
             return null;
598
             return null;
599
-        return connection.emuc.ssrc2jid[ssrc];
599
+        return connection.jingle.activecall.getSsrcOwner(ssrc);
600
     },
600
     },
601
     getMUCJoined: function () {
601
     getMUCJoined: function () {
602
         return connection.emuc.joined;
602
         return connection.emuc.joined;

+ 0
- 1
service/xmpp/XMPPEvents.js Переглянути файл

7
     KICKED: "xmpp.kicked",
7
     KICKED: "xmpp.kicked",
8
     BRIDGE_DOWN: "xmpp.bridge_down",
8
     BRIDGE_DOWN: "xmpp.bridge_down",
9
     USER_ID_CHANGED: "xmpp.user_id_changed",
9
     USER_ID_CHANGED: "xmpp.user_id_changed",
10
-    STREAMS_CHANGED: "xmpp.streams_changed",
11
     // We joined the MUC
10
     // We joined the MUC
12
     MUC_JOINED: "xmpp.muc_joined",
11
     MUC_JOINED: "xmpp.muc_joined",
13
     // A member joined the MUC
12
     // A member joined the MUC

Завантаження…
Відмінити
Зберегти