Bläddra i källkod

Adds 'endpoint' attributes to colibri channels. Sets the 'endpoint' for all

channels for a participant to the same value. For the focus
'fix_me_focus_endpoint' is temporarily used. For other participants, the
'resource' part of their MUC occupant jid is used.
j8
Boris Grozev 11 år sedan
förälder
incheckning
5efe0cb2f9
1 ändrade filer med 36 tillägg och 8 borttagningar
  1. 36
    8
      libs/colibri/colibri.focus.js

+ 36
- 8
libs/colibri/colibri.focus.js Visa fil

@@ -147,9 +147,16 @@ ColibriFocus.prototype._makeConference = function () {
147 147
 
148 148
     this.media.forEach(function (name) {
149 149
         elem.c('content', {name: name});
150
-        elem.c('channel', {initiator: 'true', expire: '15'}).up();
150
+        elem.c('channel', {
151
+            initiator: 'true',
152
+            expire: '15',
153
+            endpoint: 'fix_me_focus_endpoint'}).up();
151 154
         for (var j = 0; j < self.peers.length; j++) {
152
-            elem.c('channel', {initiator: 'true', expire:'15' }).up();
155
+            elem.c('channel', {
156
+                initiator: 'true',
157
+                expire: '15',
158
+                endpoint: self.peers[j].substr(1 + self.peers[j].lastIndexOf('/'));
159
+            }).up();
153 160
         }
154 161
         elem.up(); // end of content
155 162
     });
@@ -301,7 +308,8 @@ ColibriFocus.prototype.createdConference = function (result) {
301 308
                                 elem.c('channel', {
302 309
                                     initiator: 'true',
303 310
                                     expire: '15',
304
-                                    id: self.mychannel[channel].attr('id')
311
+                                    id: self.mychannel[channel].attr('id'),
312
+                                    endpoint: 'fix_me_focus_endpoint'
305 313
                                 });
306 314
 
307 315
                                 // FIXME: should reuse code from .toJingle
@@ -491,7 +499,11 @@ ColibriFocus.prototype.addNewParticipant = function (peer) {
491 499
     localSDP.media.forEach(function (media, channel) {
492 500
         var name = SDPUtil.parse_mline(media.split('\r\n')[0]).media;
493 501
         elem.c('content', {name: name});
494
-        elem.c('channel', {initiator: 'true', expire:'15'});
502
+        elem.c('channel', {
503
+                initiator: 'true',
504
+                expire:'15',
505
+                endpoint: peer.substr(1 + peer.lastIndexOf('/'))
506
+        });
495 507
         elem.up(); // end of channel
496 508
         elem.up(); // end of content
497 509
     });
@@ -518,7 +530,11 @@ ColibriFocus.prototype.updateChannel = function (remoteSDP, participant) {
518 530
     change.c('conference', {xmlns: 'http://jitsi.org/protocol/colibri', id: this.confid});
519 531
     for (channel = 0; channel < this.channels[participant].length; channel++) {
520 532
         change.c('content', {name: channel === 0 ? 'audio' : 'video'});
521
-        change.c('channel', {id: $(this.channels[participant][channel]).attr('id')});
533
+        change.c('channel', {
534
+            id: $(this.channels[participant][channel]).attr('id'),
535
+            endpoint: $(this.channels[participant][channel]).attr('endpoint'),
536
+            expire: '15'
537
+        });
522 538
 
523 539
         var rtpmap = SDPUtil.find_lines(remoteSDP.media[channel], 'a=rtpmap:');
524 540
         rtpmap.forEach(function (val) {
@@ -684,7 +700,11 @@ ColibriFocus.prototype.addIceCandidate = function (session, elem) {
684 700
         var channel = name == 'audio' ? 0 : 1; // FIXME: search mlineindex in localdesc
685 701
 
686 702
         change.c('content', {name: name});
687
-        change.c('channel', {id: $(self.channels[participant][channel]).attr('id')});
703
+        change.c('channel', {
704
+            id: $(self.channels[participant][channel]).attr('id'),
705
+            endpoint: $(self.channels[participant][channel]).attr('endpoint'),
706
+            expire: '15'
707
+        });
688 708
         $(this).find('>transport').each(function () {
689 709
             change.c('transport', {
690 710
                 ufrag: $(this).attr('ufrag'),
@@ -748,7 +768,11 @@ ColibriFocus.prototype.sendIceCandidates = function (candidates) {
748 768
         var cands = candidates.filter(function (el) { return el.sdpMLineIndex == mid; });
749 769
         if (cands.length > 0) {
750 770
             mycands.c('content', {name: cands[0].sdpMid });
751
-            mycands.c('channel', {id: $(this.mychannel[cands[0].sdpMLineIndex]).attr('id')});
771
+            mycands.c('channel', {
772
+                id: $(this.mychannel[cands[0].sdpMLineIndex]).attr('id'),
773
+                endpoint: $(this.mychannel[cands[0].sdpMLineIndex]).attr('endpoint'),
774
+                expire: '15'
775
+            });
752 776
             mycands.c('transport', {xmlns: 'urn:xmpp:jingle:transports:ice-udp:1'});
753 777
             for (var i = 0; i < cands.length; i++) {
754 778
                 mycands.c('candidate', SDPUtil.candidateToJingle(cands[i].candidate)).up();
@@ -786,7 +810,11 @@ ColibriFocus.prototype.terminate = function (session, reason) {
786 810
     change.c('conference', {xmlns: 'http://jitsi.org/protocol/colibri', id: this.confid});
787 811
     for (var channel = 0; channel < this.channels[participant].length; channel++) {
788 812
         change.c('content', {name: channel === 0 ? 'audio' : 'video'});
789
-        change.c('channel', {id: $(this.channels[participant][channel]).attr('id'), expire: '0'});
813
+        change.c('channel', {
814
+            id: $(this.channels[participant][channel]).attr('id'),
815
+            endpoint: $(this.channels[participant][channel]).attr('endpoint'),
816
+            expire: '0'
817
+        });
790 818
         change.up(); // end of channel
791 819
         change.up(); // end of content
792 820
     }

Laddar…
Avbryt
Spara