浏览代码

Moves SSRC owner signaling from MUC presence to Jingle.

master
paweldomas 10 年前
父节点
当前提交
a1b0677442

+ 1
- 1
index.html 查看文件

@@ -22,7 +22,7 @@
22 22
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
23 23
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
24 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 26
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
27 27
     <link rel="stylesheet" href="css/font.css?v=7"/>
28 28
     <link rel="stylesheet" href="css/toastr.css?v=1">

+ 20753
- 20823
libs/app.bundle.js
文件差异内容过多而无法显示
查看文件


+ 1
- 10
modules/RTC/MediaStream.js 查看文件

@@ -28,10 +28,10 @@ function MediaStream(data, sid, ssrc, browser, eventEmitter) {
28 28
     this.sid = sid;
29 29
     this.stream = data.stream;
30 30
     this.peerjid = data.peerjid;
31
+    this.videoType = data.videoType;
31 32
     this.ssrc = ssrc;
32 33
     this.type = (this.stream.getVideoTracks().length > 0)?
33 34
         MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
34
-    this.videoType = null;
35 35
     this.muted = false;
36 36
     this.eventEmitter = eventEmitter;
37 37
 }
@@ -48,13 +48,4 @@ MediaStream.prototype.setMute = function (value)
48 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 51
 module.exports = MediaStream;

+ 0
- 14
modules/RTC/RTC.js 查看文件

@@ -148,20 +148,6 @@ var RTC = {
148 148
             function (stream, isUsingScreenStream, callback) {
149 149
                 self.changeLocalVideo(stream, isUsingScreenStream, callback);
150 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 151
         APP.xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) {
166 152
             DataChannels.init(event.peerconnection, eventEmitter);
167 153
         });

+ 0
- 18
modules/UI/UI.js 查看文件

@@ -249,24 +249,6 @@ function registerListeners() {
249 249
     APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) {
250 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 252
     APP.xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, onDisplayNameChanged);
271 253
     APP.xmpp.addListener(XMPPEvents.MUC_JOINED, onMucJoined);
272 254
     APP.xmpp.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, onLocalRoleChanged);

+ 7
- 0
modules/UI/videolayout/VideoLayout.js 查看文件

