浏览代码

fix(TPC) Stop munging remote desc for imploding the SIM groups.

Jicofo by default now strips the simulcast SSRCs and sends only the primary SSRC and RTX to all the receiving endpoints in the call. Therefore remote SDP munging is not required on the clients anymore.
dev1
Jaya Allamsetty 3 年前
父节点
当前提交
4b9757064e

+ 0
- 4
modules/RTC/TraceablePeerConnection.js 查看文件

2454
             }
2454
             }
2455
         }
2455
         }
2456
         if (this.isSimulcastOn()) {
2456
         if (this.isSimulcastOn()) {
2457
-            // Implode the simulcast ssrcs so that the remote sdp has only the first ssrc in the SIM group.
2458
-            remoteDescription = this.simulcast.mungeRemoteDescription(remoteDescription);
2459
-            this.trace('setRemoteDescription::postTransform (simulcast)', dumpSDP(remoteDescription));
2460
-
2461
             remoteDescription = this.tpcUtils.insertUnifiedPlanSimulcastReceive(remoteDescription);
2457
             remoteDescription = this.tpcUtils.insertUnifiedPlanSimulcastReceive(remoteDescription);
2462
             this.trace('setRemoteDescription::postTransform (sim receive)', dumpSDP(remoteDescription));
2458
             this.trace('setRemoteDescription::postTransform (sim receive)', dumpSDP(remoteDescription));
2463
         }
2459
         }

+ 0
- 35
modules/sdp/SDPSimulcast.spec.js 查看文件

119
             });
119
             });
120
         });
120
         });
121
     });
121
     });
122
-
123
-    describe('mungeRemoteDescription', () => {
124
-        it('should implode remote simulcast SSRCs into one FID group', () => {
125
-            const sdp = SampleSdpStrings.simulcastRtxSdp;
126
-            const desc = {
127
-                type: 'offer',
128
-                sdp: transform.write(sdp)
129
-            };
130
-            const newDesc = simulcast.mungeRemoteDescription(desc);
131
-            const newSdp = transform.parse(newDesc.sdp);
132
-            const fidGroups = getVideoGroups(newSdp, 'FID');
133
-            const simGroups = getVideoGroups(newSdp, 'SIM');
134
-
135
-            expect(fidGroups.length).toEqual(1);
136
-            expect(simGroups.length).toEqual(0);
137
-            expect(fidGroups[0].ssrcs).toContain('1757014965');
138
-            expect(fidGroups[0].ssrcs).toContain('984899560');
139
-        });
140
-
141
-        it('should implode remote simulcast SSRCs without RTX into one primary SSRC', () => {
142
-            const sdp = SampleSdpStrings.simulcastNoRtxSdp;
143
-            const desc = {
144
-                type: 'offer',
145
-                sdp: transform.write(sdp)
146
-            };
147
-            const newDesc = simulcast.mungeRemoteDescription(desc);
148
-            const newSdp = transform.parse(newDesc.sdp);
149
-            const fidGroups = getVideoGroups(newSdp, 'FID');
150
-            const simGroups = getVideoGroups(newSdp, 'SIM');
151
-
152
-            expect(fidGroups.length).toEqual(0);
153
-            expect(simGroups.length).toEqual(0);
154
-            expect(numVideoSsrcs(newSdp)).toEqual(1);
155
-        });
156
-    });
157
 });
122
 });

+ 0
- 73
modules/sdp/SdpSimulcast.ts 查看文件

241
             sdp: transform.write(session)
241
             sdp: transform.write(session)
242
         });
242
         });
243
     }
243
     }
244
-
245
-    /**
246
-     * Munges the given media description by removing the SSRCs and related FID groups for the higher layer streams.
247
-     *
248
-     * @param description
249
-     * @returns
250
-     */
251
-    mungeRemoteDescription(description: Description) : Description {
252
-        if (!description || !description.sdp) {
253
-            return description;
254
-        }
255
-
256
-        const session = transform.parse(description.sdp);
257
-
258
-        for (const media of session.media) {
259
-            if (media.type !== MediaType.VIDEO) {
260
-                continue;
261
-            }
262
-
263
-            if (media.direction !== MediaDirection.SENDONLY) {
264
-                continue;
265
-            }
266
-
267
-            // Ignore m-lines that do not have any SSRCs or SSRC groups. These are the ones associated with remote
268
-            // sources that have left the call. These will be recycled when a new remote source joins the call.
269
-            if (!media.ssrcGroups?.length || !media?.ssrcs.length) {
270
-                continue;
271
-            }
272
-
273
-            // Cache the SSRCs and the source groups.
274
-            const mungedSsrcs = new Set(media.ssrcs.slice());
275
-            const mungedSsrcGroups = new Set(media.ssrcGroups.slice());
276
-            const fidGroups = media.ssrcGroups.filter(group => group.semantics === 'FID');
277
-            const simGroup = media.ssrcGroups.find(group => group.semantics === 'SIM');
278
-            const primarySsrc = simGroup?.ssrcs.split(' ')[0];;
279
-
280
-            // When simulcast and RTX are both enabled.
281
-            if (fidGroups.length && simGroup) {
282
-                const fidGroup = fidGroups.find(group => group.ssrcs.includes(primarySsrc));
283
-                const secondarySsrc = fidGroup.ssrcs.split(' ')[1];
284
-
285
-                for (const ssrcGroup of media.ssrcGroups) {
286
-                    if (ssrcGroup !== fidGroup) {
287
-                        mungedSsrcGroups.delete(ssrcGroup);
288
-                    }
289
-                }
290
-                for (const ssrc of media.ssrcs) {
291
-                    if (ssrc.id.toString() !== primarySsrc
292
-                        && ssrc.id.toString() !== secondarySsrc) {
293
-                        mungedSsrcs.delete(ssrc);
294
-                    }
295
-                }
296
-
297
-            // When simulcast is enabled but RTX is disabled.
298
-            } else if (simGroup) {
299
-                mungedSsrcGroups.delete(simGroup);
300
-
301
-                for (const ssrc of media.ssrcs) {
302
-                    if (ssrc.id.toString() !== primarySsrc) {
303
-                        mungedSsrcs.delete(ssrc);
304
-                    }
305
-                }
306
-            }
307
-
308
-            media.ssrcs = Array.from(mungedSsrcs);
309
-            media.ssrcGroups = Array.from(mungedSsrcGroups);
310
-        }
311
-
312
-        return new RTCSessionDescription ({
313
-            type: description.type,
314
-            sdp: transform.write(session)
315
-        });
316
-    }
317
 }
244
 }

+ 0
- 7
types/auto/modules/sdp/SdpSimulcast.d.ts 查看文件

71
      * @returns
71
      * @returns
72
      */
72
      */
73
     mungeLocalDescription(description: Description): Description;
73
     mungeLocalDescription(description: Description): Description;
74
-    /**
75
-     * Munges the given media description by removing the SSRCs and related FID groups for the higher layer streams.
76
-     *
77
-     * @param description
78
-     * @returns
79
-     */
80
-    mungeRemoteDescription(description: Description): Description;
81
 }
74
 }
82
 export {};
75
 export {};

正在加载...
取消
保存