@webex/plugin-meetings 3.12.0-next.2 → 3.12.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aiEnableRequest/index.js +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/meeting/index.js +2 -2
- package/dist/meeting/index.js.map +1 -1
- package/dist/metrics/constants.js +5 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +116 -2
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/types/metrics/constants.d.ts +4 -0
- package/dist/types/multistream/sendSlotManager.d.ts +23 -1
- package/dist/webinar/index.js +1 -1
- package/package.json +13 -13
- package/src/meeting/index.ts +14 -8
- package/src/metrics/constants.ts +5 -0
- package/src/multistream/sendSlotManager.ts +97 -3
- package/test/unit/spec/meeting/index.js +11 -8
- package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
|
@@ -5,7 +5,11 @@ import {
|
|
|
5
5
|
MultistreamRoapMediaConnection,
|
|
6
6
|
NamedMediaGroup,
|
|
7
7
|
StreamState,
|
|
8
|
+
MediaCodecMimeType,
|
|
9
|
+
CodecParameters,
|
|
8
10
|
} from '@webex/internal-media-core';
|
|
11
|
+
import Metrics from '../metrics';
|
|
12
|
+
import BEHAVIORAL_METRICS from '../metrics/constants';
|
|
9
13
|
|
|
10
14
|
/**
|
|
11
15
|
* This class is used to manage the sendSlots for the given media types.
|
|
@@ -206,6 +210,8 @@ export default class SendSlotManager {
|
|
|
206
210
|
}
|
|
207
211
|
|
|
208
212
|
/**
|
|
213
|
+
* @deprecated Use {@link setCustomCodecParameters} instead, which requires specifying the codec MIME type.
|
|
214
|
+
*
|
|
209
215
|
* This method is used to set the codec parameters for the sendSlot of the given mediaType
|
|
210
216
|
* @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)
|
|
211
217
|
* @param {Object} codecParameters
|
|
@@ -226,12 +232,19 @@ export default class SendSlotManager {
|
|
|
226
232
|
|
|
227
233
|
await slot.setCodecParameters(codecParameters);
|
|
228
234
|
|
|
229
|
-
this.LoggerProxy.logger.
|
|
230
|
-
|
|
235
|
+
this.LoggerProxy.logger.warn(
|
|
236
|
+
'SendSlotsManager->setCodecParameters --> [DEPRECATION WARNING]: setCodecParameters has been deprecated, use setCustomCodecParameters instead'
|
|
231
237
|
);
|
|
238
|
+
|
|
239
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DEPRECATED_SET_CODEC_PARAMETERS_USED, {
|
|
240
|
+
mediaType,
|
|
241
|
+
codecParameters,
|
|
242
|
+
});
|
|
232
243
|
}
|
|
233
244
|
|
|
234
245
|
/**
|
|
246
|
+
* @deprecated Use {@link markCustomCodecParametersForDeletion} instead, which requires specifying the codec MIME type.
|
|
247
|
+
*
|
|
235
248
|
* This method is used to delete the codec parameters for the sendSlot of the given mediaType
|
|
236
249
|
* @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be deleted (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)
|
|
237
250
|
* @param {Array<String>} parameters Array of keys of the codec parameters to be deleted
|
|
@@ -246,8 +259,89 @@ export default class SendSlotManager {
|
|
|
246
259
|
|
|
247
260
|
await slot.deleteCodecParameters(parameters);
|
|
248
261
|
|
|
262
|
+
this.LoggerProxy.logger.warn(
|
|
263
|
+
'SendSlotsManager->deleteCodecParameters --> [DEPRECATION WARNING]: deleteCodecParameters has been deprecated, use markCustomCodecParametersForDeletion instead'
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DEPRECATED_DELETE_CODEC_PARAMETERS_USED, {
|
|
267
|
+
mediaType,
|
|
268
|
+
parameters,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Sets custom codec parameters for the sendSlot of the given mediaType, scoped to a specific codec MIME type.
|
|
274
|
+
* Delegates to WCME's setCustomCodecParameters API.
|
|
275
|
+
* @param {MediaType} mediaType MediaType of the sendSlot
|
|
276
|
+
* @param {MediaCodecMimeType} codecMimeType The codec MIME type to apply parameters to (e.g. OPUS, H264, AV1)
|
|
277
|
+
* @param {CodecParameters} parameters Key-value pairs of codec parameters to set
|
|
278
|
+
* @returns {Promise<void>}
|
|
279
|
+
*/
|
|
280
|
+
public async setCustomCodecParameters(
|
|
281
|
+
mediaType: MediaType,
|
|
282
|
+
codecMimeType: MediaCodecMimeType,
|
|
283
|
+
parameters: CodecParameters
|
|
284
|
+
): Promise<void> {
|
|
285
|
+
const slot = this.slots.get(mediaType);
|
|
286
|
+
|
|
287
|
+
if (!slot) {
|
|
288
|
+
throw new Error(`Slot for ${mediaType} does not exist`);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
try {
|
|
292
|
+
await slot.setCustomCodecParameters(codecMimeType, parameters);
|
|
293
|
+
|
|
294
|
+
this.LoggerProxy.logger.info(
|
|
295
|
+
`SendSlotsManager->setCustomCodecParameters#Set custom codec parameters for ${mediaType} (codec: ${codecMimeType}) to ${JSON.stringify(
|
|
296
|
+
parameters
|
|
297
|
+
)}`
|
|
298
|
+
);
|
|
299
|
+
} catch (error) {
|
|
300
|
+
this.LoggerProxy.logger.error(
|
|
301
|
+
`SendSlotsManager->setCustomCodecParameters#Failed to set custom codec parameters for ${mediaType} (codec: ${codecMimeType}): ${error}`
|
|
302
|
+
);
|
|
303
|
+
throw error;
|
|
304
|
+
} finally {
|
|
305
|
+
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.SET_CUSTOM_CODEC_PARAMETERS_USED, {
|
|
306
|
+
mediaType,
|
|
307
|
+
codecMimeType,
|
|
308
|
+
parameters,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Marks custom codec parameters for deletion on the sendSlot of the given mediaType, scoped to a specific codec MIME type.
|
|
315
|
+
* Delegates to WCME's markCustomCodecParametersForDeletion API.
|
|
316
|
+
* @param {MediaType} mediaType MediaType of the sendSlot
|
|
317
|
+
* @param {MediaCodecMimeType} codecMimeType The codec MIME type whose parameters should be deleted (e.g. OPUS, H264, AV1)
|
|
318
|
+
* @param {string[]} parameters Array of parameter keys to delete
|
|
319
|
+
* @returns {Promise<void>}
|
|
320
|
+
*/
|
|
321
|
+
public async markCustomCodecParametersForDeletion(
|
|
322
|
+
mediaType: MediaType,
|
|
323
|
+
codecMimeType: MediaCodecMimeType,
|
|
324
|
+
parameters: string[]
|
|
325
|
+
): Promise<void> {
|
|
326
|
+
const slot = this.slots.get(mediaType);
|
|
327
|
+
|
|
328
|
+
if (!slot) {
|
|
329
|
+
throw new Error(`Slot for ${mediaType} does not exist`);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
await slot.markCustomCodecParametersForDeletion(codecMimeType, parameters);
|
|
333
|
+
|
|
249
334
|
this.LoggerProxy.logger.info(
|
|
250
|
-
`SendSlotsManager->
|
|
335
|
+
`SendSlotsManager->markCustomCodecParametersForDeletion#Marked codec parameters for deletion -> ${parameters} for ${mediaType} (codec: ${codecMimeType})`
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
Metrics.sendBehavioralMetric(
|
|
339
|
+
BEHAVIORAL_METRICS.MARK_CUSTOM_CODEC_PARAMETERS_FOR_DELETION_USED,
|
|
340
|
+
{
|
|
341
|
+
mediaType,
|
|
342
|
+
codecMimeType,
|
|
343
|
+
parameters,
|
|
344
|
+
}
|
|
251
345
|
);
|
|
252
346
|
}
|
|
253
347
|
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
import {
|
|
39
39
|
ConnectionState,
|
|
40
40
|
MediaConnectionEventNames,
|
|
41
|
+
MediaCodecMimeType,
|
|
41
42
|
StatsAnalyzerEventNames,
|
|
42
43
|
StatsMonitorEventNames,
|
|
43
44
|
Errors,
|
|
@@ -9214,8 +9215,8 @@ describe('plugin-meetings', () => {
|
|
|
9214
9215
|
const fakeMultistreamRoapMediaConnection = {
|
|
9215
9216
|
createSendSlot: () => {
|
|
9216
9217
|
return {
|
|
9217
|
-
|
|
9218
|
-
|
|
9218
|
+
setCustomCodecParameters: sinon.stub().resolves(),
|
|
9219
|
+
markCustomCodecParametersForDeletion: sinon.stub().resolves(),
|
|
9219
9220
|
};
|
|
9220
9221
|
},
|
|
9221
9222
|
};
|
|
@@ -9238,27 +9239,29 @@ describe('plugin-meetings', () => {
|
|
|
9238
9239
|
}
|
|
9239
9240
|
);
|
|
9240
9241
|
|
|
9241
|
-
it('should set
|
|
9242
|
+
it('should set custom codec parameters when shouldEnableMusicMode is true', async () => {
|
|
9242
9243
|
await meeting.enableMusicMode(true);
|
|
9243
9244
|
assert.calledOnceWithExactly(
|
|
9244
|
-
meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
9245
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).setCustomCodecParameters,
|
|
9246
|
+
MediaCodecMimeType.OPUS,
|
|
9245
9247
|
{
|
|
9246
9248
|
maxaveragebitrate: '64000',
|
|
9247
9249
|
maxplaybackrate: '48000',
|
|
9248
9250
|
}
|
|
9249
9251
|
);
|
|
9250
9252
|
assert.notCalled(
|
|
9251
|
-
meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
9253
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).markCustomCodecParametersForDeletion
|
|
9252
9254
|
);
|
|
9253
9255
|
});
|
|
9254
9256
|
|
|
9255
|
-
it('should
|
|
9257
|
+
it('should mark custom codec parameters for deletion when shouldEnableMusicMode is false', async () => {
|
|
9256
9258
|
await meeting.enableMusicMode(false);
|
|
9257
9259
|
assert.calledOnceWithExactly(
|
|
9258
|
-
meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
9260
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).markCustomCodecParametersForDeletion,
|
|
9261
|
+
MediaCodecMimeType.OPUS,
|
|
9259
9262
|
['maxaveragebitrate', 'maxplaybackrate']
|
|
9260
9263
|
);
|
|
9261
|
-
assert.notCalled(meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
9264
|
+
assert.notCalled(meeting.sendSlotManager.getSlot(MediaType.AudioMain).setCustomCodecParameters);
|
|
9262
9265
|
});
|
|
9263
9266
|
});
|
|
9264
9267
|
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import 'jsdom-global/register';
|
|
2
2
|
import SendSlotManager from '@webex/plugin-meetings/src/multistream/sendSlotManager';
|
|
3
|
-
import { LocalStream, MediaType, MultistreamRoapMediaConnection } from "@webex/internal-media-core";
|
|
4
|
-
import {expect} from '@webex/test-helper-chai';
|
|
3
|
+
import { LocalStream, MediaType, MultistreamRoapMediaConnection, MediaCodecMimeType } from "@webex/internal-media-core";
|
|
4
|
+
import {assert, expect} from '@webex/test-helper-chai';
|
|
5
5
|
import sinon from 'sinon';
|
|
6
|
+
import Metrics from '@webex/plugin-meetings/src/metrics';
|
|
7
|
+
import BEHAVIORAL_METRICS from '@webex/plugin-meetings/src/metrics/constants';
|
|
6
8
|
|
|
7
9
|
describe('SendSlotsManager', () => {
|
|
8
10
|
let sendSlotsManager: SendSlotManager;
|
|
9
11
|
const LoggerProxy = {
|
|
10
12
|
logger: {
|
|
11
13
|
info: sinon.stub(),
|
|
14
|
+
warn: sinon.stub(),
|
|
15
|
+
error: sinon.stub(),
|
|
12
16
|
},
|
|
13
17
|
};
|
|
14
18
|
|
|
15
19
|
beforeEach(() => {
|
|
16
20
|
sendSlotsManager = new SendSlotManager(LoggerProxy);
|
|
21
|
+
sinon.stub(Metrics, 'sendBehavioralMetric');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
sinon.restore();
|
|
17
26
|
});
|
|
18
27
|
|
|
19
28
|
describe('createSlot', () => {
|
|
@@ -29,13 +38,13 @@ describe('SendSlotsManager', () => {
|
|
|
29
38
|
it('should create a slot for the given mediaType', () => {
|
|
30
39
|
sendSlotsManager.createSlot(mediaConnection, mediaType);
|
|
31
40
|
|
|
32
|
-
|
|
41
|
+
assert.calledWith(mediaConnection.createSendSlot, mediaType, true);
|
|
33
42
|
});
|
|
34
43
|
|
|
35
44
|
it('should create a slot for the given mediaType & active state', () => {
|
|
36
45
|
sendSlotsManager.createSlot(mediaConnection, mediaType, false);
|
|
37
46
|
|
|
38
|
-
|
|
47
|
+
assert.calledWith(mediaConnection.createSendSlot, mediaType, false);
|
|
39
48
|
});
|
|
40
49
|
|
|
41
50
|
it('should throw an error if a slot for the given mediaType already exists', () => {
|
|
@@ -86,14 +95,12 @@ describe('SendSlotsManager', () => {
|
|
|
86
95
|
|
|
87
96
|
await sendSlotsManager.publishStream(mediaType, stream);
|
|
88
97
|
|
|
89
|
-
|
|
98
|
+
assert.calledWith(slot.publishStream, stream);
|
|
90
99
|
});
|
|
91
100
|
|
|
92
|
-
it('should throw an error if a slot for the given mediaType does not exist', (
|
|
93
|
-
sendSlotsManager.publishStream(mediaType, stream)
|
|
94
|
-
|
|
95
|
-
done();
|
|
96
|
-
});
|
|
101
|
+
it('should throw an error if a slot for the given mediaType does not exist', async () => {
|
|
102
|
+
await expect(sendSlotsManager.publishStream(mediaType, stream))
|
|
103
|
+
.to.be.rejectedWith(`Slot for ${mediaType} does not exist`);
|
|
97
104
|
});
|
|
98
105
|
});
|
|
99
106
|
|
|
@@ -116,14 +123,12 @@ describe('SendSlotsManager', () => {
|
|
|
116
123
|
|
|
117
124
|
await sendSlotsManager.unpublishStream(mediaType);
|
|
118
125
|
|
|
119
|
-
|
|
126
|
+
assert.called(slot.unpublishStream);
|
|
120
127
|
});
|
|
121
128
|
|
|
122
|
-
it('should throw an error if a slot for the given mediaType does not exist',(
|
|
123
|
-
sendSlotsManager.unpublishStream(mediaType)
|
|
124
|
-
|
|
125
|
-
done();
|
|
126
|
-
});
|
|
129
|
+
it('should throw an error if a slot for the given mediaType does not exist', async () => {
|
|
130
|
+
await expect(sendSlotsManager.unpublishStream(mediaType))
|
|
131
|
+
.to.be.rejectedWith(`Slot for ${mediaType} does not exist`);
|
|
127
132
|
});
|
|
128
133
|
});
|
|
129
134
|
|
|
@@ -147,7 +152,7 @@ describe('SendSlotsManager', () => {
|
|
|
147
152
|
|
|
148
153
|
await sendSlotsManager.setNamedMediaGroups(mediaType, groups);
|
|
149
154
|
|
|
150
|
-
|
|
155
|
+
assert.calledWith(slot.setNamedMediaGroups, groups);
|
|
151
156
|
});
|
|
152
157
|
|
|
153
158
|
it('should throw an error if the given mediaType is not audio', () => {
|
|
@@ -169,16 +174,16 @@ describe('SendSlotsManager', () => {
|
|
|
169
174
|
} as MultistreamRoapMediaConnection;
|
|
170
175
|
});
|
|
171
176
|
|
|
172
|
-
it('should set the active state of the sendSlot for the given mediaType',
|
|
177
|
+
it('should set the active state of the sendSlot for the given mediaType', () => {
|
|
173
178
|
const slot = {
|
|
174
|
-
|
|
179
|
+
active: false,
|
|
175
180
|
};
|
|
176
181
|
mediaConnection.createSendSlot.returns(slot);
|
|
177
182
|
sendSlotsManager.createSlot(mediaConnection, mediaType);
|
|
178
183
|
|
|
179
|
-
|
|
184
|
+
sendSlotsManager.setActive(mediaType, true);
|
|
180
185
|
|
|
181
|
-
expect(slot.
|
|
186
|
+
expect(slot.active).to.be.true;
|
|
182
187
|
});
|
|
183
188
|
|
|
184
189
|
it('should throw an error if a slot for the given mediaType does not exist', () => {
|
|
@@ -197,7 +202,7 @@ describe('SendSlotsManager', () => {
|
|
|
197
202
|
} as MultistreamRoapMediaConnection;
|
|
198
203
|
});
|
|
199
204
|
|
|
200
|
-
it('should
|
|
205
|
+
it('should delegate to slot.setCodecParameters, log deprecation warning and send deprecation metric', async () => {
|
|
201
206
|
const slot = {
|
|
202
207
|
setCodecParameters: sinon.stub().resolves(),
|
|
203
208
|
};
|
|
@@ -206,14 +211,17 @@ describe('SendSlotsManager', () => {
|
|
|
206
211
|
|
|
207
212
|
await sendSlotsManager.setCodecParameters(mediaType, codecParameters);
|
|
208
213
|
|
|
209
|
-
|
|
214
|
+
assert.calledWith(slot.setCodecParameters, codecParameters);
|
|
215
|
+
assert.called(LoggerProxy.logger.warn);
|
|
216
|
+
assert.calledWith(Metrics.sendBehavioralMetric as sinon.SinonStub,
|
|
217
|
+
BEHAVIORAL_METRICS.DEPRECATED_SET_CODEC_PARAMETERS_USED,
|
|
218
|
+
{ mediaType, codecParameters }
|
|
219
|
+
);
|
|
210
220
|
});
|
|
211
221
|
|
|
212
|
-
it('should throw an error if a slot for the given mediaType does not exist', (
|
|
213
|
-
sendSlotsManager.setCodecParameters(mediaType, codecParameters)
|
|
214
|
-
|
|
215
|
-
done();
|
|
216
|
-
});
|
|
222
|
+
it('should throw an error if a slot for the given mediaType does not exist', async () => {
|
|
223
|
+
await expect(sendSlotsManager.setCodecParameters(mediaType, codecParameters))
|
|
224
|
+
.to.be.rejectedWith(`Slot for ${mediaType} does not exist`);
|
|
217
225
|
});
|
|
218
226
|
});
|
|
219
227
|
|
|
@@ -227,23 +235,114 @@ describe('SendSlotsManager', () => {
|
|
|
227
235
|
} as MultistreamRoapMediaConnection;
|
|
228
236
|
});
|
|
229
237
|
|
|
230
|
-
it('should
|
|
238
|
+
it('should delegate to slot.deleteCodecParameters, log deprecation warning and send deprecation metric', async () => {
|
|
231
239
|
const slot = {
|
|
232
240
|
deleteCodecParameters: sinon.stub().resolves(),
|
|
233
241
|
};
|
|
234
242
|
mediaConnection.createSendSlot.returns(slot);
|
|
235
243
|
sendSlotsManager.createSlot(mediaConnection, mediaType);
|
|
236
244
|
|
|
237
|
-
await sendSlotsManager.deleteCodecParameters(mediaType,[]);
|
|
245
|
+
await sendSlotsManager.deleteCodecParameters(mediaType, []);
|
|
246
|
+
|
|
247
|
+
assert.calledWith(slot.deleteCodecParameters, []);
|
|
248
|
+
assert.called(LoggerProxy.logger.warn);
|
|
249
|
+
assert.calledWith(Metrics.sendBehavioralMetric as sinon.SinonStub,
|
|
250
|
+
BEHAVIORAL_METRICS.DEPRECATED_DELETE_CODEC_PARAMETERS_USED,
|
|
251
|
+
{ mediaType, parameters: [] }
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('should throw an error if a slot for the given mediaType does not exist', async () => {
|
|
256
|
+
await expect(sendSlotsManager.deleteCodecParameters(mediaType, []))
|
|
257
|
+
.to.be.rejectedWith(`Slot for ${mediaType} does not exist`);
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
describe('setCustomCodecParameters', () => {
|
|
262
|
+
let mediaConnection;
|
|
263
|
+
const mediaType = MediaType.AudioMain;
|
|
264
|
+
const codecMimeType = MediaCodecMimeType.OPUS;
|
|
265
|
+
const parameters = { maxaveragebitrate: '64000' };
|
|
266
|
+
|
|
267
|
+
beforeEach(() => {
|
|
268
|
+
mediaConnection = {
|
|
269
|
+
createSendSlot: sinon.stub(),
|
|
270
|
+
} as MultistreamRoapMediaConnection;
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it('should set custom codec parameters on the sendSlot for the given mediaType and codec, log info and send metric', async () => {
|
|
274
|
+
const slot = {
|
|
275
|
+
setCustomCodecParameters: sinon.stub().resolves(),
|
|
276
|
+
};
|
|
277
|
+
mediaConnection.createSendSlot.returns(slot);
|
|
278
|
+
sendSlotsManager.createSlot(mediaConnection, mediaType);
|
|
279
|
+
|
|
280
|
+
await sendSlotsManager.setCustomCodecParameters(mediaType, codecMimeType, parameters);
|
|
281
|
+
|
|
282
|
+
assert.calledWith(slot.setCustomCodecParameters, codecMimeType, parameters);
|
|
283
|
+
assert.called(LoggerProxy.logger.info);
|
|
284
|
+
assert.calledWith(Metrics.sendBehavioralMetric as sinon.SinonStub,
|
|
285
|
+
BEHAVIORAL_METRICS.SET_CUSTOM_CODEC_PARAMETERS_USED,
|
|
286
|
+
{ mediaType, codecMimeType, parameters }
|
|
287
|
+
);
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
it('should throw an error if a slot for the given mediaType does not exist', async () => {
|
|
291
|
+
await expect(sendSlotsManager.setCustomCodecParameters(mediaType, codecMimeType, parameters))
|
|
292
|
+
.to.be.rejectedWith(`Slot for ${mediaType} does not exist`);
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
it('should throw and log error when setCustomCodecParameters fails', async () => {
|
|
296
|
+
const error = new Error('codec parameter failure');
|
|
297
|
+
const slot = {
|
|
298
|
+
setCustomCodecParameters: sinon.stub().rejects(error),
|
|
299
|
+
};
|
|
300
|
+
mediaConnection.createSendSlot.returns(slot);
|
|
301
|
+
sendSlotsManager.createSlot(mediaConnection, mediaType);
|
|
302
|
+
|
|
303
|
+
await expect(sendSlotsManager.setCustomCodecParameters(mediaType, codecMimeType, parameters))
|
|
304
|
+
.to.be.rejectedWith('codec parameter failure');
|
|
305
|
+
|
|
306
|
+
assert.called(LoggerProxy.logger.error);
|
|
307
|
+
assert.calledWith(Metrics.sendBehavioralMetric as sinon.SinonStub,
|
|
308
|
+
BEHAVIORAL_METRICS.SET_CUSTOM_CODEC_PARAMETERS_USED,
|
|
309
|
+
{ mediaType, codecMimeType, parameters }
|
|
310
|
+
);
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
describe('markCustomCodecParametersForDeletion', () => {
|
|
315
|
+
let mediaConnection;
|
|
316
|
+
const mediaType = MediaType.AudioMain;
|
|
317
|
+
const codecMimeType = MediaCodecMimeType.OPUS;
|
|
318
|
+
const parameters = ['maxaveragebitrate', 'maxplaybackrate'];
|
|
319
|
+
|
|
320
|
+
beforeEach(() => {
|
|
321
|
+
mediaConnection = {
|
|
322
|
+
createSendSlot: sinon.stub(),
|
|
323
|
+
} as MultistreamRoapMediaConnection;
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
it('should mark custom codec parameters for deletion on the sendSlot for the given mediaType and codec, log info and send metric', async () => {
|
|
327
|
+
const slot = {
|
|
328
|
+
markCustomCodecParametersForDeletion: sinon.stub().resolves(),
|
|
329
|
+
};
|
|
330
|
+
mediaConnection.createSendSlot.returns(slot);
|
|
331
|
+
sendSlotsManager.createSlot(mediaConnection, mediaType);
|
|
332
|
+
|
|
333
|
+
await sendSlotsManager.markCustomCodecParametersForDeletion(mediaType, codecMimeType, parameters);
|
|
238
334
|
|
|
239
|
-
|
|
335
|
+
assert.calledWith(slot.markCustomCodecParametersForDeletion, codecMimeType, parameters);
|
|
336
|
+
assert.called(LoggerProxy.logger.info);
|
|
337
|
+
assert.calledWith(Metrics.sendBehavioralMetric as sinon.SinonStub,
|
|
338
|
+
BEHAVIORAL_METRICS.MARK_CUSTOM_CODEC_PARAMETERS_FOR_DELETION_USED,
|
|
339
|
+
{ mediaType, codecMimeType, parameters }
|
|
340
|
+
);
|
|
240
341
|
});
|
|
241
342
|
|
|
242
|
-
it('should throw an error if a slot for the given mediaType does not exist', (
|
|
243
|
-
sendSlotsManager.
|
|
244
|
-
|
|
245
|
-
done();
|
|
246
|
-
});
|
|
343
|
+
it('should throw an error if a slot for the given mediaType does not exist', async () => {
|
|
344
|
+
await expect(sendSlotsManager.markCustomCodecParametersForDeletion(mediaType, codecMimeType, parameters))
|
|
345
|
+
.to.be.rejectedWith(`Slot for ${mediaType} does not exist`);
|
|
247
346
|
});
|
|
248
347
|
});
|
|
249
348
|
|