Browse Source

Fixes an issue which could cause last-n settings to not be respected by new channel allocations.

master
Lyubomir Marinov 11 years ago
parent
commit
777475c9ce
1 changed files with 30 additions and 38 deletions
  1. 30
    38
      libs/colibri/colibri.focus.js

+ 30
- 38
libs/colibri/colibri.focus.js View File

201
 
201
 
202
 ColibriFocus.prototype._makeConference = function () {
202
 ColibriFocus.prototype._makeConference = function () {
203
     var self = this;
203
     var self = this;
204
-    var elem = $iq({to: this.bridgejid, type: 'get'});
205
-    elem.c('conference', {xmlns: 'http://jitsi.org/protocol/colibri'});
204
+    var elem = $iq({ to: this.bridgejid, type: 'get' });
205
+    elem.c('conference', { xmlns: 'http://jitsi.org/protocol/colibri' });
206
 
206
 
207
     this.media.forEach(function (name) {
207
     this.media.forEach(function (name) {
208
         var elemName;
208
         var elemName;
216
         else
216
         else
217
         {
217
         {
218
             elemName = 'channel';
218
             elemName = 'channel';
219
-            if (('video' === name) && (this.channelLastN >= 0))
220
-                elemAttrs['last-n'] = this.channelLastN;
219
+            if (('video' === name) && (self.channelLastN >= 0))
220
+                elemAttrs['last-n'] = self.channelLastN;
221
         }
221
         }
222
 
222
 
223
-        elem.c('content', {name: name});
223
+        elem.c('content', { name: name });
224
 
224
 
225
         elem.c(elemName, elemAttrs);
225
         elem.c(elemName, elemAttrs);
226
         elem.attrs({ endpoint: self.myMucResource });
226
         elem.attrs({ endpoint: self.myMucResource });
655
         {
655
         {
656
             console.error('local description not ready yet, postponing', peer);
656
             console.error('local description not ready yet, postponing', peer);
657
         }
657
         }
658
-        window.setTimeout(function () {
659
-            self.addNewParticipant(peer);
660
-        }, 250);
658
+        window.setTimeout(function () { self.addNewParticipant(peer); }, 250);
661
         return;
659
         return;
662
     }
660
     }
663
     var index = this.channels.length;
661
     var index = this.channels.length;
665
     this.peers.push(peer);
663
     this.peers.push(peer);
666
 
664
 
667
     var elem = $iq({to: this.bridgejid, type: 'get'});
665
     var elem = $iq({to: this.bridgejid, type: 'get'});
668
-    elem.c('conference', {xmlns: 'http://jitsi.org/protocol/colibri', id: this.confid});
666
+    elem.c(
667
+        'conference',
668
+        { xmlns: 'http://jitsi.org/protocol/colibri', id: this.confid });
669
     var localSDP = new SDP(this.peerconnection.localDescription.sdp);
669
     var localSDP = new SDP(this.peerconnection.localDescription.sdp);
670
     localSDP.media.forEach(function (media, channel) {
670
     localSDP.media.forEach(function (media, channel) {
671
         var name = SDPUtil.parse_mid(SDPUtil.find_line(media, 'a=mid:'));
671
         var name = SDPUtil.parse_mid(SDPUtil.find_line(media, 'a=mid:'));
685
         else
685
         else
686
         {
686
         {
687
             elemName = 'channel';
687
             elemName = 'channel';
688
-            if (('video' === name) && (this.channelLastN >= 0))
689
-                elemAttrs['last-n'] = this.channelLastN;
688
+            if (('video' === name) && (self.channelLastN >= 0))
689
+                elemAttrs['last-n'] = self.channelLastN;
690
         }
690
         }
691
 
691
 
692
-        elem.c('content', {name: name});
692
+        elem.c('content', { name: name });
693
         elem.c(elemName, elemAttrs);
693
         elem.c(elemName, elemAttrs);
694
         elem.up(); // end of channel/sctpconnection
694
         elem.up(); // end of channel/sctpconnection
695
         elem.up(); // end of content
695
         elem.up(); // end of content
817
     if (!this.peerconnection.localDescription)
817
     if (!this.peerconnection.localDescription)
818
     {
818
     {
819
         console.warn("addSource - localDescription not ready yet")
819
         console.warn("addSource - localDescription not ready yet")
820
-        setTimeout(function()
821
-            {
822
-                self.addSource(elem, fromJid);
823
-            },
824
-            200
825
-        );
820
+        setTimeout(function() { self.addSource(elem, fromJid); }, 200);
826
         return;
821
         return;
827
     }
822
     }
828
 
823
 
863
     if (!self.peerconnection.localDescription)
858
     if (!self.peerconnection.localDescription)
864
     {
859
     {
865
         console.warn("removeSource - localDescription not ready yet");
860
         console.warn("removeSource - localDescription not ready yet");
866
-        setTimeout(function()
867
-            {
868
-                self.removeSource(elem, fromJid);
869
-            },
870
-            200
871
-        );
861
+        setTimeout(function() { self.removeSource(elem, fromJid); }, 200);
872
         return;
862
         return;
873
     }
863
     }
874
 
864
 
1009
     }
999
     }
1010
     if (this.drip_container.length === 0) {
1000
     if (this.drip_container.length === 0) {
1011
         // start 20ms callout
1001
         // start 20ms callout
1012
-        window.setTimeout(function () {
1013
-            if (self.drip_container.length === 0) return;
1014
-            self.sendIceCandidates(self.drip_container);
1015
-            self.drip_container = [];
1016
-        }, 20);
1002
+        window.setTimeout(
1003
+            function () {
1004
+                if (self.drip_container.length === 0) return;
1005
+                self.sendIceCandidates(self.drip_container);
1006
+                self.drip_container = [];
1007
+            },
1008
+            20);
1017
     }
1009
     }
1018
     this.drip_container.push(candidate);
1010
     this.drip_container.push(candidate);
1019
 };
1011
 };
1210
         this.channelLastN = channelLastN;
1202
         this.channelLastN = channelLastN;
1211
 
1203
 
1212
         // Update/patch the existing channels.
1204
         // Update/patch the existing channels.
1213
-        var patch = $iq({ to:this.bridgejid, type:'set' });
1205
+        var patch = $iq({ to: this.bridgejid, type: 'set' });
1214
 
1206
 
1215
         patch.c(
1207
         patch.c(
1216
             'conference',
1208
             'conference',
1217
-            { xmlns:'http://jitsi.org/protocol/colibri', id:this.confid });
1218
-        patch.c('content', { name:'video' });
1209
+            { xmlns: 'http://jitsi.org/protocol/colibri', id: this.confid });
1210
+        patch.c('content', { name: 'video' });
1219
         patch.c(
1211
         patch.c(
1220
             'channel',
1212
             'channel',
1221
             {
1213
             {
1222
-                id:$(this.mychannel[1 /* video */]).attr('id'),
1223
-                'last-n':this.channelLastN
1214
+                id: $(this.mychannel[1 /* video */]).attr('id'),
1215
+                'last-n': this.channelLastN
1224
             });
1216
             });
1225
         patch.up(); // end of channel
1217
         patch.up(); // end of channel
1226
         for (var p = 0; p < this.channels.length; p++)
1218
         for (var p = 0; p < this.channels.length; p++)
1228
             patch.c(
1220
             patch.c(
1229
                 'channel',
1221
                 'channel',
1230
                 {
1222
                 {
1231
-                    id:$(this.channels[p][1 /* video */]).attr('id'),
1232
-                    'last-n':this.channelLastN
1223
+                    id: $(this.channels[p][1 /* video */]).attr('id'),
1224
+                    'last-n': this.channelLastN
1233
                 });
1225
                 });
1234
             patch.up(); // end of channel
1226
             patch.up(); // end of channel
1235
         }
1227
         }
1236
         this.connection.sendIQ(
1228
         this.connection.sendIQ(
1237
             patch,
1229
             patch,
1238
             function (res) {
1230
             function (res) {
1239
-                console.info('Set channel last-n succeeded: ', res);
1231
+                console.info('Set channel last-n succeeded:', res);
1240
             },
1232
             },
1241
             function (err) {
1233
             function (err) {
1242
-                console.error('Set channel last-n failed: ', err);
1234
+                console.error('Set channel last-n failed:', err);
1243
             });
1235
             });
1244
     }
1236
     }
1245
 };
1237
 };

Loading…
Cancel
Save