Browse Source

fix(SS): missing remote screenshare

Reusing(removing it and adding it again) an SSRC in the
remote SDP is leading to the issue where remote video is received but
not rendered. That's why we shouldn't remove the receive only SSRCs
from the SDP. This way the sender won't send any source-remove and
source-add for the same SSRCs.
tags/v0.0.2
Hristo Terezov 3 years ago
parent
commit
d742dff746
2 changed files with 20 additions and 31 deletions
  1. 16
    27
      modules/sdp/LocalSdpMunger.js
  2. 4
    4
      modules/sdp/LocalSdpMunger.spec.js

+ 16
- 27
modules/sdp/LocalSdpMunger.js View File

245
             return;
245
             return;
246
         }
246
         }
247
 
247
 
248
-        // If the msid attribute is missing, then remove the ssrc from the transformed description so that a
249
-        // source-remove is signaled to Jicofo. This happens when the direction of the transceiver (or m-line)
250
-        // is set to 'inactive' or 'recvonly' on Firefox, Chrome (unified) and Safari.
251
-        const mediaDirection = mediaSection.mLine?.direction;
252
-
253
-        if (mediaDirection === MediaDirection.RECVONLY || mediaDirection === MediaDirection.INACTIVE) {
254
-            mediaSection.ssrcs = undefined;
255
-            mediaSection.ssrcGroups = undefined;
256
-
257
         // Add the msid attribute if it is missing when the direction is sendrecv/sendonly. Firefox doesn't produce a
248
         // Add the msid attribute if it is missing when the direction is sendrecv/sendonly. Firefox doesn't produce a
258
         // a=ssrc line with msid attribute for p2p connection.
249
         // a=ssrc line with msid attribute for p2p connection.
259
-        } else {
260
-            const msidLine = mediaSection.mLine?.msid;
261
-            const trackId = msidLine && msidLine.split(' ')[1];
262
-            const sources = [ ...new Set(mediaSection.mLine?.ssrcs?.map(s => s.id)) ];
263
-
264
-            for (const source of sources) {
265
-                const msidExists = mediaSection.ssrcs
266
-                    .find(ssrc => ssrc.id === source && ssrc.attribute === 'msid');
267
-
268
-                if (!msidExists && trackId) {
269
-                    const generatedMsid = this._generateMsidAttribute(mediaType, trackId);
270
-
271
-                    mediaSection.ssrcs.push({
272
-                        id: source,
273
-                        attribute: 'msid',
274
-                        value: generatedMsid
275
-                    });
276
-                }
250
+        const msidLine = mediaSection.mLine?.msid;
251
+        const trackId = msidLine && msidLine.split(' ')[1];
252
+        const sources = [ ...new Set(mediaSection.mLine?.ssrcs?.map(s => s.id)) ];
253
+
254
+        for (const source of sources) {
255
+            const msidExists = mediaSection.ssrcs
256
+                .find(ssrc => ssrc.id === source && ssrc.attribute === 'msid');
257
+
258
+            if (!msidExists && trackId) {
259
+                const generatedMsid = this._generateMsidAttribute(mediaType, trackId);
260
+
261
+                mediaSection.ssrcs.push({
262
+                    id: source,
263
+                    attribute: 'msid',
264
+                    value: generatedMsid
265
+                });
277
             }
266
             }
278
         }
267
         }
279
     }
268
     }

+ 4
- 4
modules/sdp/LocalSdpMunger.spec.js View File

29
         FeatureFlags.init({ });
29
         FeatureFlags.init({ });
30
         localSdpMunger = new LocalSdpMunger(tpc, localEndpointId);
30
         localSdpMunger = new LocalSdpMunger(tpc, localEndpointId);
31
     });
31
     });
32
-    describe('stripSsrcs', () => {
33
-        it('should strip ssrcs from an sdp with no msid', () => {
32
+    describe('dontStripSsrcs', () => {
33
+        it('shouldn\'t strip ssrcs from an sdp with no msid', () => {
34
             localSdpMunger.tpc.isP2P = false;
34
             localSdpMunger.tpc.isP2P = false;
35
 
35
 
36
             const sdpStr = transform.write(SampleSdpStrings.recvOnlySdp);
36
             const sdpStr = transform.write(SampleSdpStrings.recvOnlySdp);
43
             const audioSsrcs = getSsrcLines(newSdp, 'audio');
43
             const audioSsrcs = getSsrcLines(newSdp, 'audio');
44
             const videoSsrcs = getSsrcLines(newSdp, 'video');
44
             const videoSsrcs = getSsrcLines(newSdp, 'video');
45
 
45
 
46
-            expect(audioSsrcs.length).toEqual(0);
47
-            expect(videoSsrcs.length).toEqual(0);
46
+            expect(audioSsrcs.length).toEqual(1);
47
+            expect(videoSsrcs.length).toEqual(1);
48
         });
48
         });
49
 
49
 
50
         describe('should do nothing to an sdp with msid', () => {
50
         describe('should do nothing to an sdp with msid', () => {

Loading…
Cancel
Save