Browse Source

colibri.js: dont add ssrcs for mixed audio

j8
Philipp Hancke 11 years ago
parent
commit
668219e5ff
1 changed files with 26 additions and 14 deletions
  1. 26
    14
      libs/colibri.js

+ 26
- 14
libs/colibri.js View File

@@ -293,13 +293,15 @@ ColibriFocus.prototype.initiate = function (peer, isInitiator) {
293 293
             sdp.removeMediaLines(i, 'a=fingerprint:');
294 294
             sdp.removeMediaLines(i, 'a=setup:');
295 295
 
296
-            // re-add all remote a=ssrcs
297
-            for (var jid in this.remotessrc) {
298
-                if (jid == peer) continue;
299
-                sdp.media[i] += this.remotessrc[jid][i];
296
+            if (i > 0) { // not for audio
297
+                // re-add all remote a=ssrcs
298
+                for (var jid in this.remotessrc) {
299
+                    if (jid == peer) continue;
300
+                    sdp.media[i] += this.remotessrc[jid][i];
301
+                }
302
+                // and local a=ssrc lines
303
+                sdp.media[i] += SDPUtil.find_lines(localSDP.media[i], 'a=ssrc').join('\r\n') + '\r\n';
300 304
             }
301
-            // and local a=ssrc lines
302
-            sdp.media[i] += SDPUtil.find_lines(localSDP.media[i], 'a=ssrc').join('\r\n') + '\r\n';
303 305
         }
304 306
         sdp.raw = sdp.session + sdp.media.join('');
305 307
     } else {
@@ -513,7 +515,11 @@ ColibriFocus.prototype.sendSSRCUpdate = function (sdp, exclude, isadd) {
513 515
                 sid: peersess.sid
514 516
             }
515 517
         );
518
+        // FIXME: only announce video ssrcs since we mix audio and dont need 
519
+        //      the audio ssrcs therefore
520
+        var modified = false;
516 521
         for (channel = 0; channel < sdp.media.length; channel++) {
522
+            modified = true;
517 523
             tmp = SDPUtil.find_lines(sdp.media[channel], 'a=ssrc:');
518 524
             modify.c('content', {name: SDPUtil.parse_mid(SDPUtil.find_line(sdp.media[channel], 'a=mid:'))});
519 525
             modify.c('source', { xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
@@ -536,14 +542,18 @@ ColibriFocus.prototype.sendSSRCUpdate = function (sdp, exclude, isadd) {
536 542
             modify.up(); // end of source
537 543
             modify.up(); // end of content
538 544
         }
539
-        ob.connection.sendIQ(modify,
540
-            function (res) {
541
-                console.warn('got modify result');
542
-            },
543
-            function (err) {
544
-                console.warn('got modify error');
545
-            }
546
-        );
545
+        if (modified) {
546
+            ob.connection.sendIQ(modify,
547
+                function (res) {
548
+                    console.warn('got modify result');
549
+                },
550
+                function (err) {
551
+                    console.warn('got modify error');
552
+                }
553
+            );
554
+        } else {
555
+            console.log('modification not necessary');
556
+        }
547 557
     });
548 558
 };
549 559
 
@@ -565,11 +575,13 @@ ColibriFocus.prototype.setRemoteDescription = function (session, elem, desctype)
565 575
     // ACT 3: note the SSRCs
566 576
     this.remotessrc[session.peerjid] = [];
567 577
     for (channel = 0; channel < this.channels[participant].length; channel++) {
578
+        if (channel == 0) continue;
568 579
         this.remotessrc[session.peerjid][channel] = SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').join('\r\n') + '\r\n';
569 580
     }
570 581
 
571 582
     // ACT 4: add new a=ssrc lines to local remotedescription
572 583
     for (channel = 0; channel < this.channels[participant].length; channel++) {
584
+        if (channel == 0) continue;
573 585
         if (!this.addssrc[channel]) this.addssrc[channel] = '';
574 586
         this.addssrc[channel] += SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').join('\r\n') + '\r\n';
575 587
     }

Loading…
Cancel
Save