@webex/plugin-meetings 3.0.0-beta.39 → 3.0.0-beta.391
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/README.md +58 -8
- package/dist/annotation/annotation.types.js +7 -0
- package/dist/annotation/annotation.types.js.map +1 -0
- package/dist/annotation/constants.js +49 -0
- package/dist/annotation/constants.js.map +1 -0
- package/dist/annotation/index.js +342 -0
- package/dist/annotation/index.js.map +1 -0
- package/dist/breakouts/breakout.js +94 -15
- package/dist/breakouts/breakout.js.map +1 -1
- package/dist/breakouts/events.js +45 -0
- package/dist/breakouts/events.js.map +1 -0
- package/dist/breakouts/index.js +671 -81
- package/dist/breakouts/index.js.map +1 -1
- package/dist/breakouts/utils.js +45 -1
- package/dist/breakouts/utils.js.map +1 -1
- package/dist/common/errors/no-meeting-info.js +51 -0
- package/dist/common/errors/no-meeting-info.js.map +1 -0
- package/dist/common/errors/reclaim-host-role-errors.js +158 -0
- package/dist/common/errors/reclaim-host-role-errors.js.map +1 -0
- package/dist/common/errors/webex-errors.js +48 -7
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/common/logs/logger-proxy.js +1 -1
- package/dist/common/logs/logger-proxy.js.map +1 -1
- package/dist/common/logs/request.js +5 -1
- package/dist/common/logs/request.js.map +1 -1
- package/dist/common/queue.js +24 -9
- package/dist/common/queue.js.map +1 -1
- package/dist/config.js +5 -10
- package/dist/config.js.map +1 -1
- package/dist/constants.js +242 -33
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/enums.js +14 -2
- package/dist/controls-options-manager/enums.js.map +1 -1
- package/dist/controls-options-manager/index.js +109 -15
- package/dist/controls-options-manager/index.js.map +1 -1
- package/dist/controls-options-manager/types.js +7 -0
- package/dist/controls-options-manager/types.js.map +1 -0
- package/dist/controls-options-manager/util.js +309 -18
- package/dist/controls-options-manager/util.js.map +1 -1
- package/dist/index.js +110 -2
- package/dist/index.js.map +1 -1
- package/dist/interceptors/index.js +15 -0
- package/dist/interceptors/index.js.map +1 -0
- package/dist/interceptors/locusRetry.js +93 -0
- package/dist/interceptors/locusRetry.js.map +1 -0
- package/dist/interpretation/collection.js +23 -0
- package/dist/interpretation/collection.js.map +1 -0
- package/dist/interpretation/index.js +380 -0
- package/dist/interpretation/index.js.map +1 -0
- package/dist/interpretation/siLanguage.js +25 -0
- package/dist/interpretation/siLanguage.js.map +1 -0
- package/dist/locus-info/controlsUtils.js +91 -2
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +386 -62
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/infoUtils.js +7 -1
- package/dist/locus-info/infoUtils.js.map +1 -1
- package/dist/locus-info/mediaSharesUtils.js +71 -1
- package/dist/locus-info/mediaSharesUtils.js.map +1 -1
- package/dist/locus-info/parser.js +249 -72
- package/dist/locus-info/parser.js.map +1 -1
- package/dist/locus-info/selfUtils.js +89 -14
- package/dist/locus-info/selfUtils.js.map +1 -1
- package/dist/media/index.js +65 -102
- package/dist/media/index.js.map +1 -1
- package/dist/media/properties.js +73 -124
- package/dist/media/properties.js.map +1 -1
- package/dist/mediaQualityMetrics/config.js +135 -330
- package/dist/mediaQualityMetrics/config.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +86 -2
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +4075 -2827
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/locusMediaRequest.js +292 -0
- package/dist/meeting/locusMediaRequest.js.map +1 -0
- package/dist/meeting/muteState.js +224 -136
- package/dist/meeting/muteState.js.map +1 -1
- package/dist/meeting/request.js +177 -152
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/util.js +672 -417
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting-info/index.js +73 -7
- package/dist/meeting-info/index.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +192 -51
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meeting-info/util.js +1 -1
- package/dist/meeting-info/util.js.map +1 -1
- package/dist/meeting-info/utilv2.js +36 -36
- package/dist/meeting-info/utilv2.js.map +1 -1
- package/dist/meetings/collection.js +39 -0
- package/dist/meetings/collection.js.map +1 -1
- package/dist/meetings/index.js +484 -119
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/meetings.types.js +7 -0
- package/dist/meetings/meetings.types.js.map +1 -0
- package/dist/meetings/request.js +2 -0
- package/dist/meetings/request.js.map +1 -1
- package/dist/meetings/util.js +73 -7
- package/dist/meetings/util.js.map +1 -1
- package/dist/member/index.js +58 -0
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js +25 -0
- package/dist/member/types.js.map +1 -0
- package/dist/member/util.js +132 -25
- package/dist/member/util.js.map +1 -1
- package/dist/members/collection.js +10 -0
- package/dist/members/collection.js.map +1 -1
- package/dist/members/index.js +102 -6
- package/dist/members/index.js.map +1 -1
- package/dist/members/request.js +106 -38
- package/dist/members/request.js.map +1 -1
- package/dist/members/types.js +15 -0
- package/dist/members/types.js.map +1 -0
- package/dist/members/util.js +326 -232
- package/dist/members/util.js.map +1 -1
- package/dist/metrics/constants.js +18 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/metrics/index.js +1 -446
- package/dist/metrics/index.js.map +1 -1
- package/dist/multistream/mediaRequestManager.js +223 -32
- package/dist/multistream/mediaRequestManager.js.map +1 -1
- package/dist/multistream/receiveSlot.js +10 -0
- package/dist/multistream/receiveSlot.js.map +1 -1
- package/dist/multistream/receiveSlotManager.js +39 -36
- package/dist/multistream/receiveSlotManager.js.map +1 -1
- package/dist/multistream/remoteMedia.js +3 -1
- package/dist/multistream/remoteMedia.js.map +1 -1
- package/dist/multistream/remoteMediaGroup.js +76 -5
- package/dist/multistream/remoteMediaGroup.js.map +1 -1
- package/dist/multistream/remoteMediaManager.js +366 -104
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +255 -0
- package/dist/multistream/sendSlotManager.js.map +1 -0
- package/dist/reachability/clusterReachability.js +356 -0
- package/dist/reachability/clusterReachability.js.map +1 -0
- package/dist/reachability/index.js +263 -390
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/request.js +6 -4
- package/dist/reachability/request.js.map +1 -1
- package/dist/reachability/util.js +29 -0
- package/dist/reachability/util.js.map +1 -0
- package/dist/reconnection-manager/index.js +266 -202
- package/dist/reconnection-manager/index.js.map +1 -1
- package/dist/recording-controller/index.js +21 -2
- package/dist/recording-controller/index.js.map +1 -1
- package/dist/recording-controller/util.js +9 -8
- package/dist/recording-controller/util.js.map +1 -1
- package/dist/roap/index.js +51 -28
- package/dist/roap/index.js.map +1 -1
- package/dist/roap/request.js +48 -64
- package/dist/roap/request.js.map +1 -1
- package/dist/roap/turnDiscovery.js +220 -70
- package/dist/roap/turnDiscovery.js.map +1 -1
- package/dist/rtcMetrics/constants.js +12 -0
- package/dist/rtcMetrics/constants.js.map +1 -0
- package/dist/rtcMetrics/index.js +179 -0
- package/dist/rtcMetrics/index.js.map +1 -0
- package/dist/statsAnalyzer/index.js +357 -295
- package/dist/statsAnalyzer/index.js.map +1 -1
- package/dist/statsAnalyzer/mqaUtil.js +296 -156
- package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
- package/dist/types/annotation/annotation.types.d.ts +42 -0
- package/dist/types/annotation/constants.d.ts +31 -0
- package/dist/types/annotation/index.d.ts +117 -0
- package/dist/types/breakouts/events.d.ts +8 -0
- package/dist/types/breakouts/utils.d.ts +14 -0
- package/dist/types/common/errors/no-meeting-info.d.ts +14 -0
- package/dist/types/common/errors/reclaim-host-role-errors.d.ts +60 -0
- package/dist/types/common/errors/webex-errors.d.ts +25 -1
- package/dist/types/common/logs/request.d.ts +2 -0
- package/dist/types/common/queue.d.ts +9 -7
- package/dist/types/config.d.ts +2 -7
- package/dist/types/constants.d.ts +203 -31
- package/dist/types/controls-options-manager/enums.d.ts +11 -1
- package/dist/types/controls-options-manager/index.d.ts +17 -1
- package/dist/types/controls-options-manager/types.d.ts +43 -0
- package/dist/types/controls-options-manager/util.d.ts +1 -7
- package/dist/types/index.d.ts +6 -5
- package/dist/types/interceptors/index.d.ts +2 -0
- package/dist/types/interceptors/locusRetry.d.ts +27 -0
- package/dist/types/interpretation/collection.d.ts +5 -0
- package/dist/types/interpretation/index.d.ts +5 -0
- package/dist/types/interpretation/siLanguage.d.ts +5 -0
- package/dist/types/locus-info/index.d.ts +57 -4
- package/dist/types/locus-info/parser.d.ts +66 -6
- package/dist/types/media/index.d.ts +2 -0
- package/dist/types/media/properties.d.ts +34 -49
- package/dist/types/mediaQualityMetrics/config.d.ts +99 -223
- package/dist/types/meeting/in-meeting-actions.d.ts +86 -2
- package/dist/types/meeting/index.d.ts +567 -496
- package/dist/types/meeting/locusMediaRequest.d.ts +74 -0
- package/dist/types/meeting/muteState.d.ts +93 -25
- package/dist/types/meeting/request.d.ts +64 -43
- package/dist/types/meeting/util.d.ts +117 -1
- package/dist/types/meeting-info/index.d.ts +13 -1
- package/dist/types/meeting-info/meeting-info-v2.d.ts +31 -1
- package/dist/types/meetings/collection.d.ts +17 -0
- package/dist/types/meetings/index.d.ts +113 -21
- package/dist/types/meetings/meetings.types.d.ts +4 -0
- package/dist/types/member/index.d.ts +14 -0
- package/dist/types/member/types.d.ts +32 -0
- package/dist/types/members/collection.d.ts +5 -0
- package/dist/types/members/index.d.ts +35 -2
- package/dist/types/members/request.d.ts +73 -9
- package/dist/types/members/types.d.ts +25 -0
- package/dist/types/members/util.d.ts +214 -1
- package/dist/types/metrics/constants.d.ts +17 -0
- package/dist/types/metrics/index.d.ts +4 -111
- package/dist/types/multistream/mediaRequestManager.d.ts +72 -3
- package/dist/types/multistream/receiveSlot.d.ts +7 -3
- package/dist/types/multistream/receiveSlotManager.d.ts +14 -4
- package/dist/types/multistream/remoteMedia.d.ts +3 -31
- package/dist/types/multistream/remoteMediaGroup.d.ts +2 -9
- package/dist/types/multistream/remoteMediaManager.d.ts +62 -2
- package/dist/types/multistream/sendSlotManager.d.ts +70 -0
- package/dist/types/reachability/clusterReachability.d.ts +109 -0
- package/dist/types/reachability/index.d.ts +60 -95
- package/dist/types/reachability/request.d.ts +3 -1
- package/dist/types/reachability/util.d.ts +8 -0
- package/dist/types/reconnection-manager/index.d.ts +19 -0
- package/dist/types/recording-controller/index.d.ts +15 -1
- package/dist/types/recording-controller/util.d.ts +5 -4
- package/dist/types/roap/index.d.ts +2 -1
- package/dist/types/roap/request.d.ts +9 -8
- package/dist/types/roap/turnDiscovery.d.ts +39 -5
- package/dist/types/rtcMetrics/constants.d.ts +4 -0
- package/dist/types/rtcMetrics/index.d.ts +61 -0
- package/dist/types/statsAnalyzer/index.d.ts +34 -12
- package/dist/types/statsAnalyzer/mqaUtil.d.ts +28 -4
- package/dist/types/webinar/collection.d.ts +16 -0
- package/dist/types/webinar/index.d.ts +5 -0
- package/dist/webinar/collection.js +44 -0
- package/dist/webinar/collection.js.map +1 -0
- package/dist/webinar/index.js +69 -0
- package/dist/webinar/index.js.map +1 -0
- package/package.json +22 -19
- package/src/annotation/annotation.types.ts +50 -0
- package/src/annotation/constants.ts +36 -0
- package/src/annotation/index.ts +328 -0
- package/src/breakouts/README.md +35 -11
- package/src/breakouts/breakout.ts +67 -9
- package/src/breakouts/events.ts +56 -0
- package/src/breakouts/index.ts +558 -59
- package/src/breakouts/utils.ts +42 -0
- package/src/common/errors/no-meeting-info.ts +24 -0
- package/src/common/errors/reclaim-host-role-errors.ts +134 -0
- package/src/common/errors/webex-errors.ts +44 -2
- package/src/common/logs/logger-proxy.ts +1 -1
- package/src/common/logs/request.ts +5 -1
- package/src/common/queue.ts +22 -8
- package/src/config.ts +4 -9
- package/src/constants.ts +229 -21
- package/src/controls-options-manager/enums.ts +12 -0
- package/src/controls-options-manager/index.ts +116 -21
- package/src/controls-options-manager/types.ts +59 -0
- package/src/controls-options-manager/util.ts +294 -14
- package/src/index.ts +44 -0
- package/src/interceptors/index.ts +3 -0
- package/src/interceptors/locusRetry.ts +67 -0
- package/src/interpretation/README.md +60 -0
- package/src/interpretation/collection.ts +19 -0
- package/src/interpretation/index.ts +349 -0
- package/src/interpretation/siLanguage.ts +18 -0
- package/src/locus-info/controlsUtils.ts +108 -0
- package/src/locus-info/index.ts +417 -59
- package/src/locus-info/infoUtils.ts +10 -2
- package/src/locus-info/mediaSharesUtils.ts +80 -0
- package/src/locus-info/parser.ts +258 -47
- package/src/locus-info/selfUtils.ts +81 -5
- package/src/media/index.ts +100 -108
- package/src/media/properties.ts +88 -117
- package/src/mediaQualityMetrics/config.ts +103 -238
- package/src/meeting/in-meeting-actions.ts +171 -3
- package/src/meeting/index.ts +3411 -2435
- package/src/meeting/locusMediaRequest.ts +313 -0
- package/src/meeting/muteState.ts +223 -136
- package/src/meeting/request.ts +155 -120
- package/src/meeting/util.ts +685 -395
- package/src/meeting-info/index.ts +81 -8
- package/src/meeting-info/meeting-info-v2.ts +170 -14
- package/src/meeting-info/util.ts +1 -1
- package/src/meeting-info/utilv2.ts +23 -23
- package/src/meetings/collection.ts +33 -0
- package/src/meetings/index.ts +507 -127
- package/src/meetings/meetings.types.ts +12 -0
- package/src/meetings/request.ts +2 -0
- package/src/meetings/util.ts +81 -12
- package/src/member/index.ts +58 -0
- package/src/member/types.ts +38 -0
- package/src/member/util.ts +141 -25
- package/src/members/collection.ts +8 -0
- package/src/members/index.ts +134 -8
- package/src/members/request.ts +97 -17
- package/src/members/types.ts +29 -0
- package/src/members/util.ts +333 -240
- package/src/metrics/constants.ts +17 -0
- package/src/metrics/index.ts +1 -469
- package/src/multistream/mediaRequestManager.ts +271 -56
- package/src/multistream/receiveSlot.ts +11 -4
- package/src/multistream/receiveSlotManager.ts +34 -24
- package/src/multistream/remoteMedia.ts +5 -3
- package/src/multistream/remoteMediaGroup.ts +78 -0
- package/src/multistream/remoteMediaManager.ts +248 -44
- package/src/multistream/sendSlotManager.ts +199 -0
- package/src/reachability/clusterReachability.ts +320 -0
- package/src/reachability/index.ts +229 -346
- package/src/reachability/request.ts +8 -4
- package/src/reachability/util.ts +24 -0
- package/src/reconnection-manager/index.ts +128 -97
- package/src/recording-controller/index.ts +20 -3
- package/src/recording-controller/util.ts +26 -9
- package/src/roap/index.ts +52 -23
- package/src/roap/request.ts +48 -67
- package/src/roap/turnDiscovery.ts +147 -49
- package/src/rtcMetrics/constants.ts +3 -0
- package/src/rtcMetrics/index.ts +166 -0
- package/src/statsAnalyzer/index.ts +457 -416
- package/src/statsAnalyzer/mqaUtil.ts +317 -170
- package/src/webinar/collection.ts +31 -0
- package/src/webinar/index.ts +62 -0
- package/test/integration/spec/converged-space-meetings.js +60 -3
- package/test/integration/spec/journey.js +320 -261
- package/test/integration/spec/space-meeting.js +76 -3
- package/test/unit/spec/annotation/index.ts +418 -0
- package/test/unit/spec/breakouts/breakout.ts +118 -28
- package/test/unit/spec/breakouts/events.ts +89 -0
- package/test/unit/spec/breakouts/index.ts +1349 -114
- package/test/unit/spec/breakouts/utils.js +52 -1
- package/test/unit/spec/common/queue.js +31 -2
- package/test/unit/spec/controls-options-manager/index.js +163 -0
- package/test/unit/spec/controls-options-manager/util.js +576 -60
- package/test/unit/spec/fixture/locus.js +1 -0
- package/test/unit/spec/interceptors/locusRetry.ts +131 -0
- package/test/unit/spec/interpretation/collection.ts +15 -0
- package/test/unit/spec/interpretation/index.ts +625 -0
- package/test/unit/spec/interpretation/siLanguage.ts +28 -0
- package/test/unit/spec/locus-info/controlsUtils.js +316 -43
- package/test/unit/spec/locus-info/index.js +1363 -37
- package/test/unit/spec/locus-info/infoUtils.js +37 -15
- package/test/unit/spec/locus-info/lib/SeqCmp.json +16 -0
- package/test/unit/spec/locus-info/mediaSharesUtils.ts +41 -0
- package/test/unit/spec/locus-info/parser.js +116 -35
- package/test/unit/spec/locus-info/selfConstant.js +27 -4
- package/test/unit/spec/locus-info/selfUtils.js +208 -17
- package/test/unit/spec/media/index.ts +173 -81
- package/test/unit/spec/media/properties.ts +2 -2
- package/test/unit/spec/meeting/in-meeting-actions.ts +85 -3
- package/test/unit/spec/meeting/index.js +6821 -2172
- package/test/unit/spec/meeting/locusMediaRequest.ts +442 -0
- package/test/unit/spec/meeting/muteState.js +402 -212
- package/test/unit/spec/meeting/request.js +473 -54
- package/test/unit/spec/meeting/utils.js +773 -67
- package/test/unit/spec/meeting-info/index.js +300 -0
- package/test/unit/spec/meeting-info/meetinginfov2.js +526 -5
- package/test/unit/spec/meeting-info/utilv2.js +21 -0
- package/test/unit/spec/meetings/collection.js +26 -0
- package/test/unit/spec/meetings/index.js +1415 -213
- package/test/unit/spec/meetings/utils.js +229 -2
- package/test/unit/spec/member/index.js +61 -6
- package/test/unit/spec/member/util.js +510 -34
- package/test/unit/spec/members/index.js +432 -1
- package/test/unit/spec/members/request.js +206 -27
- package/test/unit/spec/members/utils.js +210 -0
- package/test/unit/spec/metrics/index.js +1 -50
- package/test/unit/spec/multistream/mediaRequestManager.ts +781 -114
- package/test/unit/spec/multistream/receiveSlot.ts +9 -1
- package/test/unit/spec/multistream/receiveSlotManager.ts +32 -30
- package/test/unit/spec/multistream/remoteMedia.ts +2 -0
- package/test/unit/spec/multistream/remoteMediaGroup.ts +345 -0
- package/test/unit/spec/multistream/remoteMediaManager.ts +525 -0
- package/test/unit/spec/multistream/sendSlotManager.ts +274 -0
- package/test/unit/spec/reachability/clusterReachability.ts +279 -0
- package/test/unit/spec/reachability/index.ts +551 -14
- package/test/unit/spec/reachability/request.js +3 -1
- package/test/unit/spec/reachability/util.ts +40 -0
- package/test/unit/spec/reconnection-manager/index.js +171 -11
- package/test/unit/spec/recording-controller/index.js +294 -218
- package/test/unit/spec/recording-controller/util.js +223 -96
- package/test/unit/spec/roap/index.ts +180 -83
- package/test/unit/spec/roap/request.ts +100 -62
- package/test/unit/spec/roap/turnDiscovery.ts +388 -96
- package/test/unit/spec/rtcMetrics/index.ts +122 -0
- package/test/unit/spec/stats-analyzer/index.js +1252 -12
- package/test/unit/spec/webinar/collection.ts +13 -0
- package/test/unit/spec/webinar/index.ts +60 -0
- package/test/utils/integrationTestUtils.js +46 -0
- package/test/utils/testUtils.js +0 -57
- package/test/utils/webex-test-users.js +12 -4
- package/dist/metrics/config.js +0 -289
- package/dist/metrics/config.js.map +0 -1
- package/dist/types/metrics/config.d.ts +0 -169
- package/src/index.js +0 -18
- package/src/metrics/config.ts +0 -485
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BrowserDetection","getOSName","getOSVersion","getBrowserName","getBrowserVersion","anonymizeIPAddress","localIp","anonymize","triggerTimers","event","meeting","data","eventType","CALL_INITIATED","setStartCallInitiateJoinReq","LOCUS_JOIN_REQUEST","setEndCallInitiateJoinReq","setStartJoinReqResp","LOCUS_JOIN_RESPONSE","setEndJoinReqResp","setStartSetupDelay","mediaType","AUDIO","VIDEO","setStartSendingMediaDelay","RECEIVING_MEDIA_START","setEndSetupDelay","SENDING_MEDIA_START","setEndSendingMediaDelay","LOCAL_SDP_GENERATED","setStartLocalSDPGenRemoteSDPRecvDelay","REMOTE_SDP_RECEIVED","setEndLocalSDPGenRemoteSDPRecvDelay","Metrics","instance","_events","meetingCollection","keys","webex","options","meetingId","indexOf","LoggerProxy","logger","error","get","callEvents","MEDIA_QUALITY","sendMediaQualityAnalyzerMetrics","push","sendCallAnalyzerMetrics","info","identifiers","payload","eventId","uuid","v4","version","origin","name","networkType","userAgent","userAgentToString","clientInfo","clientType","clientVersion","CLIENT_NAME","localNetworkPrefix","meetings","geoHintInfo","clientAddress","osVersion","subClientType","os","getOSNameInternal","browser","browserVersion","originTime","triggered","Date","toISOString","senderCountryCode","countryCode","canProceed","eventData","webClientDomain","window","location","hostname","Object","prototype","hasOwnProperty","call","errors","trigger","pstnAudioType","mediaCapabilities","recoveredBy","joinTimes","isRoapCallEnabled","audioSetupDelay","videoSetupDelay","UNKNOWN","intervals","intervalData","sourceMetadata","applicationSoftwareType","applicationSoftwareVersion","mediaEngineSoftwareType","mediaEngineSoftwareVersion","startTime","err","showToUser","errorCode","statusCode","body","ERROR_CODE","MEETING_ERRORS","FREE_USER_MAX_PARTICIPANTS_EXCEEDED","PAID_USER_MAX_PARTICIPANTS_EXCEEDED","SERVICE_MAX_PARTICIPANTS_EXCEEDED","INACTIVE","EXCEEDED_MAX_JOINED_PARTICIPANTS","EXCEEDED_SERVICE_MAX_PARTICIPANTS","MEETING_IS_LOCKED","MEETING_IS_TERMINATING","MEETING_REQUIRE_MODERATOR_PIN_INTENT","MEETING_REQUIRE_MODERATOR_PIN","MEETING_REQUIRE_MODERATOR_ROLE","JOIN_RESTRICTED_USER","GET_RESTRICTED_USER","CREATE_MEDIA_RESTRICTED_USER","JOIN_RESTRICTED_USER_NOT_IN_ROOM","MEETING_NOT_FOUND","NOT_WEBEX_SITE","INVALID_JOIN_TIME","PHONE_NUMBER_NOT_A_NUMBER","PHONE_NUMBER_TOO_LONG","INVALID_DIALABLE_KEY","ONE_ON_ONE_TO_SELF_NOT_ALLOWED","REMOVED_PARTICIPANT","MEETING_LINK_NOT_FOUND","PHONE_NUMBER_TOO_SHORT_AFTER_IDD","INVALID_INVITEE_ADDRESS","PMR_ACCOUNT_LOCKED","RESOURCE_GUEST_FORBIDDEN","PMR_ACCOUNT_SUSPENDED","EMPTY_PHONE_NUMBER_OR_COUNTRY_CODE","INVALID_SINCE_OR_SEQUENCE_HASH_IN_REQUEST","CONVERSATION_NOT_FOUND","RECORDING_CONTROL_NOT_SUPPORTED","RECORDING_NOT_STARTED","RECORDING_NOT_ENABLED","generateErrorPayload","LOCUS_RESPONSE","shownToUser","errorPayload","category","errorDescription","fatal","notFatalErrorList","OTHER","errorData","httpCode","userAgentOption","browserInfo","util","format","metrics","clientName","toLowerCase","split","osInfo","process","env","NODE_ENV","metricName","metricFields","metricTags","internal","submitClientMetrics","type","config","fields","tags"],"sources":["index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nimport util from 'util';\n\nimport {includes} from 'lodash';\nimport uuid from 'uuid';\nimport window from 'global/window';\nimport anonymize from 'ip-anonymize';\n\nimport {getOSNameInternal} from '@webex/internal-plugin-metrics';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport {MEETING_ERRORS} from '../constants';\nimport BrowserDetection from '../common/browser-detection';\n\nimport {\n error,\n eventType,\n errorCodes as ERROR_CODE,\n UNKNOWN,\n CLIENT_NAME,\n mediaType,\n} from './config';\n\nconst {getOSName, getOSVersion, getBrowserName, getBrowserVersion} = BrowserDetection();\n\n// Apply a CIDR /28 format to the IPV4 and /96 to the IPV6 addresses\n// For reference : https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing\nconst anonymizeIPAddress = (localIp) => anonymize(localIp, 28, 96);\n\nconst triggerTimers = ({event, meeting, data}) => {\n switch (event) {\n case eventType.CALL_INITIATED:\n meeting.setStartCallInitiateJoinReq();\n break;\n case eventType.LOCUS_JOIN_REQUEST:\n meeting.setEndCallInitiateJoinReq();\n meeting.setStartJoinReqResp();\n break;\n case eventType.LOCUS_JOIN_RESPONSE:\n meeting.setEndJoinReqResp();\n meeting.setStartSetupDelay(mediaType.AUDIO);\n meeting.setStartSetupDelay(mediaType.VIDEO);\n meeting.setStartSendingMediaDelay(mediaType.AUDIO);\n meeting.setStartSendingMediaDelay(mediaType.VIDEO);\n break;\n case eventType.RECEIVING_MEDIA_START:\n meeting.setEndSetupDelay(data.mediaType);\n break;\n case eventType.SENDING_MEDIA_START:\n meeting.setEndSendingMediaDelay(data.mediaType);\n break;\n case eventType.LOCAL_SDP_GENERATED:\n meeting.setStartLocalSDPGenRemoteSDPRecvDelay();\n break;\n case eventType.REMOTE_SDP_RECEIVED:\n meeting.setEndLocalSDPGenRemoteSDPRecvDelay();\n break;\n default:\n break;\n }\n};\n\n/**\n * @description Metrics handles all the call metrics events\n * @export\n * @class Metrics\n */\nclass Metrics {\n static instance: Metrics;\n\n _events: any;\n keys: any;\n meetingCollection: any;\n webex: any;\n\n /**\n * Create Metrics Object\n * @constructor\n * @public\n * @memberof Meetings\n */\n constructor() {\n if (!Metrics.instance) {\n /**\n * @instance\n * @type {Array}\n * @private\n * @memberof Metrics\n */\n this._events = [];\n /**\n * @instance\n * @type {MeetingCollection}\n * @private\n * @memberof Metrics\n */\n this.meetingCollection = null;\n /**\n * @instance\n * @type {MeetingCollection}\n * @private\n * @memberof Metrics\n */\n this.keys = Object.values(eventType);\n /**\n * @instance\n * @type {Metrics}\n * @private\n * @memberof Metrics\n */\n Metrics.instance = this;\n }\n\n // eslint-disable-next-line no-constructor-return\n return Metrics.instance;\n }\n\n /**\n * Initializes the Metrics singleton with a meeting Collection.\n *\n * @param {Object} meetingCollection meetings object\n * @param {Object} webex webex SDK object\n *\n * @returns {void}\n */\n initialSetup(meetingCollection: object, webex: object) {\n this.meetingCollection = meetingCollection;\n this.webex = webex;\n }\n\n /**\n * poste Meeting event metrics\n * @param {object} options {meetingId/meeting} as a json object\n * @param {Meeting} options.meeting Meeting object\n * @param {String} options.meetingId\n * @param {object} options.data\n * @param {object} options.event\n * @returns {object} null\n */\n postEvent(options: {meeting?: any; meetingId?: string; data?: object; event?: any} | any) {\n const {meetingId, data = {}, event} = options;\n let {meeting} = options;\n\n if (this.keys.indexOf(event) === -1) {\n LoggerProxy.logger.error(\n `Metrics:index#postEvent --> Event ${event} doesn't exist in dictionary`\n );\n }\n\n if (!meeting && meetingId) {\n meeting = this.meetingCollection.get(meetingId);\n options.meeting = meeting;\n }\n\n if (meeting) {\n triggerTimers(options);\n\n if (!meeting.callEvents) {\n meeting.callEvents = [];\n }\n if (event === eventType.MEDIA_QUALITY) {\n data.event = event;\n meeting.sendMediaQualityAnalyzerMetrics(data);\n } else {\n meeting.callEvents.push(event);\n data.event = event;\n meeting.sendCallAnalyzerMetrics(data);\n }\n } else {\n LoggerProxy.logger.info(\n `Metrics:index#postEvent --> Event received for meetingId:${meetingId}, but meeting not found in collection.`\n );\n }\n }\n\n /**\n * Docs for Call analyzer metrics\n * https://sqbu-github.cisco.com/WebExSquared/call-analyzer/wiki\n * https://sqbu-github.cisco.com/WebExSquared/event-dictionary/blob/master/diagnostic-events.raml\n */\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n initPayload(eventType, identifiers, options) {\n const payload: any = {\n eventId: uuid.v4(),\n version: 1,\n origin: {\n name: 'endpoint',\n networkType: 'unknown',\n userAgent: this.userAgentToString(),\n clientInfo: {\n clientType: options.clientType,\n clientVersion: `${CLIENT_NAME}/${this.webex.version}`,\n localNetworkPrefix: anonymizeIPAddress(this.webex.meetings.geoHintInfo?.clientAddress),\n osVersion: getOSVersion() || 'unknown',\n subClientType: options.subClientType,\n os: getOSNameInternal(),\n browser: getBrowserName(),\n browserVersion: getBrowserVersion(),\n },\n },\n originTime: {\n triggered: new Date().toISOString(),\n },\n senderCountryCode: this.webex.meetings.geoHintInfo?.countryCode,\n event: {\n name: eventType,\n canProceed: true,\n identifiers,\n eventData: {webClientDomain: window.location.hostname},\n },\n };\n\n // TODO: more options should be checked and some of them should be mandatory in certain conditions\n if (options) {\n if (Object.prototype.hasOwnProperty.call(options, 'canProceed')) {\n payload.event.canProceed = options.canProceed;\n }\n if (options.errors) {\n payload.event.errors = options.errors;\n }\n if (options.mediaType) {\n payload.event.mediaType = options.mediaType;\n }\n if (options.trigger) {\n payload.event.trigger = options.trigger;\n }\n if (options.pstnAudioType) {\n payload.event.pstnAudioType = options.pstnAudioType;\n }\n if (options.mediaCapabilities) {\n payload.event.mediaCapabilities = options.mediaCapabilities;\n }\n if (options.recoveredBy) {\n payload.event.recoveredBy = options.recoveredBy;\n }\n if (options.joinTimes) {\n payload.event.joinTimes = options.joinTimes;\n }\n if (options.isRoapCallEnabled) {\n payload.event.isRoapCallEnabled = options.isRoapCallEnabled;\n }\n }\n\n return payload;\n }\n\n /**\n * get the payload specific for a media quality event through call analyzer\n * @param {String} eventType the event name\n * @param {Object} identifiers contains the identifiers needed for CA\n * @param {String} identifiers.correlationId\n * @param {String} identifiers.locusUrl\n * @param {String} identifiers.locusId\n * @param {Object} options\n * @param {Object} options.intervalData\n * @param {String} options.clientType\n * @returns {Object}\n * @public\n * @memberof Metrics\n */\n public initMediaPayload(\n // eslint-disable-next-line @typescript-eslint/no-shadow\n eventType: string,\n identifiers: {\n correlationId: string;\n locusUrl: string;\n locusId: string;\n },\n options:\n | {\n intervalData: object;\n clientType: string;\n }\n | any = {}\n ) {\n const {audioSetupDelay, videoSetupDelay, joinTimes} = options;\n\n const payload = {\n eventId: uuid.v4(),\n version: 1,\n origin: {\n audioSetupDelay,\n videoSetupDelay,\n name: 'endpoint',\n networkType: options.networkType || UNKNOWN,\n userAgent: this.userAgentToString(),\n clientInfo: {\n clientType: options.clientType, // TODO: Only clientType: 'TEAMS_CLIENT' is whitelisted\n clientVersion: `${CLIENT_NAME}/${this.webex.version}`,\n localNetworkPrefix: anonymizeIPAddress(this.webex.meetings.geoHintInfo?.clientAddress),\n os: getOSNameInternal(),\n osVersion: getOSVersion() || UNKNOWN,\n subClientType: options.subClientType,\n browser: getBrowserName(),\n browserVersion: getBrowserVersion(),\n },\n },\n originTime: {\n triggered: new Date().toISOString(),\n },\n senderCountryCode: this.webex.meetings.geoHintInfo?.countryCode,\n event: {\n name: eventType,\n canProceed: true,\n identifiers,\n intervals: [options.intervalData],\n joinTimes,\n eventData: {\n webClientDomain: window.location.hostname,\n },\n sourceMetadata: {\n applicationSoftwareType: CLIENT_NAME,\n applicationSoftwareVersion: this.webex.version,\n mediaEngineSoftwareType: getBrowserName() || 'browser',\n mediaEngineSoftwareVersion: getOSVersion() || UNKNOWN,\n startTime: new Date().toISOString(),\n },\n },\n };\n\n return payload;\n }\n\n /**\n * This function Parses a Locus error and returns a diagnostic event payload.\n * It should keep updating from:\n * https://sqbu-github.cisco.com/WebExSquared/spark-client-framework/blob/master/spark-client-framework/Adapters/TelephonyAdapter/TelephonyAdapter.cpp#L920\n *\n * @param {Object} err the error Object from Locus response\n * @param {boolean} showToUser true if a toast is shown to user\n * @returns {{showToUser: boolean, category: string, errorDescription: string,\n * errorCode: number, errorData: *, fatal: boolean, name: string}}\n */\n parseLocusError(err: any, showToUser: boolean) {\n let errorCode;\n\n if (err && err.statusCode && err.statusCode >= 500) {\n errorCode = 1003;\n } else if (err && err.body && err.body.errorCode) {\n // locus error codes: https://sqbu-github.cisco.com/WebExSquared/locus/blob/master/server/src/main/resources/locus-error-codes.properties\n switch (ERROR_CODE[err.body.errorCode]) {\n case MEETING_ERRORS.FREE_USER_MAX_PARTICIPANTS_EXCEEDED:\n errorCode = 3007;\n break;\n case MEETING_ERRORS.PAID_USER_MAX_PARTICIPANTS_EXCEEDED:\n case MEETING_ERRORS.SERVICE_MAX_PARTICIPANTS_EXCEEDED:\n errorCode = 3002;\n break;\n case MEETING_ERRORS.INACTIVE:\n errorCode = 4001;\n break;\n case MEETING_ERRORS.EXCEEDED_MAX_JOINED_PARTICIPANTS:\n case MEETING_ERRORS.EXCEEDED_SERVICE_MAX_PARTICIPANTS:\n errorCode = 3001;\n break;\n case MEETING_ERRORS.MEETING_IS_LOCKED:\n errorCode = 4002;\n break;\n case MEETING_ERRORS.MEETING_IS_TERMINATING:\n errorCode = 4003;\n break;\n case MEETING_ERRORS.MEETING_REQUIRE_MODERATOR_PIN_INTENT:\n errorCode = 4004;\n break;\n case MEETING_ERRORS.MEETING_REQUIRE_MODERATOR_PIN:\n errorCode = 4005;\n break;\n case MEETING_ERRORS.MEETING_REQUIRE_MODERATOR_ROLE:\n errorCode = 4006;\n break;\n case MEETING_ERRORS.JOIN_RESTRICTED_USER:\n case MEETING_ERRORS.GET_RESTRICTED_USER:\n case MEETING_ERRORS.CREATE_MEDIA_RESTRICTED_USER:\n errorCode = 3005;\n break;\n case MEETING_ERRORS.JOIN_RESTRICTED_USER_NOT_IN_ROOM:\n errorCode = 4007;\n break;\n case MEETING_ERRORS.MEETING_NOT_FOUND:\n errorCode = 4011;\n break;\n case MEETING_ERRORS.NOT_WEBEX_SITE:\n errorCode = 4012;\n break;\n case MEETING_ERRORS.INVALID_JOIN_TIME:\n errorCode = 4013;\n break;\n case MEETING_ERRORS.PHONE_NUMBER_NOT_A_NUMBER:\n errorCode = 4016;\n break;\n case MEETING_ERRORS.PHONE_NUMBER_TOO_LONG:\n errorCode = 4017;\n break;\n case MEETING_ERRORS.INVALID_DIALABLE_KEY:\n errorCode = 4018;\n break;\n case MEETING_ERRORS.ONE_ON_ONE_TO_SELF_NOT_ALLOWED:\n errorCode = 4019;\n break;\n case MEETING_ERRORS.REMOVED_PARTICIPANT:\n errorCode = 4020;\n break;\n case MEETING_ERRORS.MEETING_LINK_NOT_FOUND:\n errorCode = 4021;\n break;\n case MEETING_ERRORS.PHONE_NUMBER_TOO_SHORT_AFTER_IDD:\n errorCode = 4022;\n break;\n case MEETING_ERRORS.INVALID_INVITEE_ADDRESS:\n errorCode = 4023;\n break;\n case MEETING_ERRORS.PMR_ACCOUNT_LOCKED:\n errorCode = 4024;\n break;\n case MEETING_ERRORS.RESOURCE_GUEST_FORBIDDEN:\n errorCode = 4025;\n break;\n case MEETING_ERRORS.PMR_ACCOUNT_SUSPENDED:\n errorCode = 4026;\n break;\n case MEETING_ERRORS.EMPTY_PHONE_NUMBER_OR_COUNTRY_CODE:\n errorCode = 4027;\n break;\n case MEETING_ERRORS.INVALID_SINCE_OR_SEQUENCE_HASH_IN_REQUEST:\n errorCode = 1006;\n break;\n case MEETING_ERRORS.CONVERSATION_NOT_FOUND:\n errorCode = 4028;\n break;\n case MEETING_ERRORS.RECORDING_CONTROL_NOT_SUPPORTED:\n case MEETING_ERRORS.RECORDING_NOT_STARTED:\n case MEETING_ERRORS.RECORDING_NOT_ENABLED:\n errorCode = 4029;\n break;\n default:\n errorCode = 4008;\n }\n } else {\n errorCode = 4008;\n }\n\n return this.generateErrorPayload(errorCode, showToUser, error.name.LOCUS_RESPONSE, err);\n }\n\n generateErrorPayload(errorCode, shownToUser, name, err) {\n if (error.errors[errorCode]) {\n const errorPayload: any = {\n shownToUser: shownToUser || false,\n category: error.errors[errorCode][2],\n errorDescription: error.errors[errorCode][0],\n errorCode,\n fatal: !includes(error.notFatalErrorList, errorCode),\n name: name || error.name.OTHER,\n };\n\n if (err && err.body) {\n errorPayload.errorData = err.body;\n }\n\n if (err && err.statusCode) {\n errorPayload.httpCode = err.statusCode;\n }\n\n return errorPayload;\n }\n\n return null;\n }\n\n /**\n * Returns a formated string of the user agent.\n *\n * @returns {string} formatted user agent information\n */\n userAgentToString() {\n let userAgentOption;\n let browserInfo;\n const clientInfo = util.format('client=%s', `${this.webex.meetings?.metrics?.clientName}`);\n\n if (\n ['chrome', 'firefox', 'msie', 'msedge', 'safari'].indexOf(getBrowserName().toLowerCase()) !==\n -1\n ) {\n browserInfo = util.format(\n 'browser=%s',\n `${getBrowserName().toLowerCase()}/${getBrowserVersion().split('.')[0]}`\n );\n }\n const osInfo = util.format('os=%s', `${getOSName()}/${getOSVersion().split('.')[0]}`);\n\n if (browserInfo) {\n userAgentOption = `(${browserInfo}`;\n }\n if (osInfo) {\n userAgentOption = userAgentOption\n ? `${userAgentOption}; ${clientInfo}; ${osInfo}`\n : `${clientInfo}; (${osInfo}`;\n }\n if (userAgentOption) {\n userAgentOption += ')';\n\n return util.format(\n 'webex-js-sdk/%s %s',\n `${process.env.NODE_ENV}-${this.webex.version}`,\n userAgentOption\n );\n }\n\n return util.format('webex-js-sdk/%s', `${process.env.NODE_ENV}-${this.webex.version}`);\n }\n\n /**\n * Uploads given metric to the Metrics service as an Behavioral metric.\n * Metadata about the environment such as browser, OS, SDK and their versions\n * are automatically added when the metric is sent.\n *\n * The Metrics service will send an Behavioral metric to InfluxDB for\n * aggregation.\n * See https://confluence-eng-gpk2.cisco.com/conf/display/WBXT/Getting+started+with+Metrics+Service.\n *\n * @param {string} metricName Name of the metric (measurement) to send\n * @param {Object} metricFields Key-valye pairs of data or values about this metric\n * @param {Object} metricTags Key-value pairs of metric metadata\n *\n * @returns {void}\n */\n sendBehavioralMetric(metricName: string, metricFields: object = {}, metricTags: object = {}) {\n this.webex.internal.metrics.submitClientMetrics(metricName, {\n type: this.webex.config.metrics.type,\n fields: metricFields,\n tags: metricTags,\n });\n }\n}\n\n// Export Metrics singleton ---------------------------------------------------\nconst instance = new Metrics();\n\nexport default instance;\n"],"mappings":";;;;;;;;;;;;;AAGA;AAGA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAfA;AACA;AACA;;AAsBA,wBAAqE,IAAAA,yBAAgB,GAAE;EAAhFC,SAAS,qBAATA,SAAS;EAAEC,YAAY,qBAAZA,YAAY;EAAEC,cAAc,qBAAdA,cAAc;EAAEC,iBAAiB,qBAAjBA,iBAAiB;;AAEjE;AACA;AACA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkB,CAAIC,OAAO;EAAA,OAAK,IAAAC,oBAAS,EAACD,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC;AAAA;AAElE,IAAME,aAAa,GAAG,SAAhBA,aAAa,OAA+B;EAAA,IAA1BC,KAAK,QAALA,KAAK;IAAEC,OAAO,QAAPA,OAAO;IAAEC,IAAI,QAAJA,IAAI;EAC1C,QAAQF,KAAK;IACX,KAAKG,iBAAS,CAACC,cAAc;MAC3BH,OAAO,CAACI,2BAA2B,EAAE;MACrC;IACF,KAAKF,iBAAS,CAACG,kBAAkB;MAC/BL,OAAO,CAACM,yBAAyB,EAAE;MACnCN,OAAO,CAACO,mBAAmB,EAAE;MAC7B;IACF,KAAKL,iBAAS,CAACM,mBAAmB;MAChCR,OAAO,CAACS,iBAAiB,EAAE;MAC3BT,OAAO,CAACU,kBAAkB,CAACC,iBAAS,CAACC,KAAK,CAAC;MAC3CZ,OAAO,CAACU,kBAAkB,CAACC,iBAAS,CAACE,KAAK,CAAC;MAC3Cb,OAAO,CAACc,yBAAyB,CAACH,iBAAS,CAACC,KAAK,CAAC;MAClDZ,OAAO,CAACc,yBAAyB,CAACH,iBAAS,CAACE,KAAK,CAAC;MAClD;IACF,KAAKX,iBAAS,CAACa,qBAAqB;MAClCf,OAAO,CAACgB,gBAAgB,CAACf,IAAI,CAACU,SAAS,C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CAACC,QAAQ,cAAI,IAAI,CAACzI,KAAK,CAACmB,OAAO,EAAG;IACxF;;IAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAdE;IAAA;IAAA,OAeA,8BAAqBuH,UAAkB,EAAsD;MAAA,IAApDC,YAAoB,uEAAG,CAAC,CAAC;MAAA,IAAEC,UAAkB,uEAAG,CAAC,CAAC;MACzF,IAAI,CAAC5I,KAAK,CAAC6I,QAAQ,CAACX,OAAO,CAACY,mBAAmB,CAACJ,UAAU,EAAE;QAC1DK,IAAI,EAAE,IAAI,CAAC/I,KAAK,CAACgJ,MAAM,CAACd,OAAO,CAACa,IAAI;QACpCE,MAAM,EAAEN,YAAY;QACpBO,IAAI,EAAEN;MACR,CAAC,CAAC;IACJ;EAAC;EAAA;AAAA,KAGH;AAAA,8BArdMjJ,OAAO;AAsdb,IAAMC,QAAQ,GAAG,IAAID,OAAO,EAAE;AAAC,eAEhBC,QAAQ;AAAA"}
|
|
1
|
+
{"version":3,"names":["Metrics","instance","webex","metricName","metricFields","metricTags","internal","metrics","submitClientMetrics","type","config","fields","tags"],"sources":["index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * @description Metrics handles all the call metrics events\n * @export\n * @class Metrics\n */\nclass Metrics {\n static instance: Metrics;\n webex: any;\n\n /**\n * Create Metrics Object\n * @constructor\n * @public\n * @memberof Meetings\n */\n constructor() {\n if (!Metrics.instance) {\n /**\n * @instance\n * @type {Metrics}\n * @private\n * @memberof Metrics\n */\n Metrics.instance = this;\n }\n\n // eslint-disable-next-line no-constructor-return\n return Metrics.instance;\n }\n\n /**\n * Initializes the Metrics singleton with a meeting Collection.\n *\n * @param {Object} webex webex SDK object\n *\n * @returns {void}\n */\n initialSetup(webex: object) {\n this.webex = webex;\n }\n\n /**\n * Uploads given metric to the Metrics service as an Behavioral metric.\n * Metadata about the environment such as browser, OS, SDK and their versions\n * are automatically added when the metric is sent.\n *\n * The Metrics service will send an Behavioral metric to InfluxDB for\n * aggregation.\n * See https://confluence-eng-gpk2.cisco.com/conf/display/WBXT/Getting+started+with+Metrics+Service.\n *\n * @param {string} metricName Name of the metric (measurement) to send\n * @param {Object} metricFields Key-valye pairs of data or values about this metric\n * @param {Object} metricTags Key-value pairs of metric metadata\n *\n * @returns {void}\n */\n sendBehavioralMetric(metricName: string, metricFields: object = {}, metricTags: object = {}) {\n this.webex.internal.metrics.submitClientMetrics(metricName, {\n type: this.webex.config.metrics.type,\n fields: metricFields,\n tags: metricTags,\n });\n }\n}\n\n// Export Metrics singleton ---------------------------------------------------\nconst instance = new Metrics();\n\nexport default instance;\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAJA,IAKMA,OAAO;EAIX;AACF;AACA;AACA;AACA;AACA;EACE,mBAAc;IAAA;IAAA;IACZ,IAAI,CAACA,OAAO,CAACC,QAAQ,EAAE;MACrB;AACN;AACA;AACA;AACA;AACA;MACMD,OAAO,CAACC,QAAQ,GAAG,IAAI;IACzB;;IAEA;IACA,OAAOD,OAAO,CAACC,QAAQ;EACzB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE;IAAA;IAAA,OAOA,sBAAaC,KAAa,EAAE;MAC1B,IAAI,CAACA,KAAK,GAAGA,KAAK;IACpB;;IAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAdE;IAAA;IAAA,OAeA,8BAAqBC,UAAkB,EAAsD;MAAA,IAApDC,YAAoB,uEAAG,CAAC,CAAC;MAAA,IAAEC,UAAkB,uEAAG,CAAC,CAAC;MACzF,IAAI,CAACH,KAAK,CAACI,QAAQ,CAACC,OAAO,CAACC,mBAAmB,CAACL,UAAU,EAAE;QAC1DM,IAAI,EAAE,IAAI,CAACP,KAAK,CAACQ,MAAM,CAACH,OAAO,CAACE,IAAI;QACpCE,MAAM,EAAEP,YAAY;QACpBQ,IAAI,EAAEP;MACR,CAAC,CAAC;IACJ;EAAC;EAAA;AAAA,KAGH;AAAA,8BA5DML,OAAO;AA6Db,IAAMC,QAAQ,GAAG,IAAID,OAAO,EAAE;AAAC,eAEhBC,QAAQ;AAAA"}
|
|
@@ -6,14 +6,15 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.MediaRequestManager = void 0;
|
|
9
|
-
var _entries = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/entries"));
|
|
10
9
|
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
11
|
-
var
|
|
10
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
11
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
13
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
15
|
+
var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
|
|
15
16
|
var _debounce2 = _interopRequireDefault(require("lodash/debounce"));
|
|
16
|
-
var
|
|
17
|
+
var _cloneDeepWith2 = _interopRequireDefault(require("lodash/cloneDeepWith"));
|
|
17
18
|
var _internalMediaCore = require("@webex/internal-media-core");
|
|
18
19
|
var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
|
|
19
20
|
var _receiveSlot = require("./receiveSlot");
|
|
@@ -29,18 +30,27 @@ var CODEC_DEFAULTS = {
|
|
|
29
30
|
};
|
|
30
31
|
var DEBOUNCED_SOURCE_UPDATE_TIME = 1000;
|
|
31
32
|
var MediaRequestManager = /*#__PURE__*/function () {
|
|
32
|
-
function MediaRequestManager(
|
|
33
|
+
function MediaRequestManager(sendMediaRequestsCallback, options) {
|
|
33
34
|
(0, _classCallCheck2.default)(this, MediaRequestManager);
|
|
34
35
|
(0, _defineProperty2.default)(this, "sendMediaRequestsCallback", void 0);
|
|
36
|
+
(0, _defineProperty2.default)(this, "kind", void 0);
|
|
35
37
|
(0, _defineProperty2.default)(this, "counter", void 0);
|
|
36
38
|
(0, _defineProperty2.default)(this, "clientRequests", void 0);
|
|
37
39
|
(0, _defineProperty2.default)(this, "degradationPreferences", void 0);
|
|
38
40
|
(0, _defineProperty2.default)(this, "sourceUpdateListener", void 0);
|
|
39
41
|
(0, _defineProperty2.default)(this, "debouncedSourceUpdateListener", void 0);
|
|
42
|
+
(0, _defineProperty2.default)(this, "previousStreamRequests", []);
|
|
43
|
+
(0, _defineProperty2.default)(this, "trimRequestsToNumOfSources", void 0);
|
|
44
|
+
(0, _defineProperty2.default)(this, "numTotalSources", void 0);
|
|
45
|
+
(0, _defineProperty2.default)(this, "numLiveSources", void 0);
|
|
40
46
|
this.sendMediaRequestsCallback = sendMediaRequestsCallback;
|
|
41
47
|
this.counter = 0;
|
|
48
|
+
this.numLiveSources = 0;
|
|
49
|
+
this.numTotalSources = 0;
|
|
42
50
|
this.clientRequests = {};
|
|
43
|
-
this.degradationPreferences = degradationPreferences;
|
|
51
|
+
this.degradationPreferences = options.degradationPreferences;
|
|
52
|
+
this.kind = options.kind;
|
|
53
|
+
this.trimRequestsToNumOfSources = options.trimRequestsToNumOfSources;
|
|
44
54
|
this.sourceUpdateListener = this.commit.bind(this);
|
|
45
55
|
this.debouncedSourceUpdateListener = (0, _debounce2.default)(this.sourceUpdateListener, DEBOUNCED_SOURCE_UPDATE_TIME);
|
|
46
56
|
}
|
|
@@ -52,22 +62,18 @@ var MediaRequestManager = /*#__PURE__*/function () {
|
|
|
52
62
|
}
|
|
53
63
|
}, {
|
|
54
64
|
key: "getDegradedClientRequests",
|
|
55
|
-
value: function getDegradedClientRequests() {
|
|
65
|
+
value: function getDegradedClientRequests(clientRequests) {
|
|
56
66
|
var _this = this;
|
|
57
|
-
var clientRequests = (0, _cloneDeep2.default)(this.clientRequests);
|
|
58
67
|
var maxFsLimits = [(0, _remoteMedia.getMaxFs)('best'), (0, _remoteMedia.getMaxFs)('large'), (0, _remoteMedia.getMaxFs)('medium'), (0, _remoteMedia.getMaxFs)('small'), (0, _remoteMedia.getMaxFs)('very small'), (0, _remoteMedia.getMaxFs)('thumbnail')];
|
|
59
68
|
|
|
60
69
|
// reduce max-fs until total macroblocks is below limit
|
|
61
70
|
var _loop = function _loop(i) {
|
|
62
71
|
var totalMacroblocksRequested = 0;
|
|
63
|
-
(0,
|
|
64
|
-
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
65
|
-
id = _ref2[0],
|
|
66
|
-
mr = _ref2[1];
|
|
72
|
+
(0, _values.default)(clientRequests).forEach(function (mr) {
|
|
67
73
|
if (mr.codecInfo) {
|
|
68
74
|
mr.codecInfo.maxFs = Math.min(mr.preferredMaxFs || CODEC_DEFAULTS.h264.maxFs, mr.codecInfo.maxFs || CODEC_DEFAULTS.h264.maxFs, maxFsLimits[i]);
|
|
69
75
|
// we only consider sources with "live" state
|
|
70
|
-
var slotsWithLiveSource =
|
|
76
|
+
var slotsWithLiveSource = mr.receiveSlots.filter(function (rs) {
|
|
71
77
|
return rs.sourceState === 'live';
|
|
72
78
|
});
|
|
73
79
|
totalMacroblocksRequested += mr.codecInfo.maxFs * slotsWithLiveSource.length;
|
|
@@ -86,38 +92,213 @@ var MediaRequestManager = /*#__PURE__*/function () {
|
|
|
86
92
|
var _ret = _loop(i);
|
|
87
93
|
if (_ret === "break") break;
|
|
88
94
|
}
|
|
89
|
-
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns true if two stream requests are the same, false otherwise.
|
|
99
|
+
*
|
|
100
|
+
* @param {StreamRequest} streamRequestA - Stream request A for comparison.
|
|
101
|
+
* @param {StreamRequest} streamRequestB - Stream request B for comparison.
|
|
102
|
+
* @returns {boolean} - Whether they are equal.
|
|
103
|
+
*/
|
|
104
|
+
// eslint-disable-next-line class-methods-use-this
|
|
105
|
+
}, {
|
|
106
|
+
key: "isEqual",
|
|
107
|
+
value: function isEqual(streamRequestA, streamRequestB) {
|
|
108
|
+
return (0, _stringify.default)(streamRequestA._toJmpStreamRequest()) === (0, _stringify.default)(streamRequestB._toJmpStreamRequest());
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Compares new stream requests to previous ones and determines
|
|
113
|
+
* if they are the same.
|
|
114
|
+
*
|
|
115
|
+
* @param {StreamRequest[]} newRequests - Array with new requests.
|
|
116
|
+
* @returns {boolean} - True if they are equal, false otherwise.
|
|
117
|
+
*/
|
|
118
|
+
}, {
|
|
119
|
+
key: "checkIsNewRequestsEqualToPrev",
|
|
120
|
+
value: function checkIsNewRequestsEqualToPrev(newRequests) {
|
|
121
|
+
var _this2 = this;
|
|
122
|
+
return !(0, _isEmpty2.default)(this.previousStreamRequests) && this.previousStreamRequests.length === newRequests.length && this.previousStreamRequests.every(function (req, idx) {
|
|
123
|
+
return _this2.isEqual(req, newRequests[idx]);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Returns the maxPayloadBitsPerSecond per Stream
|
|
129
|
+
*
|
|
130
|
+
* If MediaRequestManager kind is "audio", a constant bitrate will be returned.
|
|
131
|
+
* If MediaRequestManager kind is "video", the bitrate will be calculated based
|
|
132
|
+
* on maxFs (default h264 maxFs as fallback if maxFs is not defined)
|
|
133
|
+
*
|
|
134
|
+
* @param {MediaRequest} mediaRequest - mediaRequest to take data from
|
|
135
|
+
* @returns {number} maxPayloadBitsPerSecond
|
|
136
|
+
*/
|
|
137
|
+
}, {
|
|
138
|
+
key: "getMaxPayloadBitsPerSecond",
|
|
139
|
+
value: function getMaxPayloadBitsPerSecond(mediaRequest) {
|
|
140
|
+
if (this.kind === 'audio') {
|
|
141
|
+
// return mono_music bitrate default if the kind of mediarequest manager is audio:
|
|
142
|
+
return _internalMediaCore.RecommendedOpusBitrates.FB_MONO_MUSIC;
|
|
143
|
+
}
|
|
144
|
+
return (0, _internalMediaCore.getRecommendedMaxBitrateForFrameSize)(mediaRequest.codecInfo.maxFs || CODEC_DEFAULTS.h264.maxFs);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Returns the max Macro Blocks per second (maxMbps) per H264 Stream
|
|
149
|
+
*
|
|
150
|
+
* The maxMbps will be calculated based on maxFs and maxFps
|
|
151
|
+
* (default h264 maxFps as fallback if maxFps is not defined)
|
|
152
|
+
*
|
|
153
|
+
* @param {MediaRequest} mediaRequest - mediaRequest to take data from
|
|
154
|
+
* @returns {number} maxMbps
|
|
155
|
+
*/
|
|
156
|
+
// eslint-disable-next-line class-methods-use-this
|
|
157
|
+
}, {
|
|
158
|
+
key: "getH264MaxMbps",
|
|
159
|
+
value: function getH264MaxMbps(mediaRequest) {
|
|
160
|
+
// fallback for maxFps (not needed for maxFs, since there is a fallback already in getDegradedClientRequests)
|
|
161
|
+
var maxFps = mediaRequest.codecInfo.maxFps || CODEC_DEFAULTS.h264.maxFps;
|
|
162
|
+
|
|
163
|
+
// divided by 100 since maxFps is 3000 (for 30 frames per seconds)
|
|
164
|
+
return mediaRequest.codecInfo.maxFs * maxFps / 100;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Clears the previous stream requests.
|
|
169
|
+
*
|
|
170
|
+
* @returns {void}
|
|
171
|
+
*/
|
|
172
|
+
}, {
|
|
173
|
+
key: "clearPreviousRequests",
|
|
174
|
+
value: function clearPreviousRequests() {
|
|
175
|
+
this.previousStreamRequests = [];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Modifies the passed in clientRequests and makes sure that in total they don't ask
|
|
179
|
+
* for more streams than there are available.
|
|
180
|
+
*
|
|
181
|
+
* @param {Object} clientRequests
|
|
182
|
+
* @returns {void}
|
|
183
|
+
*/
|
|
184
|
+
}, {
|
|
185
|
+
key: "trimRequests",
|
|
186
|
+
value: function trimRequests(clientRequests) {
|
|
187
|
+
var preferLiveVideo = this.getPreferLiveVideo();
|
|
188
|
+
if (!this.trimRequestsToNumOfSources) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// preferLiveVideo being undefined means that there are no active-speaker requests so we don't need to do any trimming
|
|
193
|
+
if (preferLiveVideo === undefined) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
var numStreamsAvailable = preferLiveVideo ? this.numLiveSources : this.numTotalSources;
|
|
197
|
+
(0, _values.default)(clientRequests).sort(function (a, b) {
|
|
198
|
+
// we have to count how many streams we're asking for
|
|
199
|
+
// and should not ask for more than numStreamsAvailable in total,
|
|
200
|
+
// so we might need to trim active-speaker requests and first ones to trim should be
|
|
201
|
+
// the ones with lowest priority
|
|
202
|
+
|
|
203
|
+
// receiver-selected requests have priority over active-speakers
|
|
204
|
+
if (a.policyInfo.policy === 'receiver-selected') {
|
|
205
|
+
return -1;
|
|
206
|
+
}
|
|
207
|
+
if (b.policyInfo.policy === 'receiver-selected') {
|
|
208
|
+
return 1;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// and active-speakers are sorted by descending priority
|
|
212
|
+
return b.policyInfo.priority - a.policyInfo.priority;
|
|
213
|
+
}).forEach(function (request) {
|
|
214
|
+
// we only trim active-speaker requests
|
|
215
|
+
if (request.policyInfo.policy === 'active-speaker') {
|
|
216
|
+
var trimmedCount = Math.min(numStreamsAvailable, request.receiveSlots.length);
|
|
217
|
+
request.receiveSlots.length = trimmedCount;
|
|
218
|
+
numStreamsAvailable -= trimmedCount;
|
|
219
|
+
} else {
|
|
220
|
+
numStreamsAvailable -= request.receiveSlots.length;
|
|
221
|
+
}
|
|
222
|
+
if (numStreamsAvailable < 0) {
|
|
223
|
+
numStreamsAvailable = 0;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}, {
|
|
228
|
+
key: "getPreferLiveVideo",
|
|
229
|
+
value: function getPreferLiveVideo() {
|
|
230
|
+
var preferLiveVideo;
|
|
231
|
+
(0, _values.default)(this.clientRequests).forEach(function (mr) {
|
|
232
|
+
if (mr.policyInfo.policy === 'active-speaker') {
|
|
233
|
+
// take the value from first encountered active speaker request
|
|
234
|
+
if (preferLiveVideo === undefined) {
|
|
235
|
+
preferLiveVideo = mr.policyInfo.preferLiveVideo;
|
|
236
|
+
}
|
|
237
|
+
if (mr.policyInfo.preferLiveVideo !== preferLiveVideo) {
|
|
238
|
+
throw new Error('a mix of active-speaker groups with different values for preferLiveVideo is not supported');
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
return preferLiveVideo;
|
|
243
|
+
}
|
|
244
|
+
}, {
|
|
245
|
+
key: "cloneClientRequests",
|
|
246
|
+
value: function cloneClientRequests() {
|
|
247
|
+
// we clone the client requests but without cloning the ReceiveSlots that they reference
|
|
248
|
+
return (0, _cloneDeepWith2.default)(this.clientRequests, function (value, key) {
|
|
249
|
+
if (key === 'receiveSlots') {
|
|
250
|
+
return (0, _toConsumableArray2.default)(value);
|
|
251
|
+
}
|
|
252
|
+
return undefined;
|
|
253
|
+
});
|
|
90
254
|
}
|
|
91
255
|
}, {
|
|
92
256
|
key: "sendRequests",
|
|
93
257
|
value: function sendRequests() {
|
|
94
|
-
var
|
|
95
|
-
var
|
|
96
|
-
var maxPayloadBitsPerSecond = 10 * 1000 * 1000;
|
|
258
|
+
var _this3 = this;
|
|
259
|
+
var streamRequests = [];
|
|
97
260
|
|
|
98
|
-
//
|
|
261
|
+
// clone the requests so that any modifications we do to them don't affect the original ones
|
|
262
|
+
var clientRequests = this.cloneClientRequests();
|
|
263
|
+
this.trimRequests(clientRequests);
|
|
264
|
+
this.getDegradedClientRequests(clientRequests);
|
|
265
|
+
|
|
266
|
+
// map all the client media requests to wcme stream requests
|
|
99
267
|
(0, _values.default)(clientRequests).forEach(function (mr) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
268
|
+
if (mr.receiveSlots.length > 0) {
|
|
269
|
+
streamRequests.push(new _internalMediaCore.StreamRequest(mr.policyInfo.policy === 'active-speaker' ? _internalMediaCore.Policy.ActiveSpeaker : _internalMediaCore.Policy.ReceiverSelected, mr.policyInfo.policy === 'active-speaker' ? new _internalMediaCore.ActiveSpeakerInfo(mr.policyInfo.priority, mr.policyInfo.crossPriorityDuplication, mr.policyInfo.crossPolicyDuplication, mr.policyInfo.preferLiveVideo, mr.policyInfo.namedMediaGroups) : new _internalMediaCore.ReceiverSelectedInfo(mr.policyInfo.csi), mr.receiveSlots.map(function (receiveSlot) {
|
|
270
|
+
return receiveSlot.wcmeReceiveSlot;
|
|
271
|
+
}), _this3.getMaxPayloadBitsPerSecond(mr), mr.codecInfo && [new _internalMediaCore.CodecInfo(0x80, new _internalMediaCore.H264Codec(mr.codecInfo.maxFs, mr.codecInfo.maxFps || CODEC_DEFAULTS.h264.maxFps, _this3.getH264MaxMbps(mr), mr.codecInfo.maxWidth, mr.codecInfo.maxHeight))]));
|
|
272
|
+
}
|
|
103
273
|
});
|
|
104
|
-
|
|
274
|
+
|
|
275
|
+
//! IMPORTANT: this is only a temporary fix. This will soon be done in the jmp layer (@webex/json-multistream)
|
|
276
|
+
// https://jira-eng-gpk2.cisco.com/jira/browse/WEBEX-326713
|
|
277
|
+
if (!this.checkIsNewRequestsEqualToPrev(streamRequests)) {
|
|
278
|
+
this.sendMediaRequestsCallback(streamRequests);
|
|
279
|
+
this.previousStreamRequests = streamRequests;
|
|
280
|
+
_loggerProxy.default.logger.info("multistream:sendRequests --> media requests sent. ");
|
|
281
|
+
} else {
|
|
282
|
+
_loggerProxy.default.logger.info("multistream:sendRequests --> detected duplicate WCME requests, skipping them... ");
|
|
283
|
+
}
|
|
105
284
|
}
|
|
106
285
|
}, {
|
|
107
286
|
key: "addRequest",
|
|
108
287
|
value: function addRequest(mediaRequest) {
|
|
109
|
-
var
|
|
288
|
+
var _this4 = this;
|
|
110
289
|
var commit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
111
290
|
// eslint-disable-next-line no-plusplus
|
|
112
291
|
var newId = "".concat(this.counter++);
|
|
113
292
|
this.clientRequests[newId] = mediaRequest;
|
|
293
|
+
var eventHandler = function eventHandler(_ref) {
|
|
294
|
+
var maxFs = _ref.maxFs;
|
|
295
|
+
mediaRequest.preferredMaxFs = maxFs;
|
|
296
|
+
_this4.debouncedSourceUpdateListener();
|
|
297
|
+
};
|
|
298
|
+
mediaRequest.handleMaxFs = eventHandler;
|
|
114
299
|
mediaRequest.receiveSlots.forEach(function (rs) {
|
|
115
|
-
rs.on(_receiveSlot.ReceiveSlotEvents.SourceUpdate,
|
|
116
|
-
rs.on(_receiveSlot.ReceiveSlotEvents.MaxFsUpdate,
|
|
117
|
-
var maxFs = _ref3.maxFs;
|
|
118
|
-
mediaRequest.preferredMaxFs = maxFs;
|
|
119
|
-
_this2.debouncedSourceUpdateListener();
|
|
120
|
-
});
|
|
300
|
+
rs.on(_receiveSlot.ReceiveSlotEvents.SourceUpdate, _this4.sourceUpdateListener);
|
|
301
|
+
rs.on(_receiveSlot.ReceiveSlotEvents.MaxFsUpdate, mediaRequest.handleMaxFs);
|
|
121
302
|
});
|
|
122
303
|
if (commit) {
|
|
123
304
|
this.commit();
|
|
@@ -127,11 +308,12 @@ var MediaRequestManager = /*#__PURE__*/function () {
|
|
|
127
308
|
}, {
|
|
128
309
|
key: "cancelRequest",
|
|
129
310
|
value: function cancelRequest(requestId) {
|
|
130
|
-
var
|
|
131
|
-
_this3 = this;
|
|
311
|
+
var _this5 = this;
|
|
132
312
|
var commit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
133
|
-
|
|
134
|
-
|
|
313
|
+
var mediaRequest = this.clientRequests[requestId];
|
|
314
|
+
mediaRequest === null || mediaRequest === void 0 ? void 0 : mediaRequest.receiveSlots.forEach(function (rs) {
|
|
315
|
+
rs.off(_receiveSlot.ReceiveSlotEvents.SourceUpdate, _this5.sourceUpdateListener);
|
|
316
|
+
rs.off(_receiveSlot.ReceiveSlotEvents.MaxFsUpdate, mediaRequest.handleMaxFs);
|
|
135
317
|
});
|
|
136
318
|
delete this.clientRequests[requestId];
|
|
137
319
|
if (commit) {
|
|
@@ -147,6 +329,15 @@ var MediaRequestManager = /*#__PURE__*/function () {
|
|
|
147
329
|
key: "reset",
|
|
148
330
|
value: function reset() {
|
|
149
331
|
this.clientRequests = {};
|
|
332
|
+
this.numTotalSources = 0;
|
|
333
|
+
this.numLiveSources = 0;
|
|
334
|
+
}
|
|
335
|
+
}, {
|
|
336
|
+
key: "setNumCurrentSources",
|
|
337
|
+
value: function setNumCurrentSources(numTotalSources, numLiveSources) {
|
|
338
|
+
this.numTotalSources = numTotalSources;
|
|
339
|
+
this.numLiveSources = numLiveSources;
|
|
340
|
+
this.sendRequests();
|
|
150
341
|
}
|
|
151
342
|
}]);
|
|
152
343
|
return MediaRequestManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CODEC_DEFAULTS","h264","maxFs","maxFps","maxMbps","DEBOUNCED_SOURCE_UPDATE_TIME","MediaRequestManager","degradationPreferences","sendMediaRequestsCallback","counter","clientRequests","sourceUpdateListener","commit","bind","debouncedSourceUpdateListener","sendRequests","maxFsLimits","getMaxFs","totalMacroblocksRequested","forEach","id","mr","codecInfo","Math","min","preferredMaxFs","i","slotsWithLiveSource","receiveSlots","filter","rs","sourceState","length","maxMacroblocksLimit","LoggerProxy","logger","warn","wcmeMediaRequests","getDegradedClientRequests","maxPayloadBitsPerSecond","push","WcmeMediaRequest","policyInfo","policy","Policy","ActiveSpeaker","ReceiverSelected","ActiveSpeakerInfo","priority","crossPriorityDuplication","crossPolicyDuplication","preferLiveVideo","ReceiverSelectedInfo","csi","map","receiveSlot","wcmeReceiveSlot","WcmeCodecInfo","H264Codec","maxWidth","maxHeight","mediaRequest","newId","on","ReceiveSlotEvents","SourceUpdate","MaxFsUpdate","requestId","off"],"sources":["mediaRequestManager.ts"],"sourcesContent":["/* eslint-disable require-jsdoc */\nimport {\n MediaRequest as WcmeMediaRequest,\n Policy,\n ActiveSpeakerInfo,\n ReceiverSelectedInfo,\n CodecInfo as WcmeCodecInfo,\n H264Codec,\n} from '@webex/internal-media-core';\nimport {cloneDeep, debounce} from 'lodash';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nimport {ReceiveSlot, ReceiveSlotEvents, ReceiveSlotId} from './receiveSlot';\nimport {getMaxFs} from './remoteMedia';\n\nexport interface ActiveSpeakerPolicyInfo {\n policy: 'active-speaker';\n priority: number;\n crossPriorityDuplication: boolean;\n crossPolicyDuplication: boolean;\n preferLiveVideo: boolean;\n}\n\nexport interface ReceiverSelectedPolicyInfo {\n policy: 'receiver-selected';\n csi: number;\n}\n\nexport type PolicyInfo = ActiveSpeakerPolicyInfo | ReceiverSelectedPolicyInfo;\n\nexport interface H264CodecInfo {\n codec: 'h264';\n maxFs?: number;\n maxFps?: number;\n maxMbps?: number;\n maxWidth?: number;\n maxHeight?: number;\n}\n\nexport type CodecInfo = H264CodecInfo; // we'll add AV1 here in the future when it's available\n\nexport interface MediaRequest {\n policyInfo: PolicyInfo;\n receiveSlots: Array<ReceiveSlot>;\n codecInfo?: CodecInfo;\n preferredMaxFs?: number;\n}\n\nexport type MediaRequestId = string;\n\nconst CODEC_DEFAULTS = {\n h264: {\n maxFs: 8192,\n maxFps: 3000,\n maxMbps: 245760,\n },\n};\n\nconst DEBOUNCED_SOURCE_UPDATE_TIME = 1000;\n\ntype DegradationPreferences = {\n maxMacroblocksLimit: number;\n};\n\ntype SendMediaRequestsCallback = (mediaRequests: WcmeMediaRequest[]) => void;\n\nexport class MediaRequestManager {\n private sendMediaRequestsCallback: SendMediaRequestsCallback;\n\n private counter: number;\n\n private clientRequests: {[key: MediaRequestId]: MediaRequest};\n\n private degradationPreferences: DegradationPreferences;\n\n private sourceUpdateListener: () => void;\n\n private debouncedSourceUpdateListener: () => void;\n\n constructor(\n degradationPreferences: DegradationPreferences,\n sendMediaRequestsCallback: SendMediaRequestsCallback\n ) {\n this.sendMediaRequestsCallback = sendMediaRequestsCallback;\n this.counter = 0;\n this.clientRequests = {};\n this.degradationPreferences = degradationPreferences;\n this.sourceUpdateListener = this.commit.bind(this);\n this.debouncedSourceUpdateListener = debounce(\n this.sourceUpdateListener,\n DEBOUNCED_SOURCE_UPDATE_TIME\n );\n }\n\n public setDegradationPreferences(degradationPreferences: DegradationPreferences) {\n this.degradationPreferences = degradationPreferences;\n this.sendRequests(); // re-send requests after preferences are set\n }\n\n private getDegradedClientRequests() {\n const clientRequests = cloneDeep(this.clientRequests);\n const maxFsLimits = [\n getMaxFs('best'),\n getMaxFs('large'),\n getMaxFs('medium'),\n getMaxFs('small'),\n getMaxFs('very small'),\n getMaxFs('thumbnail'),\n ];\n\n // reduce max-fs until total macroblocks is below limit\n for (let i = 0; i < maxFsLimits.length; i += 1) {\n let totalMacroblocksRequested = 0;\n Object.entries(clientRequests).forEach(([id, mr]) => {\n if (mr.codecInfo) {\n mr.codecInfo.maxFs = Math.min(\n mr.preferredMaxFs || CODEC_DEFAULTS.h264.maxFs,\n mr.codecInfo.maxFs || CODEC_DEFAULTS.h264.maxFs,\n maxFsLimits[i]\n );\n // we only consider sources with \"live\" state\n const slotsWithLiveSource = this.clientRequests[id].receiveSlots.filter(\n (rs) => rs.sourceState === 'live'\n );\n totalMacroblocksRequested += mr.codecInfo.maxFs * slotsWithLiveSource.length;\n }\n });\n if (totalMacroblocksRequested <= this.degradationPreferences.maxMacroblocksLimit) {\n if (i !== 0) {\n LoggerProxy.logger.warn(\n `multistream:mediaRequestManager --> too many streams with high max-fs, frame size will be limited to ${maxFsLimits[i]}`\n );\n }\n break;\n } else if (i === maxFsLimits.length - 1) {\n LoggerProxy.logger.warn(\n `multistream:mediaRequestManager --> even with frame size limited to ${maxFsLimits[i]} you are still requesting too many streams, consider reducing the number of requests`\n );\n }\n }\n\n return clientRequests;\n }\n\n private sendRequests() {\n const wcmeMediaRequests: WcmeMediaRequest[] = [];\n\n const clientRequests = this.getDegradedClientRequests();\n const maxPayloadBitsPerSecond = 10 * 1000 * 1000;\n\n // map all the client media requests to wcme media requests\n Object.values(clientRequests).forEach((mr) => {\n wcmeMediaRequests.push(\n new WcmeMediaRequest(\n mr.policyInfo.policy === 'active-speaker'\n ? Policy.ActiveSpeaker\n : Policy.ReceiverSelected,\n mr.policyInfo.policy === 'active-speaker'\n ? new ActiveSpeakerInfo(\n mr.policyInfo.priority,\n mr.policyInfo.crossPriorityDuplication,\n mr.policyInfo.crossPolicyDuplication,\n mr.policyInfo.preferLiveVideo\n )\n : new ReceiverSelectedInfo(mr.policyInfo.csi),\n mr.receiveSlots.map((receiveSlot) => receiveSlot.wcmeReceiveSlot),\n maxPayloadBitsPerSecond,\n mr.codecInfo && [\n new WcmeCodecInfo(\n 0x80,\n new H264Codec(\n mr.codecInfo.maxFs,\n mr.codecInfo.maxFps || CODEC_DEFAULTS.h264.maxFps,\n mr.codecInfo.maxMbps || CODEC_DEFAULTS.h264.maxMbps,\n mr.codecInfo.maxWidth,\n mr.codecInfo.maxHeight\n )\n ),\n ]\n )\n );\n });\n\n this.sendMediaRequestsCallback(wcmeMediaRequests);\n }\n\n public addRequest(mediaRequest: MediaRequest, commit = true): MediaRequestId {\n // eslint-disable-next-line no-plusplus\n const newId = `${this.counter++}`;\n\n this.clientRequests[newId] = mediaRequest;\n\n mediaRequest.receiveSlots.forEach((rs) => {\n rs.on(ReceiveSlotEvents.SourceUpdate, this.sourceUpdateListener);\n rs.on(ReceiveSlotEvents.MaxFsUpdate, ({maxFs}) => {\n mediaRequest.preferredMaxFs = maxFs;\n this.debouncedSourceUpdateListener();\n });\n });\n\n if (commit) {\n this.commit();\n }\n\n return newId;\n }\n\n public cancelRequest(requestId: MediaRequestId, commit = true) {\n this.clientRequests[requestId]?.receiveSlots.forEach((rs) => {\n rs.off(ReceiveSlotEvents.SourceUpdate, this.sourceUpdateListener);\n });\n\n delete this.clientRequests[requestId];\n\n if (commit) {\n this.commit();\n }\n }\n\n public commit() {\n return this.sendRequests();\n }\n\n public reset() {\n this.clientRequests = {};\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;AAUA;AAEA;AACA;AAdA;;AAmDA,IAAMA,cAAc,GAAG;EACrBC,IAAI,EAAE;IACJC,KAAK,EAAE,IAAI;IACXC,MAAM,EAAE,IAAI;IACZC,OAAO,EAAE;EACX;AACF,CAAC;AAED,IAAMC,4BAA4B,GAAG,IAAI;AAAC,IAQ7BC,mBAAmB;EAa9B,6BACEC,sBAA8C,EAC9CC,yBAAoD,EACpD;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IACA,IAAI,CAACA,yBAAyB,GAAGA,yBAAyB;IAC1D,IAAI,CAACC,OAAO,GAAG,CAAC;IAChB,IAAI,CAACC,cAAc,GAAG,CAAC,CAAC;IACxB,IAAI,CAACH,sBAAsB,GAAGA,sBAAsB;IACpD,IAAI,CAACI,oBAAoB,GAAG,IAAI,CAACC,MAAM,CAACC,IAAI,CAAC,IAAI,CAAC;IAClD,IAAI,CAACC,6BAA6B,GAAG,wBACnC,IAAI,CAACH,oBAAoB,EACzBN,4BAA4B,CAC7B;EACH;EAAC;IAAA;IAAA,OAED,mCAAiCE,sBAA8C,EAAE;MAC/E,IAAI,CAACA,sBAAsB,GAAGA,sBAAsB;MACpD,IAAI,CAACQ,YAAY,EAAE,CAAC,CAAC;IACvB;EAAC;IAAA;IAAA,OAED,qCAAoC;MAAA;MAClC,IAAML,cAAc,GAAG,yBAAU,IAAI,CAACA,cAAc,CAAC;MACrD,IAAMM,WAAW,GAAG,CAClB,IAAAC,qBAAQ,EAAC,MAAM,CAAC,EAChB,IAAAA,qBAAQ,EAAC,OAAO,CAAC,EACjB,IAAAA,qBAAQ,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AAM,EAAE;QACV,IAAI,CAACA,MAAM,EAAE;MACf;IACF;EAAC;IAAA;IAAA,OAED,kBAAgB;MACd,OAAO,IAAI,CAACG,YAAY,EAAE;IAC5B;EAAC;IAAA;IAAA,OAED,iBAAe;MACb,IAAI,CAACL,cAAc,GAAG,CAAC,CAAC;IAC1B;EAAC;EAAA;AAAA;AAAA"}
|
|
1
|
+
{"version":3,"names":["CODEC_DEFAULTS","h264","maxFs","maxFps","maxMbps","DEBOUNCED_SOURCE_UPDATE_TIME","MediaRequestManager","sendMediaRequestsCallback","options","counter","numLiveSources","numTotalSources","clientRequests","degradationPreferences","kind","trimRequestsToNumOfSources","sourceUpdateListener","commit","bind","debouncedSourceUpdateListener","sendRequests","maxFsLimits","getMaxFs","totalMacroblocksRequested","forEach","mr","codecInfo","Math","min","preferredMaxFs","i","slotsWithLiveSource","receiveSlots","filter","rs","sourceState","length","maxMacroblocksLimit","LoggerProxy","logger","warn","streamRequestA","streamRequestB","_toJmpStreamRequest","newRequests","previousStreamRequests","every","req","idx","isEqual","mediaRequest","RecommendedOpusBitrates","FB_MONO_MUSIC","getRecommendedMaxBitrateForFrameSize","preferLiveVideo","getPreferLiveVideo","undefined","numStreamsAvailable","sort","a","b","policyInfo","policy","priority","request","trimmedCount","Error","value","key","streamRequests","cloneClientRequests","trimRequests","getDegradedClientRequests","push","StreamRequest","Policy","ActiveSpeaker","ReceiverSelected","ActiveSpeakerInfo","crossPriorityDuplication","crossPolicyDuplication","namedMediaGroups","ReceiverSelectedInfo","csi","map","receiveSlot","wcmeReceiveSlot","getMaxPayloadBitsPerSecond","WcmeCodecInfo","H264Codec","getH264MaxMbps","maxWidth","maxHeight","checkIsNewRequestsEqualToPrev","info","newId","eventHandler","handleMaxFs","on","ReceiveSlotEvents","SourceUpdate","MaxFsUpdate","requestId","off"],"sources":["mediaRequestManager.ts"],"sourcesContent":["/* eslint-disable require-jsdoc */\nimport {\n StreamRequest,\n Policy,\n ActiveSpeakerInfo,\n ReceiverSelectedInfo,\n CodecInfo as WcmeCodecInfo,\n H264Codec,\n getRecommendedMaxBitrateForFrameSize,\n RecommendedOpusBitrates,\n} from '@webex/internal-media-core';\nimport {cloneDeepWith, debounce, isEmpty} from 'lodash';\n\nimport {NamedMediaGroup} from '@webex/json-multistream';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nimport {ReceiveSlot, ReceiveSlotEvents} from './receiveSlot';\nimport {getMaxFs} from './remoteMedia';\n\nexport interface ActiveSpeakerPolicyInfo {\n policy: 'active-speaker';\n priority: number;\n crossPriorityDuplication: boolean;\n crossPolicyDuplication: boolean;\n preferLiveVideo: boolean;\n namedMediaGroups?: NamedMediaGroup[];\n}\n\nexport interface ReceiverSelectedPolicyInfo {\n policy: 'receiver-selected';\n csi: number;\n}\n\nexport type PolicyInfo = ActiveSpeakerPolicyInfo | ReceiverSelectedPolicyInfo;\n\nexport interface H264CodecInfo {\n codec: 'h264';\n maxFs?: number;\n maxFps?: number;\n maxMbps?: number;\n maxWidth?: number;\n maxHeight?: number;\n}\n\nexport type CodecInfo = H264CodecInfo; // we'll add AV1 here in the future when it's available\n\nexport interface MediaRequest {\n policyInfo: PolicyInfo;\n receiveSlots: Array<ReceiveSlot>;\n codecInfo?: CodecInfo;\n preferredMaxFs?: number;\n handleMaxFs?: ({maxFs}: {maxFs: number}) => void;\n}\n\nexport type MediaRequestId = string;\n\nconst CODEC_DEFAULTS = {\n h264: {\n maxFs: 8192,\n maxFps: 3000,\n maxMbps: 245760,\n },\n};\n\nconst DEBOUNCED_SOURCE_UPDATE_TIME = 1000;\n\ntype DegradationPreferences = {\n maxMacroblocksLimit: number;\n};\n\ntype SendMediaRequestsCallback = (streamRequests: StreamRequest[]) => void;\ntype Kind = 'audio' | 'video';\n\ntype Options = {\n degradationPreferences: DegradationPreferences;\n kind: Kind;\n trimRequestsToNumOfSources: boolean; // if enabled, AS speaker requests will be trimmed based on the calls to setNumCurrentSources()\n};\n\ntype ClientRequestsMap = {[key: MediaRequestId]: MediaRequest};\n\nexport class MediaRequestManager {\n private sendMediaRequestsCallback: SendMediaRequestsCallback;\n\n private kind: Kind;\n\n private counter: number;\n\n private clientRequests: ClientRequestsMap;\n\n private degradationPreferences: DegradationPreferences;\n\n private sourceUpdateListener: () => void;\n\n private debouncedSourceUpdateListener: () => void;\n\n private previousStreamRequests: Array<StreamRequest> = [];\n\n private trimRequestsToNumOfSources: boolean;\n private numTotalSources: number;\n private numLiveSources: number;\n\n constructor(sendMediaRequestsCallback: SendMediaRequestsCallback, options: Options) {\n this.sendMediaRequestsCallback = sendMediaRequestsCallback;\n this.counter = 0;\n this.numLiveSources = 0;\n this.numTotalSources = 0;\n this.clientRequests = {};\n this.degradationPreferences = options.degradationPreferences;\n this.kind = options.kind;\n this.trimRequestsToNumOfSources = options.trimRequestsToNumOfSources;\n this.sourceUpdateListener = this.commit.bind(this);\n this.debouncedSourceUpdateListener = debounce(\n this.sourceUpdateListener,\n DEBOUNCED_SOURCE_UPDATE_TIME\n );\n }\n\n public setDegradationPreferences(degradationPreferences: DegradationPreferences) {\n this.degradationPreferences = degradationPreferences;\n this.sendRequests(); // re-send requests after preferences are set\n }\n\n private getDegradedClientRequests(clientRequests: ClientRequestsMap) {\n const maxFsLimits = [\n getMaxFs('best'),\n getMaxFs('large'),\n getMaxFs('medium'),\n getMaxFs('small'),\n getMaxFs('very small'),\n getMaxFs('thumbnail'),\n ];\n\n // reduce max-fs until total macroblocks is below limit\n for (let i = 0; i < maxFsLimits.length; i += 1) {\n let totalMacroblocksRequested = 0;\n Object.values(clientRequests).forEach((mr) => {\n if (mr.codecInfo) {\n mr.codecInfo.maxFs = Math.min(\n mr.preferredMaxFs || CODEC_DEFAULTS.h264.maxFs,\n mr.codecInfo.maxFs || CODEC_DEFAULTS.h264.maxFs,\n maxFsLimits[i]\n );\n // we only consider sources with \"live\" state\n const slotsWithLiveSource = mr.receiveSlots.filter((rs) => rs.sourceState === 'live');\n totalMacroblocksRequested += mr.codecInfo.maxFs * slotsWithLiveSource.length;\n }\n });\n if (totalMacroblocksRequested <= this.degradationPreferences.maxMacroblocksLimit) {\n if (i !== 0) {\n LoggerProxy.logger.warn(\n `multistream:mediaRequestManager --> too many streams with high max-fs, frame size will be limited to ${maxFsLimits[i]}`\n );\n }\n break;\n } else if (i === maxFsLimits.length - 1) {\n LoggerProxy.logger.warn(\n `multistream:mediaRequestManager --> even with frame size limited to ${maxFsLimits[i]} you are still requesting too many streams, consider reducing the number of requests`\n );\n }\n }\n }\n\n /**\n * Returns true if two stream requests are the same, false otherwise.\n *\n * @param {StreamRequest} streamRequestA - Stream request A for comparison.\n * @param {StreamRequest} streamRequestB - Stream request B for comparison.\n * @returns {boolean} - Whether they are equal.\n */\n // eslint-disable-next-line class-methods-use-this\n public isEqual(streamRequestA: StreamRequest, streamRequestB: StreamRequest) {\n return (\n JSON.stringify(streamRequestA._toJmpStreamRequest()) ===\n JSON.stringify(streamRequestB._toJmpStreamRequest())\n );\n }\n\n /**\n * Compares new stream requests to previous ones and determines\n * if they are the same.\n *\n * @param {StreamRequest[]} newRequests - Array with new requests.\n * @returns {boolean} - True if they are equal, false otherwise.\n */\n private checkIsNewRequestsEqualToPrev(newRequests: StreamRequest[]) {\n return (\n !isEmpty(this.previousStreamRequests) &&\n this.previousStreamRequests.length === newRequests.length &&\n this.previousStreamRequests.every((req, idx) => this.isEqual(req, newRequests[idx]))\n );\n }\n\n /**\n * Returns the maxPayloadBitsPerSecond per Stream\n *\n * If MediaRequestManager kind is \"audio\", a constant bitrate will be returned.\n * If MediaRequestManager kind is \"video\", the bitrate will be calculated based\n * on maxFs (default h264 maxFs as fallback if maxFs is not defined)\n *\n * @param {MediaRequest} mediaRequest - mediaRequest to take data from\n * @returns {number} maxPayloadBitsPerSecond\n */\n private getMaxPayloadBitsPerSecond(mediaRequest: MediaRequest): number {\n if (this.kind === 'audio') {\n // return mono_music bitrate default if the kind of mediarequest manager is audio:\n return RecommendedOpusBitrates.FB_MONO_MUSIC;\n }\n\n return getRecommendedMaxBitrateForFrameSize(\n mediaRequest.codecInfo.maxFs || CODEC_DEFAULTS.h264.maxFs\n );\n }\n\n /**\n * Returns the max Macro Blocks per second (maxMbps) per H264 Stream\n *\n * The maxMbps will be calculated based on maxFs and maxFps\n * (default h264 maxFps as fallback if maxFps is not defined)\n *\n * @param {MediaRequest} mediaRequest - mediaRequest to take data from\n * @returns {number} maxMbps\n */\n // eslint-disable-next-line class-methods-use-this\n private getH264MaxMbps(mediaRequest: MediaRequest): number {\n // fallback for maxFps (not needed for maxFs, since there is a fallback already in getDegradedClientRequests)\n const maxFps = mediaRequest.codecInfo.maxFps || CODEC_DEFAULTS.h264.maxFps;\n\n // divided by 100 since maxFps is 3000 (for 30 frames per seconds)\n return (mediaRequest.codecInfo.maxFs * maxFps) / 100;\n }\n\n /**\n * Clears the previous stream requests.\n *\n * @returns {void}\n */\n public clearPreviousRequests(): void {\n this.previousStreamRequests = [];\n }\n\n /** Modifies the passed in clientRequests and makes sure that in total they don't ask\n * for more streams than there are available.\n *\n * @param {Object} clientRequests\n * @returns {void}\n */\n private trimRequests(clientRequests: ClientRequestsMap) {\n const preferLiveVideo = this.getPreferLiveVideo();\n\n if (!this.trimRequestsToNumOfSources) {\n return;\n }\n\n // preferLiveVideo being undefined means that there are no active-speaker requests so we don't need to do any trimming\n if (preferLiveVideo === undefined) {\n return;\n }\n\n let numStreamsAvailable = preferLiveVideo ? this.numLiveSources : this.numTotalSources;\n\n Object.values(clientRequests)\n .sort((a, b) => {\n // we have to count how many streams we're asking for\n // and should not ask for more than numStreamsAvailable in total,\n // so we might need to trim active-speaker requests and first ones to trim should be\n // the ones with lowest priority\n\n // receiver-selected requests have priority over active-speakers\n if (a.policyInfo.policy === 'receiver-selected') {\n return -1;\n }\n if (b.policyInfo.policy === 'receiver-selected') {\n return 1;\n }\n\n // and active-speakers are sorted by descending priority\n return b.policyInfo.priority - a.policyInfo.priority;\n })\n .forEach((request) => {\n // we only trim active-speaker requests\n if (request.policyInfo.policy === 'active-speaker') {\n const trimmedCount = Math.min(numStreamsAvailable, request.receiveSlots.length);\n\n request.receiveSlots.length = trimmedCount;\n\n numStreamsAvailable -= trimmedCount;\n } else {\n numStreamsAvailable -= request.receiveSlots.length;\n }\n\n if (numStreamsAvailable < 0) {\n numStreamsAvailable = 0;\n }\n });\n }\n\n private getPreferLiveVideo(): boolean | undefined {\n let preferLiveVideo;\n\n Object.values(this.clientRequests).forEach((mr) => {\n if (mr.policyInfo.policy === 'active-speaker') {\n // take the value from first encountered active speaker request\n if (preferLiveVideo === undefined) {\n preferLiveVideo = mr.policyInfo.preferLiveVideo;\n }\n\n if (mr.policyInfo.preferLiveVideo !== preferLiveVideo) {\n throw new Error(\n 'a mix of active-speaker groups with different values for preferLiveVideo is not supported'\n );\n }\n }\n });\n\n return preferLiveVideo;\n }\n\n private cloneClientRequests(): ClientRequestsMap {\n // we clone the client requests but without cloning the ReceiveSlots that they reference\n return cloneDeepWith(this.clientRequests, (value, key) => {\n if (key === 'receiveSlots') {\n return [...value];\n }\n\n return undefined;\n });\n }\n\n private sendRequests() {\n const streamRequests: StreamRequest[] = [];\n\n // clone the requests so that any modifications we do to them don't affect the original ones\n const clientRequests = this.cloneClientRequests();\n\n this.trimRequests(clientRequests);\n this.getDegradedClientRequests(clientRequests);\n\n // map all the client media requests to wcme stream requests\n Object.values(clientRequests).forEach((mr) => {\n if (mr.receiveSlots.length > 0) {\n streamRequests.push(\n new StreamRequest(\n mr.policyInfo.policy === 'active-speaker'\n ? Policy.ActiveSpeaker\n : Policy.ReceiverSelected,\n mr.policyInfo.policy === 'active-speaker'\n ? new ActiveSpeakerInfo(\n mr.policyInfo.priority,\n mr.policyInfo.crossPriorityDuplication,\n mr.policyInfo.crossPolicyDuplication,\n mr.policyInfo.preferLiveVideo,\n mr.policyInfo.namedMediaGroups\n )\n : new ReceiverSelectedInfo(mr.policyInfo.csi),\n mr.receiveSlots.map((receiveSlot) => receiveSlot.wcmeReceiveSlot),\n this.getMaxPayloadBitsPerSecond(mr),\n mr.codecInfo && [\n new WcmeCodecInfo(\n 0x80,\n new H264Codec(\n mr.codecInfo.maxFs,\n mr.codecInfo.maxFps || CODEC_DEFAULTS.h264.maxFps,\n this.getH264MaxMbps(mr),\n mr.codecInfo.maxWidth,\n mr.codecInfo.maxHeight\n )\n ),\n ]\n )\n );\n }\n });\n\n //! IMPORTANT: this is only a temporary fix. This will soon be done in the jmp layer (@webex/json-multistream)\n // https://jira-eng-gpk2.cisco.com/jira/browse/WEBEX-326713\n if (!this.checkIsNewRequestsEqualToPrev(streamRequests)) {\n this.sendMediaRequestsCallback(streamRequests);\n this.previousStreamRequests = streamRequests;\n LoggerProxy.logger.info(`multistream:sendRequests --> media requests sent. `);\n } else {\n LoggerProxy.logger.info(\n `multistream:sendRequests --> detected duplicate WCME requests, skipping them... `\n );\n }\n }\n\n public addRequest(mediaRequest: MediaRequest, commit = true): MediaRequestId {\n // eslint-disable-next-line no-plusplus\n const newId = `${this.counter++}`;\n\n this.clientRequests[newId] = mediaRequest;\n\n const eventHandler = ({maxFs}) => {\n mediaRequest.preferredMaxFs = maxFs;\n this.debouncedSourceUpdateListener();\n };\n mediaRequest.handleMaxFs = eventHandler;\n\n mediaRequest.receiveSlots.forEach((rs) => {\n rs.on(ReceiveSlotEvents.SourceUpdate, this.sourceUpdateListener);\n rs.on(ReceiveSlotEvents.MaxFsUpdate, mediaRequest.handleMaxFs);\n });\n\n if (commit) {\n this.commit();\n }\n\n return newId;\n }\n\n public cancelRequest(requestId: MediaRequestId, commit = true) {\n const mediaRequest = this.clientRequests[requestId];\n\n mediaRequest?.receiveSlots.forEach((rs) => {\n rs.off(ReceiveSlotEvents.SourceUpdate, this.sourceUpdateListener);\n rs.off(ReceiveSlotEvents.MaxFsUpdate, mediaRequest.handleMaxFs);\n });\n\n delete this.clientRequests[requestId];\n\n if (commit) {\n this.commit();\n }\n }\n\n public commit() {\n return this.sendRequests();\n }\n\n public reset() {\n this.clientRequests = {};\n this.numTotalSources = 0;\n this.numLiveSources = 0;\n }\n\n public setNumCurrentSources(numTotalSources: number, numLiveSources: number) {\n this.numTotalSources = numTotalSources;\n this.numLiveSources = numLiveSources;\n\n this.sendRequests();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;AAaA;AAEA;AACA;AAjBA;;AAwDA,IAAMA,cAAc,GAAG;EACrBC,IAAI,EAAE;IACJC,KAAK,EAAE,IAAI;IACXC,MAAM,EAAE,IAAI;IACZC,OAAO,EAAE;EACX;AACF,CAAC;AAED,IAAMC,4BAA4B,GAAG,IAAI;AAAC,IAiB7BC,mBAAmB;EAqB9B,6BAAYC,yBAAoD,EAAEC,OAAgB,EAAE;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA,8DAN7B,EAAE;IAAA;IAAA;IAAA;IAOvD,IAAI,CAACD,yBAAyB,GAAGA,yBAAyB;IAC1D,IAAI,CAACE,OAAO,GAAG,CAAC;IAChB,IAAI,CAACC,cAAc,GAAG,CAAC;IACvB,IAAI,CAACC,eAAe,GAAG,CAAC;IACxB,IAAI,CAACC,cAAc,GAAG,CAAC,CAAC;IACxB,IAAI,CAACC,sBAAsB,GAAGL,OAAO,CAACK,sBAAsB;IAC5D,IAAI,CAACC,IAAI,GAAGN,OAAO,CAACM,IAAI;IACxB,IAAI,CAACC,0BAA0B,GAAGP,OAAO,CAACO,0BAA0B;IACpE,IAAI,CAACC,oBAAoB,GAAG,IAAI,CAACC,MAAM,CAACC,IAAI,CAAC,IAAI,CAAC;IAClD,IAAI,CAACC,6BAA6B,GAAG,wBACnC,IAAI,CAACH,oBAAoB,EACzBX,4BAA4B,CAC7B;EACH;EAAC;IAAA;IAAA,OAED,mCAAiCQ,sBAA8C,EAAE;MAC/E,IAAI,CAACA,sBAAsB,GAAGA,sBAAsB;MACpD,IAAI,CAACO,YAAY,EAAE,CAAC,CAAC;IACvB;EAAC;IAAA;IAAA,OAED,mCAAkCR,cAAiC,EAAE;MAAA;MACnE,IAAMS,WA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,8BAAiB,CAACE,WAAW,EAAEnD,YAAY,CAAC+C,WAAW,CAAC;MACjE,CAAC,CAAC;MAEF,OAAO,IAAI,CAACrF,cAAc,CAAC0F,SAAS,CAAC;MAErC,IAAIrF,MAAM,EAAE;QACV,IAAI,CAACA,MAAM,EAAE;MACf;IACF;EAAC;IAAA;IAAA,OAED,kBAAgB;MACd,OAAO,IAAI,CAACG,YAAY,EAAE;IAC5B;EAAC;IAAA;IAAA,OAED,iBAAe;MACb,IAAI,CAACR,cAAc,GAAG,CAAC,CAAC;MACxB,IAAI,CAACD,eAAe,GAAG,CAAC;MACxB,IAAI,CAACD,cAAc,GAAG,CAAC;IACzB;EAAC;IAAA;IAAA,OAED,8BAA4BC,eAAuB,EAAED,cAAsB,EAAE;MAC3E,IAAI,CAACC,eAAe,GAAGA,eAAe;MACtC,IAAI,CAACD,cAAc,GAAGA,cAAc;MAEpC,IAAI,CAACU,YAAY,EAAE;IACrB;EAAC;EAAA;AAAA;AAAA"}
|
|
@@ -7,6 +7,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.ReceiveSlotEvents = exports.ReceiveSlot = void 0;
|
|
10
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
10
11
|
var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
|
|
11
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
12
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
@@ -166,6 +167,15 @@ var ReceiveSlot = /*#__PURE__*/function (_EventsScope) {
|
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
169
|
|
|
170
|
+
/**
|
|
171
|
+
* @returns {string} a log message used to identify the receive slot
|
|
172
|
+
*/
|
|
173
|
+
}, {
|
|
174
|
+
key: "logString",
|
|
175
|
+
get: function get() {
|
|
176
|
+
return "ReceiveSlot - ".concat(this.id, ": ").concat((0, _stringify.default)(this.mcReceiveSlot.id));
|
|
177
|
+
}
|
|
178
|
+
|
|
169
179
|
/**
|
|
170
180
|
* The MediaStream object associated with this slot.
|
|
171
181
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ReceiveSlotEvents","SourceUpdate","MaxFsUpdate","receiveSlotCounter","ReceiveSlot","mediaType","mcReceiveSlot","findMemberIdCallback","id","setupEventListeners","newFs","emit","file","function","maxFs","scope","on","WcmeReceiveSlotEvents","state","csi","LoggerProxy","logger","log","undefined","memberId","stream","EventsScope"],"sources":["receiveSlot.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {\n MediaType,\n ReceiveSlot as WcmeReceiveSlot,\n ReceiveSlotEvents as WcmeReceiveSlotEvents,\n
|
|
1
|
+
{"version":3,"names":["ReceiveSlotEvents","SourceUpdate","MaxFsUpdate","receiveSlotCounter","ReceiveSlot","mediaType","mcReceiveSlot","findMemberIdCallback","id","setupEventListeners","newFs","emit","file","function","maxFs","scope","on","WcmeReceiveSlotEvents","state","csi","LoggerProxy","logger","log","undefined","memberId","stream","EventsScope"],"sources":["receiveSlot.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {\n MediaType,\n ReceiveSlot as WcmeReceiveSlot,\n ReceiveSlotEvents as WcmeReceiveSlotEvents,\n StreamState,\n} from '@webex/internal-media-core';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport EventsScope from '../common/events/events-scope';\n\nexport const ReceiveSlotEvents = {\n SourceUpdate: 'sourceUpdate',\n MaxFsUpdate: 'maxFsUpdate',\n};\n\nexport type {StreamState} from '@webex/internal-media-core';\nexport type CSI = number;\nexport type MemberId = string;\nexport type ReceiveSlotId = string;\n\nlet receiveSlotCounter = 0;\n\nexport type FindMemberIdCallback = (csi: CSI) => MemberId | undefined;\n\n/**\n * Class representing a receive slot. A single receive slot is able to receive a single track\n * for example some participant's main video or audio\n */\nexport class ReceiveSlot extends EventsScope {\n private readonly mcReceiveSlot: WcmeReceiveSlot;\n\n private readonly findMemberIdCallback: FindMemberIdCallback;\n\n public readonly id: ReceiveSlotId;\n\n public readonly mediaType: MediaType;\n\n #memberId?: MemberId;\n\n #csi?: CSI;\n\n #sourceState: StreamState;\n\n /**\n * constructor - don't use it directly, you should always use meeting.receiveSlotManager.allocateSlot()\n * to create any receive slots\n *\n * @param {MediaType} mediaType\n * @param {ReceiveSlot} mcReceiveSlot\n * @param {FindMemberIdCallback} findMemberIdCallback callback for finding memberId for given CSI\n */\n constructor(\n mediaType: MediaType,\n mcReceiveSlot: WcmeReceiveSlot,\n findMemberIdCallback: FindMemberIdCallback\n ) {\n super();\n\n receiveSlotCounter += 1;\n\n this.findMemberIdCallback = findMemberIdCallback;\n this.mediaType = mediaType;\n this.mcReceiveSlot = mcReceiveSlot;\n this.#sourceState = 'no source';\n this.id = `r${receiveSlotCounter}`;\n\n this.setupEventListeners();\n }\n\n /**\n * Getter for memberId\n */\n public get memberId() {\n return this.#memberId;\n }\n\n /**\n * Getter for csi\n */\n public get csi() {\n return this.#csi;\n }\n\n /**\n * Set the max frame size for this slot\n * @param newFs frame size\n */\n public setMaxFs(newFs) {\n // emit event for media request manager to listen to\n\n this.emit(\n {\n file: 'meeting/receiveSlot',\n function: 'findMemberId',\n },\n ReceiveSlotEvents.MaxFsUpdate,\n {\n maxFs: newFs,\n }\n );\n }\n\n /**\n * Getter for sourceState\n */\n public get sourceState() {\n return this.#sourceState;\n }\n\n /**\n * registers event handlers with the underlying ReceiveSlot\n */\n private setupEventListeners() {\n const scope = {\n file: 'meeting/receiveSlot',\n function: 'setupEventListeners',\n };\n\n this.mcReceiveSlot.on(\n WcmeReceiveSlotEvents.SourceUpdate,\n (state: StreamState, csi?: number) => {\n LoggerProxy.logger.log(\n `ReceiveSlot#setupEventListeners --> got source update on receive slot ${this.id}, mediaType=${this.mediaType}, csi=${csi}, state=${state}`\n );\n this.#memberId = csi ? this.findMemberIdCallback(csi) : undefined;\n this.#csi = csi;\n this.#sourceState = state;\n\n this.emit(scope, ReceiveSlotEvents.SourceUpdate, {\n state: this.#sourceState,\n csi: this.#csi,\n memberId: this.#memberId,\n });\n }\n );\n }\n\n /** Tries to find the member id for this receive slot if it hasn't got one */\n public findMemberId() {\n if (this.#memberId === undefined && this.#csi) {\n this.#memberId = this.findMemberIdCallback(this.#csi);\n\n if (this.#memberId) {\n // if we found the memberId, simulate source update so that the client app knows that something's changed\n this.emit(\n {\n file: 'meeting/receiveSlot',\n function: 'findMemberId',\n },\n ReceiveSlotEvents.SourceUpdate,\n {\n state: this.#sourceState,\n csi: this.#csi,\n memberId: this.#memberId,\n }\n );\n }\n }\n }\n\n /**\n * @returns {string} a log message used to identify the receive slot\n */\n public get logString() {\n return `ReceiveSlot - ${this.id}: ${JSON.stringify(this.mcReceiveSlot.id)}`;\n }\n\n /**\n * The MediaStream object associated with this slot.\n *\n * @returns {MediaStream} The MediaStreamTrack.\n */\n get stream(): MediaStream {\n return this.mcReceiveSlot.stream;\n }\n\n /**\n * The underlying WCME receive slot\n */\n get wcmeReceiveSlot(): WcmeReceiveSlot {\n return this.mcReceiveSlot;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA;AAOA;AACA;AAAwD;AAAA;AAAA;AAAA;AAEjD,IAAMA,iBAAiB,GAAG;EAC/BC,YAAY,EAAE,cAAc;EAC5BC,WAAW,EAAE;AACf,CAAC;AAAC;AAOF,IAAIC,kBAAkB,GAAG,CAAC;AAAC;AAAA;AAAA;AAI3B;AACA;AACA;AACA;AAHA,IAIaC,WAAW;EAAA;EAAA;EAetB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,qBACEC,SAAoB,EACpBC,aAA8B,EAC9BC,oBAA0C,EAC1C;IAAA;IAAA;IACA;IAAQ;IAAA;IAAA;IAAA;IAAA;MAAA;MAAA;IAAA;IAAA;MAAA;MAAA;IAAA;IAAA;MAAA;MAAA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