|
@@ -66,20 +66,20 @@ function getVideoGroups(parsedSdp, groupSemantics) {
|
66
|
66
|
.filter(g => g.semantics === groupSemantics);
|
67
|
67
|
}
|
68
|
68
|
|
69
|
|
-describe ('RtxModifier', function() {
|
|
69
|
+describe('RtxModifier', function() {
|
70
|
70
|
beforeEach(function() {
|
71
|
71
|
this.rtxModifier = new RtxModifier();
|
72
|
72
|
this.transform = transform;
|
73
|
73
|
this.SDPUtil = SDPUtil;
|
74
|
74
|
});
|
75
|
75
|
|
76
|
|
- describe ('modifyRtxSsrcs', function() {
|
77
|
|
- describe ('when given an sdp with a single video ssrc', function() {
|
|
76
|
+ describe('modifyRtxSsrcs', function() {
|
|
77
|
+ describe('when given an sdp with a single video ssrc', function() {
|
78
|
78
|
beforeEach(function() {
|
79
|
79
|
this.singleVideoSdp = SampleSdpStrings.plainVideoSdp;
|
80
|
80
|
this.primaryVideoSsrc = getPrimaryVideoSsrc(this.singleVideoSdp);
|
81
|
81
|
});
|
82
|
|
- it ('should add a single rtx ssrc', function() {
|
|
82
|
+ it('should add a single rtx ssrc', function() {
|
83
|
83
|
// Call rtxModifier.modifyRtxSsrcs with an sdp that contains a single video
|
84
|
84
|
// ssrc. The returned sdp should have an rtx ssrc and an fid group.
|
85
|
85
|
const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
|
|
@@ -97,7 +97,7 @@ describe ('RtxModifier', function() {
|
97
|
97
|
expect(fidGroupPrimarySsrc).toEqual(this.primaryVideoSsrc);
|
98
|
98
|
});
|
99
|
99
|
|
100
|
|
- it ('should re-use the same rtx ssrc for a primary ssrc it\'s seen before', function() {
|
|
100
|
+ it('should re-use the same rtx ssrc for a primary ssrc it\'s seen before', function() {
|
101
|
101
|
// Have rtxModifier generate an rtx ssrc via modifyRtxSsrcs. Then call it again
|
102
|
102
|
// with the same primary ssrc in the sdp (but no rtx ssrc). It should use
|
103
|
103
|
// the same rtx ssrc as before.
|
|
@@ -115,7 +115,7 @@ describe ('RtxModifier', function() {
|
115
|
115
|
expect(newFidGroupRtxSsrc).toEqual(fidGroupRtxSsrc);
|
116
|
116
|
});
|
117
|
117
|
|
118
|
|
- it ('should NOT re-use the same rtx ssrc for a primary ssrc it\'s seen before if the cache has been cleared', function() {
|
|
118
|
+ it('should NOT re-use the same rtx ssrc for a primary ssrc it\'s seen before if the cache has been cleared', function() {
|
119
|
119
|
// Call modifyRtxSsrcs to generate an rtx ssrc
|
120
|
120
|
// Clear the rtxModifier cache
|
121
|
121
|
// Call modifyRtxSsrcs to generate an rtx ssrc again with the same primary ssrc
|
|
@@ -135,7 +135,7 @@ describe ('RtxModifier', function() {
|
135
|
135
|
expect(newFidGroupRtxSsrc).not.toEqual(fidGroupRtxSsrc);
|
136
|
136
|
});
|
137
|
137
|
|
138
|
|
- it ('should use the rtx ssrc from the cache when the cache has been manually set', function() {
|
|
138
|
+ it('should use the rtx ssrc from the cache when the cache has been manually set', function() {
|
139
|
139
|
// Manually set an rtx ssrc mapping in the cache
|
140
|
140
|
// Call modifyRtxSsrcs
|
141
|
141
|
// -->The rtx ssrc used should be the one we set
|
|
@@ -152,13 +152,13 @@ describe ('RtxModifier', function() {
|
152
|
152
|
});
|
153
|
153
|
});
|
154
|
154
|
|
155
|
|
- describe ('when given an sdp with multiple video ssrcs', function() {
|
|
155
|
+ describe('when given an sdp with multiple video ssrcs', function() {
|
156
|
156
|
beforeEach(function() {
|
157
|
157
|
this.multipleVideoSdp = SampleSdpStrings.simulcastSdp;
|
158
|
158
|
this.primaryVideoSsrcs = getPrimaryVideoSsrcs(this.multipleVideoSdp);
|
159
|
159
|
});
|
160
|
160
|
|
161
|
|
- it ('should add rtx ssrcs for all of them', function() {
|
|
161
|
+ it('should add rtx ssrcs for all of them', function() {
|
162
|
162
|
// Call rtxModifier.modifyRtxSsrcs with an sdp that contains multiple video
|
163
|
163
|
// ssrcs. The returned sdp should have an rtx ssrc and an fid group for all of them.
|
164
|
164
|
const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
|
|
@@ -176,7 +176,7 @@ describe ('RtxModifier', function() {
|
176
|
176
|
});
|
177
|
177
|
});
|
178
|
178
|
|
179
|
|
- it ('should re-use the same rtx ssrcs for any primary ssrc it\'s seen before', function() {
|
|
179
|
+ it('should re-use the same rtx ssrcs for any primary ssrc it\'s seen before', function() {
|
180
|
180
|
// Have rtxModifier generate an rtx ssrc via modifyRtxSsrcs. Then call it again
|
181
|
181
|
// with the same primary ssrc in the sdp (but no rtx ssrc). It should use
|
182
|
182
|
// the same rtx ssrc as before.
|
|
@@ -205,7 +205,7 @@ describe ('RtxModifier', function() {
|
205
|
205
|
});
|
206
|
206
|
});
|
207
|
207
|
|
208
|
|
- it ('should NOT re-use the same rtx ssrcs for any primary ssrc it\'s seen before if the cache has been cleared', function() {
|
|
208
|
+ it('should NOT re-use the same rtx ssrcs for any primary ssrc it\'s seen before if the cache has been cleared', function() {
|
209
|
209
|
// Call modifyRtxSsrcs to generate an rtx ssrc
|
210
|
210
|
// Clear the rtxModifier cache
|
211
|
211
|
// Call modifyRtxSsrcs to generate rtx ssrcs again with the same primary ssrcs
|
|
@@ -237,7 +237,7 @@ describe ('RtxModifier', function() {
|
237
|
237
|
});
|
238
|
238
|
});
|
239
|
239
|
|
240
|
|
- it ('should use the rtx ssrcs from the cache when the cache has been manually set', function() {
|
|
240
|
+ it('should use the rtx ssrcs from the cache when the cache has been manually set', function() {
|
241
|
241
|
// Manually set an rtx ssrc mapping in the cache
|
242
|
242
|
// Call modifyRtxSsrcs
|
243
|
243
|
// -->The rtx ssrc used should be the one we set
|
|
@@ -261,8 +261,8 @@ describe ('RtxModifier', function() {
|
261
|
261
|
});
|
262
|
262
|
});
|
263
|
263
|
|
264
|
|
- describe ('(corner cases)', function() {
|
265
|
|
- it ('should handle a recvonly video mline', function() {
|
|
264
|
+ describe('(corner cases)', function() {
|
|
265
|
+ it('should handle a recvonly video mline', function() {
|
266
|
266
|
const sdp = SampleSdpStrings.plainVideoSdp;
|
267
|
267
|
const videoMLine = sdp.media.find(m => m.type === 'video');
|
268
|
268
|
videoMLine.direction = 'recvonly';
|
|
@@ -270,7 +270,7 @@ describe ('RtxModifier', function() {
|
270
|
270
|
expect(newSdpStr).toEqual(this.transform.write(sdp));
|
271
|
271
|
});
|
272
|
272
|
|
273
|
|
- it ('should handle an inactive video mline', function() {
|
|
273
|
+ it('should handle an inactive video mline', function() {
|
274
|
274
|
const sdp = SampleSdpStrings.plainVideoSdp;
|
275
|
275
|
const videoMLine = sdp.media.find(m => m.type === 'video');
|
276
|
276
|
videoMLine.direction = 'inactive';
|
|
@@ -278,7 +278,7 @@ describe ('RtxModifier', function() {
|
278
|
278
|
expect(newSdpStr).toEqual(this.transform.write(sdp));
|
279
|
279
|
});
|
280
|
280
|
|
281
|
|
- it ('should handle a video mline with no video ssrcs', function() {
|
|
281
|
+ it('should handle a video mline with no video ssrcs', function() {
|
282
|
282
|
const sdp = SampleSdpStrings.plainVideoSdp;
|
283
|
283
|
const videoMLine = sdp.media.find(m => m.type === 'video');
|
284
|
284
|
videoMLine.ssrcs = [];
|
|
@@ -291,7 +291,7 @@ describe ('RtxModifier', function() {
|
291
|
291
|
describe('stripRtx', function() {
|
292
|
292
|
beforeEach(function() {
|
293
|
293
|
});
|
294
|
|
- it ('should strip all rtx streams from an sdp with rtx', function() {
|
|
294
|
+ it('should strip all rtx streams from an sdp with rtx', function() {
|
295
|
295
|
const sdpStr = transform.write(SampleSdpStrings.rtxVideoSdp);
|
296
|
296
|
const newSdpStr = this.rtxModifier.stripRtx(sdpStr);
|
297
|
297
|
const newSdp = transform.parse(newSdpStr);
|
|
@@ -299,7 +299,7 @@ describe ('RtxModifier', function() {
|
299
|
299
|
expect(fidGroups.length).toEqual(0);
|
300
|
300
|
expect(numVideoSsrcs(newSdp)).toEqual(1);
|
301
|
301
|
});
|
302
|
|
- it ('should do nothing to an sdp with no rtx', function() {
|
|
302
|
+ it('should do nothing to an sdp with no rtx', function() {
|
303
|
303
|
const sdpStr = transform.write(SampleSdpStrings.plainVideoSdp);
|
304
|
304
|
const newSdpStr = this.rtxModifier.stripRtx(sdpStr);
|
305
|
305
|
expect(newSdpStr).toEqual(sdpStr);
|