@webex/plugin-meetings 3.12.0-next.9 → 3.12.0-task-refactor.1

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.
Files changed (201) hide show
  1. package/dist/annotation/index.js +5 -14
  2. package/dist/annotation/index.js.map +1 -1
  3. package/dist/breakouts/breakout.js +1 -1
  4. package/dist/breakouts/index.js +1 -1
  5. package/dist/config.js +2 -8
  6. package/dist/config.js.map +1 -1
  7. package/dist/constants.js +6 -29
  8. package/dist/constants.js.map +1 -1
  9. package/dist/hashTree/hashTreeParser.js +29 -1563
  10. package/dist/hashTree/hashTreeParser.js.map +1 -1
  11. package/dist/hashTree/types.js +3 -13
  12. package/dist/hashTree/types.js.map +1 -1
  13. package/dist/index.js +2 -11
  14. package/dist/index.js.map +1 -1
  15. package/dist/interceptors/index.js +0 -7
  16. package/dist/interceptors/index.js.map +1 -1
  17. package/dist/interceptors/locusRouteToken.js +5 -27
  18. package/dist/interceptors/locusRouteToken.js.map +1 -1
  19. package/dist/interpretation/index.js +2 -2
  20. package/dist/interpretation/index.js.map +1 -1
  21. package/dist/interpretation/siLanguage.js +1 -1
  22. package/dist/locus-info/controlsUtils.js +3 -7
  23. package/dist/locus-info/controlsUtils.js.map +1 -1
  24. package/dist/locus-info/index.js +247 -642
  25. package/dist/locus-info/index.js.map +1 -1
  26. package/dist/locus-info/selfUtils.js +0 -1
  27. package/dist/locus-info/selfUtils.js.map +1 -1
  28. package/dist/locus-info/types.js.map +1 -1
  29. package/dist/media/MediaConnectionAwaiter.js +1 -57
  30. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  31. package/dist/media/properties.js +2 -4
  32. package/dist/media/properties.js.map +1 -1
  33. package/dist/meeting/in-meeting-actions.js +1 -7
  34. package/dist/meeting/in-meeting-actions.js.map +1 -1
  35. package/dist/meeting/index.js +1036 -1481
  36. package/dist/meeting/index.js.map +1 -1
  37. package/dist/meeting/request.js +0 -50
  38. package/dist/meeting/request.js.map +1 -1
  39. package/dist/meeting/request.type.js.map +1 -1
  40. package/dist/meeting/util.js +3 -133
  41. package/dist/meeting/util.js.map +1 -1
  42. package/dist/meetings/index.js +59 -142
  43. package/dist/meetings/index.js.map +1 -1
  44. package/dist/meetings/util.js +7 -11
  45. package/dist/meetings/util.js.map +1 -1
  46. package/dist/member/index.js +0 -10
  47. package/dist/member/index.js.map +1 -1
  48. package/dist/member/util.js +0 -10
  49. package/dist/member/util.js.map +1 -1
  50. package/dist/metrics/constants.js +1 -7
  51. package/dist/metrics/constants.js.map +1 -1
  52. package/dist/multistream/mediaRequestManager.js +60 -9
  53. package/dist/multistream/mediaRequestManager.js.map +1 -1
  54. package/dist/multistream/remoteMediaManager.js +0 -11
  55. package/dist/multistream/remoteMediaManager.js.map +1 -1
  56. package/dist/multistream/sendSlotManager.js +2 -116
  57. package/dist/multistream/sendSlotManager.js.map +1 -1
  58. package/dist/reachability/clusterReachability.js +18 -171
  59. package/dist/reachability/clusterReachability.js.map +1 -1
  60. package/dist/reachability/index.js +11 -21
  61. package/dist/reachability/index.js.map +1 -1
  62. package/dist/reachability/reachabilityPeerConnection.js +1 -1
  63. package/dist/reachability/reachabilityPeerConnection.js.map +1 -1
  64. package/dist/reactions/reactions.type.js.map +1 -1
  65. package/dist/reconnection-manager/index.js +1 -0
  66. package/dist/reconnection-manager/index.js.map +1 -1
  67. package/dist/types/common/browser-detection.d.ts +0 -1
  68. package/dist/types/common/events/events-scope.d.ts +0 -1
  69. package/dist/types/common/events/events.d.ts +0 -1
  70. package/dist/types/config.d.ts +0 -5
  71. package/dist/types/constants.d.ts +1 -24
  72. package/dist/types/hashTree/hashTreeParser.d.ts +11 -260
  73. package/dist/types/hashTree/types.d.ts +0 -20
  74. package/dist/types/index.d.ts +0 -1
  75. package/dist/types/interceptors/index.d.ts +1 -2
  76. package/dist/types/interceptors/locusRouteToken.d.ts +0 -2
  77. package/dist/types/locus-info/index.d.ts +47 -68
  78. package/dist/types/locus-info/types.d.ts +12 -28
  79. package/dist/types/media/MediaConnectionAwaiter.d.ts +1 -10
  80. package/dist/types/media/properties.d.ts +1 -2
  81. package/dist/types/meeting/in-meeting-actions.d.ts +0 -6
  82. package/dist/types/meeting/index.d.ts +7 -86
  83. package/dist/types/meeting/request.d.ts +1 -16
  84. package/dist/types/meeting/request.type.d.ts +0 -5
  85. package/dist/types/meeting/util.d.ts +0 -31
  86. package/dist/types/meeting-info/util.d.ts +0 -1
  87. package/dist/types/meeting-info/utilv2.d.ts +0 -1
  88. package/dist/types/meetings/index.d.ts +2 -4
  89. package/dist/types/member/index.d.ts +0 -1
  90. package/dist/types/member/types.d.ts +4 -4
  91. package/dist/types/member/util.d.ts +0 -5
  92. package/dist/types/metrics/constants.d.ts +0 -6
  93. package/dist/types/multistream/mediaRequestManager.d.ts +23 -0
  94. package/dist/types/multistream/sendSlotManager.d.ts +1 -23
  95. package/dist/types/reachability/clusterReachability.d.ts +3 -30
  96. package/dist/types/reactions/reactions.type.d.ts +0 -1
  97. package/dist/types/recording-controller/util.d.ts +5 -5
  98. package/dist/types/roap/index.d.ts +1 -1
  99. package/dist/webinar/index.js +163 -438
  100. package/dist/webinar/index.js.map +1 -1
  101. package/package.json +24 -26
  102. package/src/annotation/index.ts +7 -27
  103. package/src/config.ts +0 -5
  104. package/src/constants.ts +1 -30
  105. package/src/hashTree/hashTreeParser.ts +25 -1523
  106. package/src/hashTree/types.ts +1 -24
  107. package/src/index.ts +1 -8
  108. package/src/interceptors/index.ts +1 -2
  109. package/src/interceptors/locusRouteToken.ts +5 -22
  110. package/src/interpretation/index.ts +2 -2
  111. package/src/locus-info/controlsUtils.ts +0 -17
  112. package/src/locus-info/index.ts +213 -707
  113. package/src/locus-info/selfUtils.ts +0 -1
  114. package/src/locus-info/types.ts +12 -27
  115. package/src/media/MediaConnectionAwaiter.ts +1 -41
  116. package/src/media/properties.ts +1 -3
  117. package/src/meeting/in-meeting-actions.ts +0 -12
  118. package/src/meeting/index.ts +84 -461
  119. package/src/meeting/request.ts +0 -42
  120. package/src/meeting/request.type.ts +0 -6
  121. package/src/meeting/util.ts +2 -160
  122. package/src/meetings/index.ts +60 -180
  123. package/src/meetings/util.ts +9 -10
  124. package/src/member/index.ts +0 -10
  125. package/src/member/util.ts +0 -12
  126. package/src/metrics/constants.ts +0 -7
  127. package/src/multistream/mediaRequestManager.ts +54 -4
  128. package/src/multistream/remoteMediaManager.ts +0 -13
  129. package/src/multistream/sendSlotManager.ts +3 -97
  130. package/src/reachability/clusterReachability.ts +27 -153
  131. package/src/reachability/index.ts +1 -15
  132. package/src/reachability/reachabilityPeerConnection.ts +1 -3
  133. package/src/reactions/reactions.type.ts +0 -1
  134. package/src/reconnection-manager/index.ts +1 -0
  135. package/src/webinar/index.ts +6 -265
  136. package/test/unit/spec/annotation/index.ts +7 -69
  137. package/test/unit/spec/interceptors/locusRouteToken.ts +0 -44
  138. package/test/unit/spec/locus-info/controlsUtils.js +1 -56
  139. package/test/unit/spec/locus-info/index.js +90 -1457
  140. package/test/unit/spec/media/MediaConnectionAwaiter.ts +1 -41
  141. package/test/unit/spec/media/properties.ts +3 -12
  142. package/test/unit/spec/meeting/in-meeting-actions.ts +2 -8
  143. package/test/unit/spec/meeting/index.js +128 -981
  144. package/test/unit/spec/meeting/request.js +0 -70
  145. package/test/unit/spec/meeting/utils.js +26 -438
  146. package/test/unit/spec/meetings/index.js +33 -845
  147. package/test/unit/spec/meetings/utils.js +1 -51
  148. package/test/unit/spec/member/index.js +4 -28
  149. package/test/unit/spec/member/util.js +27 -65
  150. package/test/unit/spec/multistream/mediaRequestManager.ts +85 -2
  151. package/test/unit/spec/multistream/remoteMediaManager.ts +0 -30
  152. package/test/unit/spec/multistream/sendSlotManager.ts +36 -135
  153. package/test/unit/spec/reachability/clusterReachability.ts +1 -125
  154. package/test/unit/spec/reachability/index.ts +3 -26
  155. package/test/unit/spec/reconnection-manager/index.js +8 -4
  156. package/test/unit/spec/webinar/index.ts +37 -534
  157. package/dist/aiEnableRequest/index.js +0 -184
  158. package/dist/aiEnableRequest/index.js.map +0 -1
  159. package/dist/aiEnableRequest/utils.js +0 -36
  160. package/dist/aiEnableRequest/utils.js.map +0 -1
  161. package/dist/hashTree/constants.js +0 -22
  162. package/dist/hashTree/constants.js.map +0 -1
  163. package/dist/hashTree/hashTree.js +0 -533
  164. package/dist/hashTree/hashTree.js.map +0 -1
  165. package/dist/hashTree/utils.js +0 -69
  166. package/dist/hashTree/utils.js.map +0 -1
  167. package/dist/interceptors/constant.js +0 -12
  168. package/dist/interceptors/constant.js.map +0 -1
  169. package/dist/interceptors/dataChannelAuthToken.js +0 -290
  170. package/dist/interceptors/dataChannelAuthToken.js.map +0 -1
  171. package/dist/interceptors/utils.js +0 -27
  172. package/dist/interceptors/utils.js.map +0 -1
  173. package/dist/types/aiEnableRequest/index.d.ts +0 -5
  174. package/dist/types/aiEnableRequest/utils.d.ts +0 -2
  175. package/dist/types/hashTree/constants.d.ts +0 -9
  176. package/dist/types/hashTree/hashTree.d.ts +0 -136
  177. package/dist/types/hashTree/utils.d.ts +0 -22
  178. package/dist/types/interceptors/constant.d.ts +0 -5
  179. package/dist/types/interceptors/dataChannelAuthToken.d.ts +0 -43
  180. package/dist/types/interceptors/utils.d.ts +0 -1
  181. package/dist/types/webinar/utils.d.ts +0 -6
  182. package/dist/webinar/utils.js +0 -25
  183. package/dist/webinar/utils.js.map +0 -1
  184. package/src/aiEnableRequest/README.md +0 -84
  185. package/src/aiEnableRequest/index.ts +0 -170
  186. package/src/aiEnableRequest/utils.ts +0 -25
  187. package/src/hashTree/constants.ts +0 -10
  188. package/src/hashTree/hashTree.ts +0 -480
  189. package/src/hashTree/utils.ts +0 -62
  190. package/src/interceptors/constant.ts +0 -6
  191. package/src/interceptors/dataChannelAuthToken.ts +0 -170
  192. package/src/interceptors/utils.ts +0 -16
  193. package/src/webinar/utils.ts +0 -16
  194. package/test/unit/spec/aiEnableRequest/index.ts +0 -981
  195. package/test/unit/spec/aiEnableRequest/utils.ts +0 -130
  196. package/test/unit/spec/hashTree/hashTree.ts +0 -721
  197. package/test/unit/spec/hashTree/hashTreeParser.ts +0 -3670
  198. package/test/unit/spec/hashTree/utils.ts +0 -140
  199. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +0 -210
  200. package/test/unit/spec/interceptors/utils.ts +0 -75
  201. package/test/unit/spec/webinar/utils.ts +0 -39
