Просмотр исходного кода

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 лет назад
Родитель
Сommit
d742dff746
2 измененных файлов: 20 добавлений и 31 удалений
  1. 16
    27
      modules/sdp/LocalSdpMunger.js
  2. 4
    4
      modules/sdp/LocalSdpMunger.spec.js

+ 16
- 27
modules/sdp/LocalSdpMunger.js Просмотреть файл

@@ -245,35 +245,24 @@ export default class LocalSdpMunger {
245 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 248
         // Add the msid attribute if it is missing when the direction is sendrecv/sendonly. Firefox doesn't produce a
258 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 Просмотреть файл

@@ -29,8 +29,8 @@ describe('TransformSdpsForUnifiedPlan', () => {
29 29
         FeatureFlags.init({ });
30 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 34
             localSdpMunger.tpc.isP2P = false;
35 35
 
36 36
             const sdpStr = transform.write(SampleSdpStrings.recvOnlySdp);
@@ -43,8 +43,8 @@ describe('TransformSdpsForUnifiedPlan', () => {
43 43
             const audioSsrcs = getSsrcLines(newSdp, 'audio');
44 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 50
         describe('should do nothing to an sdp with msid', () => {

Загрузка…
Отмена
Сохранить