Browse Source

allow focus to associate streams to participant jids

j8
Philipp Hancke 11 years ago
parent
commit
905d54bee4
1 changed files with 9 additions and 4 deletions
  1. 9
    4
      libs/colibri.js

+ 9
- 4
libs/colibri.js View File

@@ -94,6 +94,12 @@ ColibriFocus.prototype.makeConference = function (peers) {
94 94
     };
95 95
     this.peerconnection.onaddstream = function (event) {
96 96
         ob.remoteStream = event.stream;
97
+        // search the jid associated with this stream
98
+        Object.keys(ob.remotessrc).forEach(function (jid) {
99
+            if (ob.remotessrc[jid].join('\r\n').indexOf('mslabel:' + event.stream.id) != -1) {
100
+                event.peerjid = jid;
101
+            }
102
+        });
97 103
         $(document).trigger('remotestreamadded.jingle', [event, ob.sid]);
98 104
     };
99 105
     this.peerconnection.onicecandidate = function (event) {
@@ -481,11 +487,11 @@ ColibriFocus.prototype.updateChannel = function (remoteSDP, participant) {
481 487
 // tell everyone about a new participants a=ssrc lines (isadd is true)
482 488
 // or a leaving participants a=ssrc lines
483 489
 // FIXME: should not take an SDP, but rather the a=ssrc lines and probably a=mid
484
-ColibriFocus.prototype.sendSSRCUpdate = function (sdp, exclude, isadd) {
490
+ColibriFocus.prototype.sendSSRCUpdate = function (sdp, jid, isadd) {
485 491
     var ob = this;
486 492
     this.peers.forEach(function (peerjid) {
487
-        if (peerjid == exclude) return;
488
-        console.log('tell', peerjid, 'about ' + (isadd ? 'new' : 'removed') + ' ssrcs from', exclude);
493
+        if (peerjid == jid) return;
494
+        console.log('tell', peerjid, 'about ' + (isadd ? 'new' : 'removed') + ' ssrcs from', jid);
489 495
         if (!ob.remotessrc[peerjid]) {
490 496
             // FIXME: this should only send to participants that are stable, i.e. who have sent a session-accept
491 497
             // possibly, this.remoteSSRC[session.peerjid] does not exist yet
@@ -650,7 +656,6 @@ ColibriFocus.prototype.terminate = function (session, reason) {
650 656
     if (!this.remotessrc[session.peerjid] || participant == -1) {
651 657
         return;
652 658
     }
653
-    console.log('remote ssrcs:', this.remotessrc[session.peerjid]);
654 659
     var ssrcs = this.remotessrc[session.peerjid];
655 660
     for (var i = 0; i < ssrcs.length; i++) {
656 661
         if (!this.removessrc[i]) this.removessrc[i] = '';

Loading…
Cancel
Save