@@ -299,55 +299,5 @@ describe('plugin-meetings', () => {
299
299
  const sdp2 = 'v=0\r\no=HOMER 0 1 IN IP4 23.89.67.81\r\ns=-\r\nc=IN IP4 23.89.67.81\r\nb=TIAS:128000\r\nt=0 0\r\na=ice-lite\r\n'
300
300
  assert.equal(MeetingsUtil.getMediaServer(sdp2), 'homer');
301
301
  });
302
- });
303
-
304
- describe('#getCorrelationIdForDevice', () => {
305
- it('should return correlationId if device with matching url is found', () => {
306
- const locusSelf = {
307
- devices: [
308
- {url: 'deviceUrl1', correlationId: 'correlationId1'},
309
- {url: 'deviceUrl2', correlationId: 'correlationId2'},
310
- ],
311
- };
312
-
313
- const correlationId = MeetingsUtil.getCorrelationIdForDevice('deviceUrl1', locusSelf);
314
- assert.equal(correlationId, 'correlationId1');
315
- });
316
-
317
- it('should return false if no device with matching url is found', () => {
318
- const locusSelf = {
319
- devices: [
320
- {url: 'deviceUrl1', correlationId: 'correlationId1'},
321
- {url: 'deviceUrl2', correlationId: 'correlationId2'},
322
- ],
323
- };
324
-
325
- const correlationId = MeetingsUtil.getCorrelationIdForDevice('deviceUrl3', locusSelf);
326
- assert.equal(correlationId, false);
327
- });
328
-
329
- it('should return false if device with matching url has no correlationId', () => {
330
- const locusSelf = {
331
- devices: [{url: 'deviceUrl1'}, {url: 'deviceUrl2', correlationId: 'correlationId2'}],
332
- };
333
-
334
- const correlationId = MeetingsUtil.getCorrelationIdForDevice('deviceUrl1', locusSelf);
335
- assert.equal(correlationId, false);
336
- });
337
-
338
- it('should return false if locusSelf has no devices', () => {
339
- const locusSelf = {};
340
-
341
- const correlationId = MeetingsUtil.getCorrelationIdForDevice('deviceUrl1', locusSelf);
342
- assert.equal(correlationId, false);
343
- });
344
-
345
- it('should return false if locusSelf is null or undefined', () => {
346
- let correlationId = MeetingsUtil.getCorrelationIdForDevice('deviceUrl1', null);
347
- assert.equal(correlationId, false);
348
-
349
- correlationId = MeetingsUtil.getCorrelationIdForDevice('deviceUrl1', undefined);
350
- assert.equal(correlationId, false);
351
- });
352
- });
302
+ })
353
303
  });
