Browse Source

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 years ago
parent
commit
5efe0cb2f9
1 changed files with 36 additions and 8 deletions
  1. 36
    8
      libs/colibri/colibri.focus.js

+ 36
- 8
libs/colibri/colibri.focus.js View File

147
 
147
 
148
     this.media.forEach(function (name) {
148
     this.media.forEach(function (name) {
149
         elem.c('content', {name: name});
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
         for (var j = 0; j < self.peers.length; j++) {
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
         elem.up(); // end of content
161
         elem.up(); // end of content
155
     });
162
     });
301
                                 elem.c('channel', {
308
                                 elem.c('channel', {
302
                                     initiator: 'true',
309
                                     initiator: 'true',
303
                                     expire: '15',
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
                                 // FIXME: should reuse code from .toJingle
315
                                 // FIXME: should reuse code from .toJingle
491
     localSDP.media.forEach(function (media, channel) {
499
     localSDP.media.forEach(function (media, channel) {
492
         var name = SDPUtil.parse_mline(media.split('\r\n')[0]).media;
500
         var name = SDPUtil.parse_mline(media.split('\r\n')[0]).media;
493
         elem.c('content', {name: name});
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
         elem.up(); // end of channel
507
         elem.up(); // end of channel
496
         elem.up(); // end of content
508
         elem.up(); // end of content
497
     });
509
     });
518
     change.c('conference', {xmlns: 'http://jitsi.org/protocol/colibri', id: this.confid});
530
     change.c('conference', {xmlns: 'http://jitsi.org/protocol/colibri', id: this.confid});
519
     for (channel = 0; channel < this.channels[participant].length; channel++) {
531
     for (channel = 0; channel < this.channels[participant].length; channel++) {
520
         change.c('content', {name: channel === 0 ? 'audio' : 'video'});
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
         var rtpmap = SDPUtil.find_lines(remoteSDP.media[channel], 'a=rtpmap:');
539
         var rtpmap = SDPUtil.find_lines(remoteSDP.media[channel], 'a=rtpmap:');
524
         rtpmap.forEach(function (val) {
540
         rtpmap.forEach(function (val) {
684
         var channel = name == 'audio' ? 0 : 1; // FIXME: search mlineindex in localdesc
700
         var channel = name == 'audio' ? 0 : 1; // FIXME: search mlineindex in localdesc
685
 
701
 
686
         change.c('content', {name: name});
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
         $(this).find('>transport').each(function () {
708
         $(this).find('>transport').each(function () {
689
             change.c('transport', {
709
             change.c('transport', {
690
                 ufrag: $(this).attr('ufrag'),
710
                 ufrag: $(this).attr('ufrag'),
748
         var cands = candidates.filter(function (el) { return el.sdpMLineIndex == mid; });
768
         var cands = candidates.filter(function (el) { return el.sdpMLineIndex == mid; });
749
         if (cands.length > 0) {
769
         if (cands.length > 0) {
750
             mycands.c('content', {name: cands[0].sdpMid });
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
             mycands.c('transport', {xmlns: 'urn:xmpp:jingle:transports:ice-udp:1'});
776
             mycands.c('transport', {xmlns: 'urn:xmpp:jingle:transports:ice-udp:1'});
753
             for (var i = 0; i < cands.length; i++) {
777
             for (var i = 0; i < cands.length; i++) {
754
                 mycands.c('candidate', SDPUtil.candidateToJingle(cands[i].candidate)).up();
778
                 mycands.c('candidate', SDPUtil.candidateToJingle(cands[i].candidate)).up();
786
     change.c('conference', {xmlns: 'http://jitsi.org/protocol/colibri', id: this.confid});
810
     change.c('conference', {xmlns: 'http://jitsi.org/protocol/colibri', id: this.confid});
787
     for (var channel = 0; channel < this.channels[participant].length; channel++) {
811
     for (var channel = 0; channel < this.channels[participant].length; channel++) {
788
         change.c('content', {name: channel === 0 ? 'audio' : 'video'});
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
         change.up(); // end of channel
818
         change.up(); // end of channel
791
         change.up(); // end of content
819
         change.up(); // end of content
792
     }
820
     }

Loading…
Cancel
Save