Browse Source

fix(simulcast): Add only the primary ssrcs to SIM group on FF

In preparation for turning on RTX on Firefox: add only the primary ssrcs to the SIM group if FID groups are present
dev1
Jaya Allamsetty 5 years ago
parent
commit
6e4dd4c2dd
1 changed files with 16 additions and 12 deletions
  1. 16
    12
      modules/RTC/TraceablePeerConnection.js

+ 16
- 12
modules/RTC/TraceablePeerConnection.js View File

@@ -1309,12 +1309,6 @@ TraceablePeerConnection.prototype.getLocalSSRC = function(localTrack) {
1309 1309
  * group via the a=simulcast line.  Unfortunately, Jicofo will complain
1310 1310
  * if it sees ssrcs with matching msids but no ssrc-group, so we'll inject
1311 1311
  * an ssrc-group line to make Jicofo happy.
1312
- * NOTE: unlike plan B simulcast, the ssrcs in this inject ssrc-group will
1313
- * NOT necessarily be in order of quality (low to high) because:
1314
- * a) when translating between unified plan and plan b the order of the ssrcs
1315
- * is not preserved and
1316
- * b) it isn't guaranteed that firefox will give them to us in order to begin
1317
- * with
1318 1312
  * @param desc A session description object (with 'type' and 'sdp' fields)
1319 1313
  * @return A session description object with its sdp field modified to
1320 1314
  * contain an inject ssrc-group for simulcast
@@ -1324,15 +1318,25 @@ TraceablePeerConnection.prototype._injectSsrcGroupForUnifiedSimulcast
1324 1318
         const sdp = transform.parse(desc.sdp);
1325 1319
         const video = sdp.media.find(mline => mline.type === 'video');
1326 1320
 
1321
+        // Check if the browser supports RTX, add only the primary ssrcs to the
1322
+        // SIM group if that is the case.
1323
+        video.ssrcGroups = video.ssrcGroups || [];
1324
+        const fidGroups = video.ssrcGroups.filter(group => group.semantics === 'FID');
1325
+
1327 1326
         if (video.simulcast || video.simulcast_03) {
1328 1327
             const ssrcs = [];
1329 1328
 
1330
-            video.ssrcs.forEach(ssrc => {
1331
-                if (ssrc.attribute === 'msid') {
1332
-                    ssrcs.push(ssrc.id);
1333
-                }
1334
-            });
1335
-            video.ssrcGroups = video.ssrcGroups || [];
1329
+            if (fidGroups && fidGroups.length) {
1330
+                fidGroups.forEach(group => {
1331
+                    ssrcs.push(group.ssrcs.split(' ')[0]);
1332
+                });
1333
+            } else {
1334
+                video.ssrcs.forEach(ssrc => {
1335
+                    if (ssrc.attribute === 'msid') {
1336
+                        ssrcs.push(ssrc.id);
1337
+                    }
1338
+                });
1339
+            }
1336 1340
             if (video.ssrcGroups.find(group => group.semantics === 'SIM')) {
1337 1341
                 // Group already exists, no need to do anything
1338 1342
                 return desc;

Loading…
Cancel
Save