@@ -18,7 +18,6 @@ describe('member', () => {
18
18
  assert.exists(member.supportsBreakouts);
19
19
  assert.exists(member.supportLiveAnnotation);
20
20
  assert.exists(member.canReclaimHost);
21
- assert.exists(member.canApproveAIEnablement);
22
21
  });
23
22
 
24
23
  describe('roles', () => {
@@ -48,24 +47,17 @@ describe('member', () => {
48
47
  it('checks that processParticipant calls canReclaimHost', () => {
49
48
  sinon.spy(MemberUtil, 'canReclaimHost');
50
49
  member.processParticipant(participant);
51
-
50
+
52
51
  assert.calledOnceWithExactly(MemberUtil.canReclaimHost, participant);
53
52
  });
54
53
 
55
54
  it('checks that processParticipant calls isPresenterAssignmentProhibited', () => {
56
55
  sinon.spy(MemberUtil, 'isPresenterAssignmentProhibited');
57
56
  member.processParticipant(participant);
58
-
57
+
59
58
  assert.calledOnceWithExactly(MemberUtil.isPresenterAssignmentProhibited, participant);
60
59
  });
61
-
62
- it('checks that processParticipant calls canApproveAIEnablement', () => {
63
- sinon.spy(MemberUtil, 'canApproveAIEnablement');
64
- member.processParticipant(participant);
65
-
66
- assert.calledOnceWithExactly(MemberUtil.canApproveAIEnablement, participant);
67
- });
68
- });
60
+ })
69
61
 