@@ -532,6 +532,13 @@ var VideoLayout = (function (my) {
532 532
         } else {
533 533
             VideoLayout.ensurePeerContainerExists(jid);
534 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,6 +48,8 @@ function JingleSession(me, sid, connection, service, eventEmitter) {
48 48
 
49 49
     this.wait = true;
50 50
     this.localStreamsSSRC = null;
51
+    this.ssrcOwners = {};
52
+    this.ssrcVideoTypes = {};
51 53
     this.eventEmitter = eventEmitter;
52 54
 
53 55
     /**
@@ -189,6 +191,10 @@ function onIceConnectionStateChange(sid, session) {
189 191
     }
190 192
 }
191 193
 
194
+JingleSession.prototype.getVideoType = function () {
195
+    return APP.desktopsharing.isUsingScreenStream() ? 'screen' : 'camera';
196
+};
197
+
192 198
 JingleSession.prototype.accept = function () {
193 199
     this.state = 'active';
194 200
 
@@ -216,7 +222,12 @@ JingleSession.prototype.accept = function () {
216 222
             initiator: this.initiator,
217 223
             responder: this.responder,
218 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 231
     var sdp = this.peerconnection.localDescription.sdp;
221 232
     while (SDPUtil.find_line(sdp, 'a=inactive')) {
222 233
         // FIXME: change any inactive to sendrecv or whatever they were originally
@@ -303,6 +314,7 @@ JingleSession.prototype.sendIceCandidate = function (candidate) {
303 314
         //console.log('sendIceCandidate: last candidate.');
304 315
         if (!this.usetrickle) {
305 316
             //console.log('should send full offer now...');
317
+            //FIXME why do we generate session-accept in 3 different places ?
306 318
             var init = $iq({to: this.peerjid,
307 319
                 type: 'set'})
308 320
                 .c('jingle', {xmlns: 'urn:xmpp:jingle:1',
@@ -314,7 +326,11 @@ JingleSession.prototype.sendIceCandidate = function (candidate) {
314 326
             var sendJingle = function (ssrc) {
315 327
                 if(!ssrc)
316 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 334
                 self.connection.sendIQ(init,
319 335
                     function () {
320 336
                         //console.log('session initiate ack');
@@ -414,6 +430,7 @@ JingleSession.prototype.sendOffer = function () {
414 430
     );
415 431
 };
416 432
 
433
+// FIXME createdOffer is never used in jitsi-meet
417 434
 JingleSession.prototype.createdOffer = function (sdp) {
418 435
     //console.log('createdOffer', sdp);
419 436
     var self = this;
@@ -426,7 +443,11 @@ JingleSession.prototype.createdOffer = function (sdp) {
426 443
                 action: 'session-initiate',
427 444
                 initiator: this.initiator,
428 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 451
         self.connection.sendIQ(init,
431 452
             function () {
432 453
                 var ack = {};
@@ -471,10 +492,35 @@ JingleSession.prototype.createdOffer = function (sdp) {
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 519
 JingleSession.prototype.setRemoteDescription = function (elem, desctype) {
475 520
     //console.log('setting remote description... ', desctype);
476 521
     this.remoteSDP = new SDP('');
477 522
     this.remoteSDP.fromJingle(elem);
523
+    this.readSsrcInfo($(elem).find(">content"));
478 524
     if (this.peerconnection.remoteDescription !== null) {
479 525
         console.log('setRemoteDescription when remote description is not null, should be pranswer', this.peerconnection.remoteDescription);
480 526
         if (this.peerconnection.remoteDescription.type == 'pranswer') {
@@ -655,7 +701,7 @@ JingleSession.prototype.createdAnswer = function (sdp, provisional) {
655 701
     }
656 702
     var self = this;
657 703
     var sendJingle = function (ssrcs) {
658
-
704
+                // FIXME why do we generate session-accept in 3 different places ?
659 705
                 var accept = $iq({to: self.peerjid,
660 706
                     type: 'set'})
661 707
                     .c('jingle', {xmlns: 'urn:xmpp:jingle:1',
@@ -663,7 +709,11 @@ JingleSession.prototype.createdAnswer = function (sdp, provisional) {
663 709
                         initiator: self.initiator,
664 710
                         responder: self.responder,
665 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 717
                 self.connection.sendIQ(accept,
668 718
                     function () {
669 719
                         var ack = {};
@@ -762,6 +812,9 @@ JingleSession.prototype.addSource = function (elem, fromJid) {
762 812
 
763 813
     console.log('addssrc', new Date().getTime());
764 814
     console.log('ice', this.peerconnection.iceConnectionState);
815
+
816
+    this.readSsrcInfo(elem);
817
+
765 818
     var sdp = new SDP(this.peerconnection.remoteDescription.sdp);
766 819
     var mySdp = new SDP(this.peerconnection.localDescription.sdp);
767 820
 
@@ -1085,7 +1138,7 @@ JingleSession.prototype.notifyMySSRCUpdate = function (old_sdp, new_sdp) {
1085 1138
             sid: this.sid
1086 1139
         }
1087 1140
     );
1088
-    var added = sdpDiffer.toJingle(add);
1141
+    var added = sdpDiffer.toJingle(add, this.getVideoType());
1089 1142
     if (added) {
1090 1143
         this.connection.sendIQ(add,
1091 1144
             function (res) {
@@ -1245,7 +1298,7 @@ JingleSession.onJingleFatalError = function (session, error)
1245 1298
 }
1246 1299
 
1247 1300
 JingleSession.prototype.setLocalDescription = function () {
1248
-    // put our ssrcs into presence so other clients can identify our stream
1301
+    var self = this;
1249 1302
     var newssrcs = [];
1250 1303
     var session = transform.parse(this.peerconnection.localDescription.sdp);
1251 1304
     session.media.forEach(function (media) {
@@ -1258,17 +1311,15 @@ JingleSession.prototype.setLocalDescription = function () {
1258 1311
                 }
1259 1312
                 newssrcs.push({
1260 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 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,20 +1327,16 @@ JingleSession.prototype.setLocalDescription = function () {
1276 1327
 
1277 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 1331
     if (newssrcs.length > 0) {
1283 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,7 +1378,6 @@ function sendKeyframe(pc) {
1331 1378
 JingleSession.prototype.remoteStreamAdded = function (data, times) {
1332 1379
     var self = this;
1333 1380
     var thessrc;
1334
-    var ssrc2jid = this.connection.emuc.ssrc2jid;
1335 1381
     var streamId = APP.RTC.getStreamID(data.stream);
1336 1382
 
1337 1383
     // look up an associated JID for a stream id
@@ -1354,40 +1400,14 @@ JingleSession.prototype.remoteStreamAdded = function (data, times) {
1354 1400
         if (ssrclines.length) {
1355 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 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,7 +125,7 @@ SDP.prototype.removeMediaLines = function(mediaindex, prefix) {
125 125
 }
126 126
 
127 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 129
 //    console.log("SSRC" + ssrcs["audio"] + " - " + ssrcs["video"]);
130 130
     var i, j, k, mline, ssrc, rtpmap, tmp, line, lines;
131 131
     var self = this;
@@ -227,7 +227,6 @@ SDP.prototype.toJingle = function (elem, thecreator, ssrcs) {
227 227
                         }
228 228
                         elem.up();
229 229
                     });
230
-                    elem.up();
231 230
                 }
232 231
                 else
233 232
                 {
@@ -257,11 +256,17 @@ SDP.prototype.toJingle = function (elem, thecreator, ssrcs) {
257 256
                         elem.c('parameter');
258 257
                         elem.attrs({name: "label", value:msid});
259 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 271
                 // XEP-0339 handle ssrc-group attributes
267 272
                 var ssrc_group_lines = SDPUtil.find_lines(this.media[i], 'a=ssrc-group:');

+ 10
- 1
modules/xmpp/SDPDiffer.js 查看文件

@@ -106,7 +106,7 @@ SDPDiffer.prototype.getNewMedia = function() {
106 106
  * @param toJid destination Jid
107 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 110
     var sdpMediaSsrcs = this.getNewMedia();
111 111
     var self = this;
112 112
 
@@ -141,6 +141,15 @@ SDPDiffer.prototype.toJingle = function(modify) {
141 141
                 }
142 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 153
             modify.up(); // end of source
145 154
         });
146 155
 

+ 0
- 69
modules/xmpp/strophe.emuc.js 查看文件

@@ -21,7 +21,6 @@ module.exports = function(XMPP, eventEmitter) {
21 21
         isOwner: false,
22 22
         role: null,
23 23
         focusMucJid: null,
24
-        ssrc2jid: {},
25 24
         init: function (conn) {
26 25
             this.connection = conn;
27 26
         },
@@ -280,14 +279,6 @@ module.exports = function(XMPP, eventEmitter) {
280 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 282
             // Status code 110 indicates that this notification is "self-presence".
292 283
             if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
293 284
                 delete this.members[from];
@@ -514,26 +505,6 @@ module.exports = function(XMPP, eventEmitter) {
514 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 508
             if(this.presMap["startMuted"] !== undefined)
538 509
             {
539 510
                 pres.c("startmuted", {audio: this.presMap["startMuted"].audio,
@@ -548,25 +519,9 @@ module.exports = function(XMPP, eventEmitter) {
548 519
         addDisplayNameToPresence: function (displayName) {
549 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 522
         addDevicesToPresence: function (devices) {
560 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 525
         addPreziToPresence: function (url, currentSlide) {
571 526
             this.presMap['prezins'] = 'http://jitsi.org/jitmeet/prezi';
572 527
             this.presMap['preziurl'] = url;
@@ -650,30 +605,6 @@ module.exports = function(XMPP, eventEmitter) {
650 605
             if(memeber.isFocus)
651 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 608
             var displayName = !config.displayJids
678 609
                 ? memeber.displayName : Strophe.getResourceFromJid(from);
679 610
 

+ 2
- 2
modules/xmpp/xmpp.js 查看文件

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

+ 0
- 1
service/xmpp/XMPPEvents.js 查看文件

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

正在加载...
取消
保存