浏览代码

fix(SDP<->Jingle): Reject m-line with port 0 only when a=bundle-only is not present

Use unique session id per TPC.
Translate a=rid to Jingle only when simulcast through RIDs, i.e., ssrc-less simulcast is supported
dev1
Jaya Allamsetty 5 年前
父节点
当前提交
26f5e88813
共有 2 个文件被更改,包括 27 次插入4 次删除
  1. 18
    1
      modules/browser/BrowserCapabilities.js
  2. 9
    3
      modules/xmpp/SDP.js

+ 18
- 1
modules/browser/BrowserCapabilities.js 查看文件

216
         return !this.usesUnifiedPlan();
216
         return !this.usesUnifiedPlan();
217
     }
217
     }
218
 
218
 
219
+    /**
220
+     * Checks if the browser uses SDP munging for turning on simulcast.
221
+     *
222
+     * @returns {boolean}
223
+     */
224
+    usesSdpMungingForSimulcast() {
225
+        return this.isChromiumBased() || this.isSafariWithVP8();
226
+    }
227
+
219
     /**
228
     /**
220
      * Checks if the browser uses unified plan.
229
      * Checks if the browser uses unified plan.
221
      *
230
      *
270
      * @returns {boolean}
279
      * @returns {boolean}
271
      */
280
      */
272
     usesAdapter() {
281
     usesAdapter() {
273
-        return this.usesNewGumFlow();
282
+        return !this.isFirefox() && !this.isReactNative();
283
+    }
284
+
285
+    /**
286
+     * Checks if the browser uses RIDs/MIDs for siganling the simulcast streams
287
+     * to the bridge instead of the ssrcs.
288
+     */
289
+    usesRidsForSimulcast() {
290
+        return false;
274
     }
291
     }
275
 
292
 
276
     /**
293
     /**

+ 9
- 3
modules/xmpp/SDP.js 查看文件

1
 /* global $ */
1
 /* global $ */
2
 
2
 
3
+import browser from '../browser';
3
 import SDPUtil from './SDPUtil';
4
 import SDPUtil from './SDPUtil';
4
 
5
 
5
 /**
6
 /**
318
 
319
 
319
             const ridLines = SDPUtil.findLines(this.media[i], 'a=rid');
320
             const ridLines = SDPUtil.findLines(this.media[i], 'a=rid');
320
 
321
 
321
-            if (ridLines.length) {
322
+            if (ridLines.length && browser.usesRidsForSimulcast()) {
322
                 // Map a line which looks like "a=rid:2 send" to just
323
                 // Map a line which looks like "a=rid:2 send" to just
323
                 // the rid ("2")
324
                 // the rid ("2")
324
                 const rids = ridLines
325
                 const rids = ridLines
406
         } else if (SDPUtil.findLine(m, 'a=inactive', this.session)) {
407
         } else if (SDPUtil.findLine(m, 'a=inactive', this.session)) {
407
             elem.attrs({ senders: 'none' });
408
             elem.attrs({ senders: 'none' });
408
         }
409
         }
409
-        if (mline.port === '0') {
410
+
411
+        // Reject an m-line only when port is 0 and a=bundle-only is not present in the section.
412
+        // The port is automatically set to 0 when bundle-only is used.
413
+        if (mline.port === '0' && !SDPUtil.findLine(m, 'a=bundle-only', this.session)) {
410
             // estos hack to reject an m-line
414
             // estos hack to reject an m-line
411
             elem.attrs({ senders: 'rejected' });
415
             elem.attrs({ senders: 'rejected' });
412
         }
416
         }
566
 // construct an SDP from a jingle stanza
570
 // construct an SDP from a jingle stanza
567
 SDP.prototype.fromJingle = function(jingle) {
571
 SDP.prototype.fromJingle = function(jingle) {
568
     const self = this;
572
     const self = this;
573
+    const sessionId = (new Date()).getTime();
569
 
574
 
575
+    // Use a unique session id for every TPC.
570
     this.raw = 'v=0\r\n'
576
     this.raw = 'v=0\r\n'
571
-        + 'o=- 1923518516 2 IN IP4 0.0.0.0\r\n'// FIXME
577
+        + `o=- ${sessionId} 2 IN IP4 0.0.0.0\r\n`
572
         + 's=-\r\n'
578
         + 's=-\r\n'
573
         + 't=0 0\r\n';
579
         + 't=0 0\r\n';
574
 
580
 

正在加载...
取消
保存