70
62
  describe('#processMember', () => {
71
63
  it('checks that processMember calls isRemovable', () => {
@@ -88,21 +80,5 @@ describe('member', () => {
88
80
 
89
81
  assert.calledOnceWithExactly(MemberUtil.extractMediaStatus, participant);
90
82
  });
91
- });
92
-
93
- describe('canApproveAIEnablement integration', () => {
94
- it('sets canApproveAIEnablement to the value returned by MemberUtil.canApproveAIEnablement', () => {
95
- const testParticipant = {controls: {}, status: {}};
96
-
97
- sinon.stub(MemberUtil, 'canApproveAIEnablement').returns(true);
98
- const memberWithTrue = new Member(testParticipant);
99
- assert.isTrue(memberWithTrue.canApproveAIEnablement);
100
-
101
- MemberUtil.canApproveAIEnablement.restore();
102
-
103
- sinon.stub(MemberUtil, 'canApproveAIEnablement').returns(false);
104
- const memberWithFalse = new Member(testParticipant);
105
- assert.isFalse(memberWithFalse.canApproveAIEnablement);
106
- });
107
- });
83
+ })
108
84
  });
@@ -82,46 +82,6 @@ describe('plugin-meetings', () => {
82
82
  });
83
83
  });
84
84
 
85
- describe('MemberUtil.canApproveAIEnablement', () => {
86
- it('returns false when there is no participant', () => {
87
- assert.isFalse(MemberUtil.canApproveAIEnablement());
88
- });
89
-
90
- it('returns false when there is null participant', () => {
91
- assert.isFalse(MemberUtil.canApproveAIEnablement(null));
92
- });
93
-
94
- it('returns true when attendeeRequestAiAssistantNotAllowed is false', () => {
95
- const participant = {
96
- attendeeRequestAiAssistantNotAllowed: false,
97
- };
98
-
99
- assert.isTrue(MemberUtil.canApproveAIEnablement(participant));
100
- });
101
-
102
- it('returns false when attendeeRequestAiAssistantNotAllowed is true', () => {
103
- const participant = {
104
- attendeeRequestAiAssistantNotAllowed: true,
105
- };
106
-
107
- assert.isFalse(MemberUtil.canApproveAIEnablement(participant));
108
- });
109
-
110
- it('returns true when attendeeRequestAiAssistantNotAllowed is undefined', () => {
111
- const participant = {
112
- attendeeRequestAiAssistantNotAllowed: undefined,
113
- };
114
-
115
- assert.isTrue(MemberUtil.canApproveAIEnablement(participant));
116
- });
117
-
118
- it('returns true when attendeeRequestAiAssistantNotAllowed is not present', () => {
119
- const participant = {};
120
-
121
- assert.isTrue(MemberUtil.canApproveAIEnablement(participant));
122
- });
123
- });
124
-
125
85
  describe('MemberUtil.extractControlRoles', () => {
126
86
  it('happy path extract control roles', () => {
127
87
  const participant = {
@@ -417,6 +377,7 @@ describe('plugin-meetings', () => {
417
377
  assert.isFalse(MemberUtil.isBrb(participant));
418
378
  });
419
379
 
380
+
420
381
  it('returns false when brb is not present', () => {
421
382
  const participant = {
422
383
  controls: {},
@@ -456,28 +417,29 @@ describe('plugin-meetings', () => {
456
417
  });
457
418
  });
458
419
 
459
- describe('MemberUtil.isSupportsSingleUserAutoEndMeeting', () => {
460
- it('throws an error when there is no participant', () => {
461
- assert.throws(() => {
462
- MemberUtil.isSupportsSingleUserAutoEndMeeting();
463
- }, 'Single user auto end meeting support could not be processed, participant is undefined.');
464
- });
420
+ describe('MemberUtil.isSupportsSingleUserAutoEndMeeting', () => {
421
+ it('throws an error when there is no participant', () => {
422
+ assert.throws(() => {
423
+ MemberUtil.isSupportsSingleUserAutoEndMeeting();
424
+ }, 'Single user auto end meeting support could not be processed, participant is undefined.');
425
+ });
465
426
 
466
- it('returns true when single user auto end meeting is supported', () => {
467
- const participant = {
468
- supportsSingleUserAutoEndMeeting: {},
469
- };
470
- assert.isTrue(MemberUtil.isSupportsSingleUserAutoEndMeeting(participant));
471
- });
427
+ it('returns true when single user auto end meeting is supported', () => {
428
+ const participant = {
429
+ supportsSingleUserAutoEndMeeting: {},
430
+ };
431
+ assert.isTrue(MemberUtil.isSupportsSingleUserAutoEndMeeting(participant));
432
+ });
472
433
 
473
- it('returns false when single user auto end meeting is not supported', () => {
474
- const participant = {
475
- doesNotSupportSingleUserAutoEndMeeting: {},
476
- };
434
+ it('returns false when single user auto end meeting is not supported', () => {
435
+ const participant = {
436
+ doesNotSupportSingleUserAutoEndMeeting: {},
437
+ };
477
438
 
478
- assert.isFalse(MemberUtil.isSupportsSingleUserAutoEndMeeting(participant));
479
- });
439
+ assert.isFalse(MemberUtil.isSupportsSingleUserAutoEndMeeting(participant));
480
440
  });
441
+ });
442
+
481
443
 
482
444
  describe('MemberUtil.isLiveAnnotationSupported', () => {
483
445
  it('throws an error when there is no participant', () => {
@@ -623,7 +585,7 @@ describe('plugin-meetings', () => {
623
585
  describe('MemberUtil.isPresenterAssignmentProhibited', () => {
624
586
  it('returns true when isPresenterAssignmentProhibited is true', () => {
625
587
  const participant = {
626
- presenterAssignmentNotAllowed: true,
588
+ presenterAssignmentNotAllowed: true
627
589
  };
628
590
 
629
591
  assert.isTrue(MemberUtil.isPresenterAssignmentProhibited(participant));
@@ -648,16 +610,16 @@ describe('plugin-meetings', () => {
648
610
  describe('extractMediaStatus', () => {
649
611
  it('throws an error when there is no participant', () => {
650
612
  assert.throws(() => {
651
- MemberUtil.extractMediaStatus();
613
+ MemberUtil.extractMediaStatus()
652
614
  }, 'Media status could not be extracted, participant is undefined.');
653
615
  });
654
616
 
655
617
  it('returns undefined media status when participant audio/video status is not present', () => {
656
618
  const participant = {
657
- status: {},
619
+ status: {}
658
620
  };
659
621
 
660
- const mediaStatus = MemberUtil.extractMediaStatus(participant);
622
+ const mediaStatus = MemberUtil.extractMediaStatus(participant)
661
623
 
662
624
  assert.deepEqual(mediaStatus, {audio: undefined, video: undefined});
663
625
  });
@@ -666,11 +628,11 @@ describe('extractMediaStatus', () => {
666
628
  const participant = {
667
629
  status: {
668
630
  audioStatus: 'RECVONLY',
669
- videoStatus: 'SENDRECV',
670
- },
631
+ videoStatus: 'SENDRECV'
632
+ }
671
633
  };
672
634
 
673
- const mediaStatus = MemberUtil.extractMediaStatus(participant);
635
+ const mediaStatus = MemberUtil.extractMediaStatus(participant)
674
636
 
675
637
  assert.deepEqual(mediaStatus, {audio: 'RECVONLY', video: 'SENDRECV'});
676
638
  });
@@ -666,8 +666,8 @@ describe('MediaRequestManager', () => {
666
666
  ]);
667
667
  });
668
668
 
669
- it('clears all the requests on reset()', () => {
670
- // send some requests and commit them
669
+ it('avoids sending duplicate requests and clears all the requests on reset()', () => {
670
+ // send some requests and commit them one by one
671
671
  addReceiverSelectedRequest(1500, fakeReceiveSlots[0], MAX_FS_1080p, false);
672
672
  addReceiverSelectedRequest(1501, fakeReceiveSlots[1], MAX_FS_1080p, false);
673
673
  addActiveSpeakerRequest(
@@ -722,12 +722,95 @@ describe('MediaRequestManager', () => {
722
722
  },
723
723
  ]);
724
724
 
725
+ // check that when calling commit()
726
+ // all requests are not re-sent again (avoid duplicate requests)
727
+ mediaRequestManager.commit();
728
+
729
+ assert.notCalled(sendMediaRequestsCallback);
730
+
731
+ // now reset everything
732
+ mediaRequestManager.reset();
733
+
734
+ // calling commit now should not cause any requests to be sent out
735
+ mediaRequestManager.commit();
736
+ checkMediaRequestsSent([]);
737
+ });
738
+
739
+ it('makes sure to call requests correctly after reset was called and another request was added', () => {
740
+ addReceiverSelectedRequest(1500, fakeReceiveSlots[0], MAX_FS_1080p, false);
741
+
742
+ assert.notCalled(sendMediaRequestsCallback);
743
+
744
+ mediaRequestManager.commit();
745
+ checkMediaRequestsSent([
746
+ {
747
+ policy: 'receiver-selected',
748
+ csi: 1500,
749
+ receiveSlot: fakeWcmeSlots[0],
750
+ maxPayloadBitsPerSecond: MAX_PAYLOADBITSPS_1080p,
751
+ maxFs: MAX_FS_1080p,
752
+ maxMbps: MAX_MBPS_1080p,
753
+ },
754
+ ]);
755
+
725
756
  // now reset everything
726
757
  mediaRequestManager.reset();
727
758
 
728
759
  // calling commit now should not cause any requests to be sent out
729
760
  mediaRequestManager.commit();
730
761
  checkMediaRequestsSent([]);
762
+
763
+ //add new request
764
+ addReceiverSelectedRequest(1501, fakeReceiveSlots[1], MAX_FS_1080p, false);
765
+
766
+ // commit
767
+ mediaRequestManager.commit();
768
+
769
+ // check the new request was sent
770
+ checkMediaRequestsSent([
771
+ {
772
+ policy: 'receiver-selected',
773
+ csi: 1501,
774
+ receiveSlot: fakeWcmeSlots[1],
775
+ maxPayloadBitsPerSecond: MAX_PAYLOADBITSPS_1080p,
776
+ maxFs: MAX_FS_1080p,
777
+ maxMbps: MAX_MBPS_1080p,
778
+ },
779
+ ]);
780
+ });
781
+
782
+ it('can send same media request after previous requests have been cleared', () => {
783
+ // add a request and commit
784
+ addReceiverSelectedRequest(1500, fakeReceiveSlots[0], MAX_FS_1080p, false);
785
+ mediaRequestManager.commit();
786
+ checkMediaRequestsSent([
787
+ {
788
+ policy: 'receiver-selected',
789
+ csi: 1500,
790
+ maxPayloadBitsPerSecond: MAX_PAYLOADBITSPS_1080p,
791
+ receiveSlot: fakeWcmeSlots[0],
792
+ maxFs: MAX_FS_1080p,
793
+ maxMbps: MAX_MBPS_1080p,
794
+ },
795
+ ]);
796
+
797
+ // clear previous requests
798
+ mediaRequestManager.clearPreviousRequests();
799
+
800
+ // commit same request
801
+ mediaRequestManager.commit();
802
+
803
+ // check the request was sent
804
+ checkMediaRequestsSent([
805
+ {
806
+ policy: 'receiver-selected',
807
+ csi: 1500,
808
+ maxPayloadBitsPerSecond: MAX_PAYLOADBITSPS_1080p,
809
+ receiveSlot: fakeWcmeSlots[0],
810
+ maxFs: MAX_FS_1080p,
811
+ maxMbps: MAX_MBPS_1080p,
812
+ },
813
+ ]);
731
814
  });
732
815
 
733
816
  it('re-sends media requests after degradation preferences are set', () => {
@@ -965,36 +965,6 @@ describe('RemoteMediaManager', () => {
965
965
  );
966
966
  });
967
967
 
968
- it('allocates 25 video slots for AllEqual25 layout', async () => {
969
- const config = cloneDeep(DefaultTestConfiguration);
970
- config.video.layouts['AllEqual25'] = {
971
- activeSpeakerVideoPaneGroups: [
972
- {id: 'main', numPanes: 25, size: 'best', priority: 255},
973
- ],
974
- };
975
- config.video.initialLayoutId = 'AllEqual25';
976
-
977
- let slotCount = 0;
978
- fakeReceiveSlotManager.allocateSlot.callsFake((mediaType: MediaType) => {
979
- if (mediaType === MediaType.VideoMain) {
980
- slotCount += 1;
981
- return Promise.resolve(new FakeSlot(mediaType, `fake video ${slotCount}`));
982
- }
983
- return Promise.resolve(fakeAudioSlot);
984
- });
985
-
986
- remoteMediaManager = new RemoteMediaManager(
987
- fakeReceiveSlotManager,
988
- fakeMediaRequestManagers,
989
- config
990
- );
991
-
992
- await remoteMediaManager.start();
993
-
994
- assert.strictEqual(remoteMediaManager.getLayoutId(), 'AllEqual25');
995
- assert.strictEqual(remoteMediaManager.slots.video.activeSpeaker.length, 25);
996
- });
997
-
998
968
  it('releases slots when switching to layout that requires less active speaker slots', async () => {
999
969
  // start with "AllEqual" layout that needs just 9 video slots
1000
970
  const config = cloneDeep(DefaultTestConfiguration);
@@ -1,28 +1,19 @@
1
1
  import 'jsdom-global/register';
2
2
  import SendSlotManager from '@webex/plugin-meetings/src/multistream/sendSlotManager';
3
- import { LocalStream, MediaType, MultistreamRoapMediaConnection, MediaCodecMimeType } from "@webex/internal-media-core";
4
- import {assert, expect} from '@webex/test-helper-chai';
3
+ import { LocalStream, MediaType, MultistreamRoapMediaConnection } from "@webex/internal-media-core";
4
+ import {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';
8
6
 
9
7
  describe('SendSlotsManager', () => {
10
8
  let sendSlotsManager: SendSlotManager;
11
9
  const LoggerProxy = {
12
10
  logger: {
13
11
  info: sinon.stub(),
14
- warn: sinon.stub(),
15
- error: sinon.stub(),
16
12
  },
17
13
  };
18
14
 
19
15
  beforeEach(() => {
20
16
  sendSlotsManager = new SendSlotManager(LoggerProxy);
21
- sinon.stub(Metrics, 'sendBehavioralMetric');
22
- });
23
-
24
- afterEach(() => {
25
- sinon.restore();
26
17
  });
27
18
 
28
19
  describe('createSlot', () => {
@@ -38,13 +29,13 @@ describe('SendSlotsManager', () => {
38
29
  it('should create a slot for the given mediaType', () => {
39
30
  sendSlotsManager.createSlot(mediaConnection, mediaType);
40
31
 
41
- assert.calledWith(mediaConnection.createSendSlot, mediaType, true);
32
+ expect(mediaConnection.createSendSlot.calledWith(mediaType, true));
42
33
  });
43
34
 
44
35
  it('should create a slot for the given mediaType & active state', () => {
45
36
  sendSlotsManager.createSlot(mediaConnection, mediaType, false);
46
37
 
47
- assert.calledWith(mediaConnection.createSendSlot, mediaType, false);
38
+ expect(mediaConnection.createSendSlot.calledWith(mediaType, false));
48
39
  });
49
40
 
50
41
  it('should throw an error if a slot for the given mediaType already exists', () => {
@@ -95,12 +86,14 @@ describe('SendSlotsManager', () => {
95
86
 
96
87
  await sendSlotsManager.publishStream(mediaType, stream);
97
88
 
98
- assert.calledWith(slot.publishStream, stream);
89
+ expect(slot.publishStream.calledWith(stream));
99
90
  });
100
91
 
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`);
92
+ it('should throw an error if a slot for the given mediaType does not exist', (done) => {
93
+ sendSlotsManager.publishStream(mediaType, stream).catch((error) => {
94
+ expect(error.message).to.equal(`Slot for ${mediaType} does not exist`);
95
+ done();
96
+ });
104
97
  });
105
98
  });
106
99
 
@@ -123,12 +116,14 @@ describe('SendSlotsManager', () => {
123
116
 
124
117
  await sendSlotsManager.unpublishStream(mediaType);
125
118
 
126
- assert.called(slot.unpublishStream);
119
+ expect(slot.unpublishStream.called);
127
120
  });
128
121
 
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`);
122
+ it('should throw an error if a slot for the given mediaType does not exist',(done) => {
123
+ sendSlotsManager.unpublishStream(mediaType).catch((error) => {
124
+ expect(error.message).to.equal(`Slot for ${mediaType} does not exist`);
125
+ done();
126
+ });
132
127
  });
133
128
  });
134
129
 
@@ -152,7 +147,7 @@ describe('SendSlotsManager', () => {
152
147
 
153
148
  await sendSlotsManager.setNamedMediaGroups(mediaType, groups);
154
149
 
155
- assert.calledWith(slot.setNamedMediaGroups, groups);
150
+ expect(slot.setNamedMediaGroups.calledWith(groups));
156
151
  });
157
152
 
158
153
  it('should throw an error if the given mediaType is not audio', () => {
@@ -174,16 +169,16 @@ describe('SendSlotsManager', () => {
174
169
  } as MultistreamRoapMediaConnection;
175
170
  });
176
171
 
177
- it('should set the active state of the sendSlot for the given mediaType', () => {
172
+ it('should set the active state of the sendSlot for the given mediaType', async () => {
178
173
  const slot = {
179
- active: false,
174
+ setActive: sinon.stub().resolves(),
180
175
  };
181
176
  mediaConnection.createSendSlot.returns(slot);
182
177
  sendSlotsManager.createSlot(mediaConnection, mediaType);
183
178
 
184
- sendSlotsManager.setActive(mediaType, true);
179
+ await sendSlotsManager.setActive(mediaType,true);
185
180
 
186
- expect(slot.active).to.be.true;
181
+ expect(slot.setActive.called);
187
182
  });
188
183
 
189
184
  it('should throw an error if a slot for the given mediaType does not exist', () => {
@@ -202,7 +197,7 @@ describe('SendSlotsManager', () => {
202
197
  } as MultistreamRoapMediaConnection;
203
198
  });
204
199
 
205
- it('should delegate to slot.setCodecParameters, log deprecation warning and send deprecation metric', async () => {
200
+ it('should set the codec parameters of the sendSlot for the given mediaType', async () => {
206
201
  const slot = {
207
202
  setCodecParameters: sinon.stub().resolves(),
208
203
  };
@@ -211,17 +206,14 @@ describe('SendSlotsManager', () => {
211
206
 
212
207
  await sendSlotsManager.setCodecParameters(mediaType, codecParameters);
213
208
 
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
- );
209
+ expect(slot.setCodecParameters.calledWith(codecParameters));
220
210
  });
221
211
 
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`);
212
+ it('should throw an error if a slot for the given mediaType does not exist', (done) => {
213
+ sendSlotsManager.setCodecParameters(mediaType, codecParameters).catch((error) => {
214
+ expect(error.message).to.equal(`Slot for ${mediaType} does not exist`);
215
+ done();
216
+ });
225
217
  });
226
218
  });
227
219
 
@@ -235,114 +227,23 @@ describe('SendSlotsManager', () => {
235
227
  } as MultistreamRoapMediaConnection;
236
228
  });
237
229
 
238
- it('should delegate to slot.deleteCodecParameters, log deprecation warning and send deprecation metric', async () => {
230
+ it('should delete the codec parameters of the sendSlot for the given mediaType', async () => {
239
231
  const slot = {
240
232
  deleteCodecParameters: sinon.stub().resolves(),
241
233
  };
242
234
  mediaConnection.createSendSlot.returns(slot);
243
235
  sendSlotsManager.createSlot(mediaConnection, mediaType);
244
236
 
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);
237
+ await sendSlotsManager.deleteCodecParameters(mediaType,[]);
334
238
 
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
- );
239
+ expect(slot.deleteCodecParameters.called);
341
240
  });
342
241
 
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`);
242
+ it('should throw an error if a slot for the given mediaType does not exist', (done) => {
243
+ sendSlotsManager.deleteCodecParameters(mediaType,[]).catch((error) => {
244
+ expect(error.message).to.equal(`Slot for ${mediaType} does not exist`);
245
+ done();
246
+ });
346
247
  });
347
248
  });
348
249