@webex/plugin-meetings 3.0.0-beta.98 → 3.0.0-beta.99

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.
@@ -169,7 +169,7 @@ var Breakout = _webexCore.WebexPlugin.extend({
169
169
  sessionId: this.sessionId
170
170
  });
171
171
  },
172
- version: "3.0.0-beta.98"
172
+ version: "3.0.0-beta.99"
173
173
  });
174
174
  var _default = Breakout;
175
175
  exports.default = _default;
@@ -907,7 +907,7 @@ var Breakouts = _webexCore.WebexPlugin.extend({
907
907
  this.trigger(_constants.BREAKOUTS.EVENTS.ASK_RETURN_TO_MAIN);
908
908
  }
909
909
  },
910
- version: "3.0.0-beta.98"
910
+ version: "3.0.0-beta.99"
911
911
  });
912
912
  var _default = Breakouts;
913
913
  exports.default = _default;
@@ -40,7 +40,7 @@ var MediaRequestManager = /*#__PURE__*/function () {
40
40
  (0, _defineProperty2.default)(this, "degradationPreferences", void 0);
41
41
  (0, _defineProperty2.default)(this, "sourceUpdateListener", void 0);
42
42
  (0, _defineProperty2.default)(this, "debouncedSourceUpdateListener", void 0);
43
- (0, _defineProperty2.default)(this, "previousWCMEMediaRequests", []);
43
+ (0, _defineProperty2.default)(this, "previousStreamRequests", []);
44
44
  this.sendMediaRequestsCallback = sendMediaRequestsCallback;
45
45
  this.counter = 0;
46
46
  this.clientRequests = {};
@@ -95,31 +95,31 @@ var MediaRequestManager = /*#__PURE__*/function () {
95
95
  }
96
96
 
97
97
  /**
98
- * Returns true if two media requests are the same, false otherwise.
98
+ * Returns true if two stream requests are the same, false otherwise.
99
99
  *
100
- * @param {WcmeMediaRequest} mediaRequestA - Media request A for comparison.
101
- * @param {WcmeMediaRequest} mediaRequestB - Media request B for comparison.
100
+ * @param {StreamRequest} streamRequestA - Stream request A for comparison.
101
+ * @param {StreamRequest} streamRequestB - Stream request B for comparison.
102
102
  * @returns {boolean} - Whether they are equal.
103
103
  */
104
104
  // eslint-disable-next-line class-methods-use-this
105
105
  }, {
106
106
  key: "isEqual",
107
- value: function isEqual(mediaRequestA, mediaRequestB) {
108
- return (0, _stringify.default)(mediaRequestA._toJmpScrRequest()) === (0, _stringify.default)(mediaRequestB._toJmpScrRequest());
107
+ value: function isEqual(streamRequestA, streamRequestB) {
108
+ return (0, _stringify.default)(streamRequestA._toJmpStreamRequest()) === (0, _stringify.default)(streamRequestB._toJmpStreamRequest());
109
109
  }
110
110
 
111
111
  /**
112
- * Compares new media requests to previous ones and determines
112
+ * Compares new stream requests to previous ones and determines
113
113
  * if they are the same.
114
114
  *
115
- * @param {WcmeMediaRequest[]} newRequests - Array with new requests.
115
+ * @param {StreamRequest[]} newRequests - Array with new requests.
116
116
  * @returns {boolean} - True if they are equal, false otherwise.
117
117
  */
118
118
  }, {
119
119
  key: "checkIsNewRequestsEqualToPrev",
120
120
  value: function checkIsNewRequestsEqualToPrev(newRequests) {
121
121
  var _this2 = this;
122
- return !(0, _isEmpty2.default)(this.previousWCMEMediaRequests) && this.previousWCMEMediaRequests.length === newRequests.length && this.previousWCMEMediaRequests.every(function (req, idx) {
122
+ return !(0, _isEmpty2.default)(this.previousStreamRequests) && this.previousStreamRequests.length === newRequests.length && this.previousStreamRequests.every(function (req, idx) {
123
123
  return _this2.isEqual(req, newRequests[idx]);
124
124
  });
125
125
  }
@@ -165,34 +165,34 @@ var MediaRequestManager = /*#__PURE__*/function () {
165
165
  }
166
166
 
167
167
  /**
168
- * Clears the previous media requests.
168
+ * Clears the previous stream requests.
169
169
  *
170
170
  * @returns {void}
171
171
  */
172
172
  }, {
173
173
  key: "clearPreviousRequests",
174
174
  value: function clearPreviousRequests() {
175
- this.previousWCMEMediaRequests = [];
175
+ this.previousStreamRequests = [];
176
176
  }
177
177
  }, {
178
178
  key: "sendRequests",
179
179
  value: function sendRequests() {
180
180
  var _this3 = this;
181
- var wcmeMediaRequests = [];
181
+ var streamRequests = [];
182
182
  var clientRequests = this.getDegradedClientRequests();
183
183
 
184
- // map all the client media requests to wcme media requests
184
+ // map all the client media requests to wcme stream requests
185
185
  (0, _values.default)(clientRequests).forEach(function (mr) {
186
- wcmeMediaRequests.push(new _internalMediaCore.MediaRequest(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) : new _internalMediaCore.ReceiverSelectedInfo(mr.policyInfo.csi), mr.receiveSlots.map(function (receiveSlot) {
186
+ 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) : new _internalMediaCore.ReceiverSelectedInfo(mr.policyInfo.csi), mr.receiveSlots.map(function (receiveSlot) {
187
187
  return receiveSlot.wcmeReceiveSlot;
188
188
  }), _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))]));
189
189
  });
190
190
 
191
191
  //! IMPORTANT: this is only a temporary fix. This will soon be done in the jmp layer (@webex/json-multistream)
192
192
  // https://jira-eng-gpk2.cisco.com/jira/browse/WEBEX-326713
193
- if (!this.checkIsNewRequestsEqualToPrev(wcmeMediaRequests)) {
194
- this.sendMediaRequestsCallback(wcmeMediaRequests);
195
- this.previousWCMEMediaRequests = wcmeMediaRequests;
193
+ if (!this.checkIsNewRequestsEqualToPrev(streamRequests)) {
194
+ this.sendMediaRequestsCallback(streamRequests);
195
+ this.previousStreamRequests = streamRequests;
196
196
  _loggerProxy.default.logger.info("multistream:sendRequests --> media requests sent. ");
197
197
  } else {
198
198
  _loggerProxy.default.logger.info("multistream:sendRequests --> detected duplicate WCME requests, skipping them... ");
@@ -1 +1 @@
1
- {"version":3,"names":["CODEC_DEFAULTS","h264","maxFs","maxFps","maxMbps","DEBOUNCED_SOURCE_UPDATE_TIME","MediaRequestManager","sendMediaRequestsCallback","options","counter","clientRequests","degradationPreferences","kind","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","mediaRequestA","mediaRequestB","_toJmpScrRequest","newRequests","previousWCMEMediaRequests","every","req","idx","isEqual","mediaRequest","RecommendedOpusBitrates","FB_MONO_MUSIC","getRecommendedMaxBitrateForFrameSize","wcmeMediaRequests","getDegradedClientRequests","push","WcmeMediaRequest","policyInfo","policy","Policy","ActiveSpeaker","ReceiverSelected","ActiveSpeakerInfo","priority","crossPriorityDuplication","crossPolicyDuplication","preferLiveVideo","ReceiverSelectedInfo","csi","map","receiveSlot","wcmeReceiveSlot","getMaxPayloadBitsPerSecond","WcmeCodecInfo","H264Codec","getH264MaxMbps","maxWidth","maxHeight","checkIsNewRequestsEqualToPrev","info","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 getRecommendedMaxBitrateForFrameSize,\n RecommendedOpusBitrates,\n} from '@webex/internal-media-core';\nimport {cloneDeep, debounce, isEmpty} from 'lodash';\n\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}\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;\ntype Kind = 'audio' | 'video';\n\ntype Options = {\n degradationPreferences: DegradationPreferences;\n kind: Kind;\n};\nexport class MediaRequestManager {\n private sendMediaRequestsCallback: SendMediaRequestsCallback;\n\n private kind: Kind;\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 private previousWCMEMediaRequests: Array<WcmeMediaRequest> = [];\n\n constructor(sendMediaRequestsCallback: SendMediaRequestsCallback, options: Options) {\n this.sendMediaRequestsCallback = sendMediaRequestsCallback;\n this.counter = 0;\n this.clientRequests = {};\n this.degradationPreferences = options.degradationPreferences;\n this.kind = options.kind;\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 /**\n * Returns true if two media requests are the same, false otherwise.\n *\n * @param {WcmeMediaRequest} mediaRequestA - Media request A for comparison.\n * @param {WcmeMediaRequest} mediaRequestB - Media request B for comparison.\n * @returns {boolean} - Whether they are equal.\n */\n // eslint-disable-next-line class-methods-use-this\n public isEqual(mediaRequestA: WcmeMediaRequest, mediaRequestB: WcmeMediaRequest) {\n return (\n JSON.stringify(mediaRequestA._toJmpScrRequest()) ===\n JSON.stringify(mediaRequestB._toJmpScrRequest())\n );\n }\n\n /**\n * Compares new media requests to previous ones and determines\n * if they are the same.\n *\n * @param {WcmeMediaRequest[]} newRequests - Array with new requests.\n * @returns {boolean} - True if they are equal, false otherwise.\n */\n private checkIsNewRequestsEqualToPrev(newRequests: WcmeMediaRequest[]) {\n return (\n !isEmpty(this.previousWCMEMediaRequests) &&\n this.previousWCMEMediaRequests.length === newRequests.length &&\n this.previousWCMEMediaRequests.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 media requests.\n *\n * @returns {void}\n */\n public clearPreviousRequests(): void {\n this.previousWCMEMediaRequests = [];\n }\n\n private sendRequests() {\n const wcmeMediaRequests: WcmeMediaRequest[] = [];\n\n const clientRequests = this.getDegradedClientRequests();\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 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 //! 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(wcmeMediaRequests)) {\n this.sendMediaRequestsCallback(wcmeMediaRequests);\n this.previousWCMEMediaRequests = wcmeMediaRequests;\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 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;AAYA;AAEA;AACA;AAhBA;;AAqDA,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,IAa7BC,mBAAmB;EAiB9B,6BAAYC,yBAAoD,EAAEC,OAAgB,EAAE;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA,iEAFvB,EAAE;IAG7D,IAAI,CAACD,yBAAyB,GAAGA,yBAAyB;IAC1D,IAAI,CAACE,OAAO,GAAG,CAAC;IAChB,IAAI,CAACC,cAAc,GAAG,CAAC,CAAC;IACxB,IAAI,CAACC,sBAAsB,GAAGH,OAAO,CAACG,sBAAsB;IAC5D,IAAI,CAACC,IAAI,GAAGJ,OAAO,CAACI,IAAI;IACxB,IAAI,CAACC,oBAAoB,GAAG,IAAI,CAACC,MAAM,CAACC,IAAI,CAAC,I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I,CAACrE,oBAAoB,CAAC;QAChEmB,EAAE,CAACgD,EAAE,CAACC,8BAAiB,CAACE,WAAW,EAAE,iBAAa;UAAA,IAAXjF,KAAK,SAALA,KAAK;UAC1C8C,YAAY,CAACrB,cAAc,GAAGzB,KAAK;UACnC,MAAI,CAACc,6BAA6B,EAAE;QACtC,CAAC,CAAC;MACJ,CAAC,CAAC;MAEF,IAAIF,MAAM,EAAE;QACV,IAAI,CAACA,MAAM,EAAE;MACf;MAEA,OAAOiE,KAAK;IACd;EAAC;IAAA;IAAA,OAED,uBAAqBK,SAAyB,EAAiB;MAAA;QAAA;MAAA,IAAftE,MAAM,uEAAG,IAAI;MAC3D,6BAAI,CAACJ,cAAc,CAAC0E,SAAS,CAAC,0DAA9B,sBAAgCtD,YAAY,CAACT,OAAO,CAAC,UAACW,EAAE,EAAK;QAC3DA,EAAE,CAACqD,GAAG,CAACJ,8BAAiB,CAACC,YAAY,EAAE,MAAI,CAACrE,oBAAoB,CAAC;MACnE,CAAC,CAAC;MAEF,OAAO,IAAI,CAACH,cAAc,CAAC0E,SAAS,CAAC;MAErC,IAAItE,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,CAACP,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","clientRequests","degradationPreferences","kind","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","streamRequestA","streamRequestB","_toJmpStreamRequest","newRequests","previousStreamRequests","every","req","idx","isEqual","mediaRequest","RecommendedOpusBitrates","FB_MONO_MUSIC","getRecommendedMaxBitrateForFrameSize","streamRequests","getDegradedClientRequests","push","StreamRequest","policyInfo","policy","Policy","ActiveSpeaker","ReceiverSelected","ActiveSpeakerInfo","priority","crossPriorityDuplication","crossPolicyDuplication","preferLiveVideo","ReceiverSelectedInfo","csi","map","receiveSlot","wcmeReceiveSlot","getMaxPayloadBitsPerSecond","WcmeCodecInfo","H264Codec","getH264MaxMbps","maxWidth","maxHeight","checkIsNewRequestsEqualToPrev","info","newId","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 {cloneDeep, debounce, isEmpty} from 'lodash';\n\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}\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 = (streamRequests: StreamRequest[]) => void;\ntype Kind = 'audio' | 'video';\n\ntype Options = {\n degradationPreferences: DegradationPreferences;\n kind: Kind;\n};\nexport class MediaRequestManager {\n private sendMediaRequestsCallback: SendMediaRequestsCallback;\n\n private kind: Kind;\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 private previousStreamRequests: Array<StreamRequest> = [];\n\n constructor(sendMediaRequestsCallback: SendMediaRequestsCallback, options: Options) {\n this.sendMediaRequestsCallback = sendMediaRequestsCallback;\n this.counter = 0;\n this.clientRequests = {};\n this.degradationPreferences = options.degradationPreferences;\n this.kind = options.kind;\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 /**\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 private sendRequests() {\n const streamRequests: StreamRequest[] = [];\n\n const clientRequests = this.getDegradedClientRequests();\n\n // map all the client media requests to wcme stream requests\n Object.values(clientRequests).forEach((mr) => {\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 )\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 //! 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 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;AAYA;AAEA;AACA;AAhBA;;AAqDA,IAAMA,cAAc,GA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AC;MAErC,IAAItE,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,CAACP,cAAc,GAAG,CAAC,CAAC;IAC1B;EAAC;EAAA;AAAA;AAAA"}
@@ -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 SourceState,\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 {SourceState} 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: SourceState;\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: SourceState, 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;IAAA;IAERJ,kBAAkB,IAAI,CAAC;IAEvB,MAAKI,oBAAoB,GAAGA,oBAAoB;IAChD,MAAKF,SAAS,GAAGA,SAAS;IAC1B,MAAKC,aAAa,GAAGA,aAAa;IAClC,+FAAoB,WAAW;IAC/B,MAAKE,EAAE,cAAOL,kBAAkB,CAAE;IAElC,MAAKM,mBAAmB,EAAE;IAAC;EAC7B;;EAEA;AACF;AACA;EAFE;IAAA;IAAA,KAG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,wCAAI,aAAa,IAAI,CAAChB,oBAAoB,qCAAC,IAAI,QAAM;QAErD,wCAAI,IAAI,cAAY;UAClB;UACA,IAAI,CAACI,IAAI,CACP;YACEC,IAAI,EAAE,qBAAqB;YAC3BC,QAAQ,EAAE;UACZ,CAAC,EACDb,iBAAiB,CAACC,YAAY,EAC9B;YACEiB,KAAK,sCAAE,IAAI,eAAa;YACxBC,GAAG,sCAAE,IAAI,OAAK;YACdK,QAAQ,sCAAE,IAAI;UAChB,CAAC,CACF;QACH;MACF;IACF;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAuB;MACrB,+BAAwB,IAAI,CAAChB,EAAE,eAAK,wBAAe,IAAI,CAACF,aAAa,CAACE,EAAE,CAAC;IAC3E;;IAEA;AACF;AACA;AACA;AACA;EAJE;IAAA;IAAA,KAKA,eAA0B;MACxB,OAAO,IAAI,CAACF,aAAa,CAACmB,MAAM;IAClC;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAuC;MACrC,OAAO,IAAI,CAACnB,aAAa;IAC3B;EAAC;EAAA;AAAA,EAzJ8BoB,oBAAW;AAAA"}
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;A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getMaxFs","paneSize","maxFs","LoggerProxy","logger","warn","remoteMediaCounter","RemoteMedia","receiveSlot","mediaRequestManager","options","setupEventListeners","id","width","height","fs","setMaxFs","commit","cancelMediaRequest","removeAllListeners","undefined","emit","file","function","csi","mediaRequestId","Error","addRequest","policyInfo","policy","receiveSlots","codecInfo","resolution","codec","cancelRequest","scope","on","data","mediaType","memberId","sourceState","stream","EventsScope"],"sources":["remoteMedia.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {MediaType, SourceState} from '@webex/internal-media-core';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport EventsScope from '../common/events/events-scope';\n\nimport {MediaRequestId, MediaRequestManager} from './mediaRequestManager';\nimport {CSI, ReceiveSlot, ReceiveSlotEvents} from './receiveSlot';\n\nexport const RemoteMediaEvents = {\n SourceUpdate: ReceiveSlotEvents.SourceUpdate,\n Stopped: 'stopped',\n};\n\nexport type RemoteVideoResolution =\n | 'thumbnail' // the smallest possible resolution, 90p or less\n | 'very small' // 180p or less\n | 'small' // 360p or less\n | 'medium' // 720p or less\n | 'large' // 1080p or less\n | 'best'; // highest possible resolution\n\n/**\n * Converts pane size into h264 maxFs\n * @param {PaneSize} paneSize\n * @returns {number}\n */\nexport function getMaxFs(paneSize: RemoteVideoResolution): number {\n let maxFs;\n\n switch (paneSize) {\n case 'thumbnail':\n maxFs = 60;\n break;\n case 'very small':\n maxFs = 240;\n break;\n case 'small':\n maxFs = 920;\n break;\n case 'medium':\n maxFs = 3600;\n break;\n case 'large':\n maxFs = 8192;\n break;\n case 'best':\n maxFs = 8192; // for now 'best' is 1080p, so same as 'large'\n break;\n default:\n LoggerProxy.logger.warn(\n `RemoteMedia#getMaxFs --> unsupported paneSize: ${paneSize}, using \"medium\" instead`\n );\n maxFs = 3600;\n }\n\n return maxFs;\n}\n\ntype Options = {\n resolution?: RemoteVideoResolution; // applies only to groups of type MediaType.VideoMain and MediaType.VideoSlides\n};\n\nexport type RemoteMediaId = string;\n\nlet remoteMediaCounter = 0;\n\n/**\n * Class representing a remote audio/video stream.\n *\n * Internally it is associated with a specific receive slot\n * and a media request for it.\n */\nexport class RemoteMedia extends EventsScope {\n private receiveSlot?: ReceiveSlot;\n\n private readonly mediaRequestManager: MediaRequestManager;\n\n private readonly options: Options;\n\n private mediaRequestId?: MediaRequestId;\n\n public readonly id: RemoteMediaId;\n\n /**\n * Constructs RemoteMedia instance\n *\n * @param receiveSlot\n * @param mediaRequestManager\n * @param options\n */\n constructor(\n receiveSlot: ReceiveSlot,\n mediaRequestManager: MediaRequestManager,\n options?: Options\n ) {\n super();\n remoteMediaCounter += 1;\n this.receiveSlot = receiveSlot;\n this.mediaRequestManager = mediaRequestManager;\n this.options = options || {};\n this.setupEventListeners();\n this.id = `RM${remoteMediaCounter}-${this.receiveSlot.id}`;\n }\n\n /**\n * Supply the width and height of the video element\n * to restrict the requested resolution to this size\n * @param width width of the video element\n * @param height height of the video element\n */\n public setSizeHint(width, height) {\n // only base on height for now\n let fs: number;\n\n if (height < 135) {\n fs = 60;\n } else if (height < 270) {\n fs = 240;\n } else if (height < 540) {\n fs = 920;\n } else if (height <= 720) {\n fs = 3600;\n } else {\n fs = 8192;\n }\n\n this.receiveSlot?.setMaxFs(fs);\n }\n\n /**\n * Invalidates the remote media by clearing the reference to a receive slot and\n * cancelling the media request.\n * After this call the remote media is unusable.\n *\n * @param {boolean} commit - whether to commit the cancellation of the media request\n * @internal\n */\n public stop(commit = true) {\n this.cancelMediaRequest(commit);\n this.receiveSlot?.removeAllListeners();\n this.receiveSlot = undefined;\n this.emit(\n {\n file: 'multistream/remoteMedia',\n function: 'stop',\n },\n RemoteMediaEvents.Stopped,\n {}\n );\n }\n\n /**\n * Sends a new media request. This method can only be used for receiver-selected policy,\n * because only in that policy we have a 1-1 relationship between RemoteMedia and MediaRequest\n * and the request id is then stored in this RemoteMedia instance.\n * For active-speaker policy, the same request is shared among many RemoteMedia instances,\n * so it's managed through RemoteMediaGroup\n *\n * @internal\n */\n public sendMediaRequest(csi: CSI, commit: boolean) {\n if (this.mediaRequestId) {\n this.cancelMediaRequest(false);\n }\n\n if (!this.receiveSlot) {\n throw new Error('sendMediaRequest() called on an invalidated RemoteMedia instance');\n }\n\n this.mediaRequestId = this.mediaRequestManager.addRequest(\n {\n policyInfo: {\n policy: 'receiver-selected',\n csi,\n },\n receiveSlots: [this.receiveSlot],\n codecInfo: this.options.resolution && {\n codec: 'h264',\n maxFs: getMaxFs(this.options.resolution),\n },\n },\n commit\n );\n }\n\n /**\n * @internal\n */\n public cancelMediaRequest(commit: boolean) {\n if (this.mediaRequestId) {\n this.mediaRequestManager.cancelRequest(this.mediaRequestId, commit);\n this.mediaRequestId = undefined;\n }\n }\n\n /**\n * registers event listeners on the receive slot and forwards all the events\n */\n private setupEventListeners() {\n if (this.receiveSlot) {\n const scope = {\n file: 'multistream/remoteMedia',\n function: 'setupEventListeners',\n };\n\n this.receiveSlot.on(ReceiveSlotEvents.SourceUpdate, (data) => {\n this.emit(scope, RemoteMediaEvents.SourceUpdate, data);\n });\n }\n }\n\n /**\n * Getter for mediaType\n */\n public get mediaType(): MediaType {\n return this.receiveSlot?.mediaType;\n }\n\n /**\n * Getter for memberId\n */\n public get memberId() {\n return this.receiveSlot?.memberId;\n }\n\n /**\n * Getter for csi\n */\n public get csi() {\n return this.receiveSlot?.csi;\n }\n\n /**\n * Getter for source state\n */\n public get sourceState(): SourceState {\n return this.receiveSlot?.sourceState;\n }\n\n /**\n * Getter for remote media stream\n */\n public get stream() {\n return this.receiveSlot?.stream;\n }\n\n /**\n * @internal\n * @returns {ReceiveSlot}\n */\n public getUnderlyingReceiveSlot() {\n return this.receiveSlot;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA;AACA;AAGA;AAAkE;AAAA;AAE3D,IAAMA,iBAAiB,GAAG;EAC/BC,YAAY,EAAEC,8BAAiB,CAACD,YAAY;EAC5CE,OAAO,EAAE;AACX,CAAC;AAAC;AAQU;;AAEZ;AACA;AACA;AACA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;EAFE;IAAA;IAAA,KAGA,eAAoB;MAAA;MAClB,6BAAO,IAAI,CAAChC,WAAW,uDAAhB,mBAAkBiC,MAAM;IACjC;;IAEA;AACF;AACA;AACA;EAHE;IAAA;IAAA,OAIA,oCAAkC;MAChC,OAAO,IAAI,CAACjC,WAAW;IACzB;EAAC;EAAA;AAAA,EApL8BkC,oBAAW;AAAA"}
1
+ {"version":3,"names":["RemoteMediaEvents","SourceUpdate","ReceiveSlotEvents","Stopped","getMaxFs","paneSize","maxFs","LoggerProxy","logger","warn","remoteMediaCounter","RemoteMedia","receiveSlot","mediaRequestManager","options","setupEventListeners","id","width","height","fs","setMaxFs","commit","cancelMediaRequest","removeAllListeners","undefined","emit","file","function","csi","mediaRequestId","Error","addRequest","policyInfo","policy","receiveSlots","codecInfo","resolution","codec","cancelRequest","scope","on","data","mediaType","memberId","sourceState","stream","EventsScope"],"sources":["remoteMedia.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {MediaType, StreamState} from '@webex/internal-media-core';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport EventsScope from '../common/events/events-scope';\n\nimport {MediaRequestId, MediaRequestManager} from './mediaRequestManager';\nimport {CSI, ReceiveSlot, ReceiveSlotEvents} from './receiveSlot';\n\nexport const RemoteMediaEvents = {\n SourceUpdate: ReceiveSlotEvents.SourceUpdate,\n Stopped: 'stopped',\n};\n\nexport type RemoteVideoResolution =\n | 'thumbnail' // the smallest possible resolution, 90p or less\n | 'very small' // 180p or less\n | 'small' // 360p or less\n | 'medium' // 720p or less\n | 'large' // 1080p or less\n | 'best'; // highest possible resolution\n\n/**\n * Converts pane size into h264 maxFs\n * @param {PaneSize} paneSize\n * @returns {number}\n */\nexport function getMaxFs(paneSize: RemoteVideoResolution): number {\n let maxFs;\n\n switch (paneSize) {\n case 'thumbnail':\n maxFs = 60;\n break;\n case 'very small':\n maxFs = 240;\n break;\n case 'small':\n maxFs = 920;\n break;\n case 'medium':\n maxFs = 3600;\n break;\n case 'large':\n maxFs = 8192;\n break;\n case 'best':\n maxFs = 8192; // for now 'best' is 1080p, so same as 'large'\n break;\n default:\n LoggerProxy.logger.warn(\n `RemoteMedia#getMaxFs --> unsupported paneSize: ${paneSize}, using \"medium\" instead`\n );\n maxFs = 3600;\n }\n\n return maxFs;\n}\n\ntype Options = {\n resolution?: RemoteVideoResolution; // applies only to groups of type MediaType.VideoMain and MediaType.VideoSlides\n};\n\nexport type RemoteMediaId = string;\n\nlet remoteMediaCounter = 0;\n\n/**\n * Class representing a remote audio/video stream.\n *\n * Internally it is associated with a specific receive slot\n * and a media request for it.\n */\nexport class RemoteMedia extends EventsScope {\n private receiveSlot?: ReceiveSlot;\n\n private readonly mediaRequestManager: MediaRequestManager;\n\n private readonly options: Options;\n\n private mediaRequestId?: MediaRequestId;\n\n public readonly id: RemoteMediaId;\n\n /**\n * Constructs RemoteMedia instance\n *\n * @param receiveSlot\n * @param mediaRequestManager\n * @param options\n */\n constructor(\n receiveSlot: ReceiveSlot,\n mediaRequestManager: MediaRequestManager,\n options?: Options\n ) {\n super();\n remoteMediaCounter += 1;\n this.receiveSlot = receiveSlot;\n this.mediaRequestManager = mediaRequestManager;\n this.options = options || {};\n this.setupEventListeners();\n this.id = `RM${remoteMediaCounter}-${this.receiveSlot.id}`;\n }\n\n /**\n * Supply the width and height of the video element\n * to restrict the requested resolution to this size\n * @param width width of the video element\n * @param height height of the video element\n */\n public setSizeHint(width, height) {\n // only base on height for now\n let fs: number;\n\n if (height < 135) {\n fs = 60;\n } else if (height < 270) {\n fs = 240;\n } else if (height < 540) {\n fs = 920;\n } else if (height <= 720) {\n fs = 3600;\n } else {\n fs = 8192;\n }\n\n this.receiveSlot?.setMaxFs(fs);\n }\n\n /**\n * Invalidates the remote media by clearing the reference to a receive slot and\n * cancelling the media request.\n * After this call the remote media is unusable.\n *\n * @param {boolean} commit - whether to commit the cancellation of the media request\n * @internal\n */\n public stop(commit = true) {\n this.cancelMediaRequest(commit);\n this.receiveSlot?.removeAllListeners();\n this.receiveSlot = undefined;\n this.emit(\n {\n file: 'multistream/remoteMedia',\n function: 'stop',\n },\n RemoteMediaEvents.Stopped,\n {}\n );\n }\n\n /**\n * Sends a new media request. This method can only be used for receiver-selected policy,\n * because only in that policy we have a 1-1 relationship between RemoteMedia and MediaRequest\n * and the request id is then stored in this RemoteMedia instance.\n * For active-speaker policy, the same request is shared among many RemoteMedia instances,\n * so it's managed through RemoteMediaGroup\n *\n * @internal\n */\n public sendMediaRequest(csi: CSI, commit: boolean) {\n if (this.mediaRequestId) {\n this.cancelMediaRequest(false);\n }\n\n if (!this.receiveSlot) {\n throw new Error('sendMediaRequest() called on an invalidated RemoteMedia instance');\n }\n\n this.mediaRequestId = this.mediaRequestManager.addRequest(\n {\n policyInfo: {\n policy: 'receiver-selected',\n csi,\n },\n receiveSlots: [this.receiveSlot],\n codecInfo: this.options.resolution && {\n codec: 'h264',\n maxFs: getMaxFs(this.options.resolution),\n },\n },\n commit\n );\n }\n\n /**\n * @internal\n */\n public cancelMediaRequest(commit: boolean) {\n if (this.mediaRequestId) {\n this.mediaRequestManager.cancelRequest(this.mediaRequestId, commit);\n this.mediaRequestId = undefined;\n }\n }\n\n /**\n * registers event listeners on the receive slot and forwards all the events\n */\n private setupEventListeners() {\n if (this.receiveSlot) {\n const scope = {\n file: 'multistream/remoteMedia',\n function: 'setupEventListeners',\n };\n\n this.receiveSlot.on(ReceiveSlotEvents.SourceUpdate, (data) => {\n this.emit(scope, RemoteMediaEvents.SourceUpdate, data);\n });\n }\n }\n\n /**\n * Getter for mediaType\n */\n public get mediaType(): MediaType {\n return this.receiveSlot?.mediaType;\n }\n\n /**\n * Getter for memberId\n */\n public get memberId() {\n return this.receiveSlot?.memberId;\n }\n\n /**\n * Getter for csi\n */\n public get csi() {\n return this.receiveSlot?.csi;\n }\n\n /**\n * Getter for source state\n */\n public get sourceState(): StreamState {\n return this.receiveSlot?.sourceState;\n }\n\n /**\n * Getter for remote media stream\n */\n public get stream() {\n return this.receiveSlot?.stream;\n }\n\n /**\n * @internal\n * @returns {ReceiveSlot}\n */\n public getUnderlyingReceiveSlot() {\n return this.receiveSlot;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA;AACA;AAGA;AAAkE;AAAA;AAE3D,IAAMA,iBAAiB,GAAG;EAC/BC,YAAY,EAAEC,8BAAiB,CAACD,YAAY;EAC5CE,OAAO,EAAE;AACX,CAAC;AAAC;AAQU;;AAEZ;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQ,CAACC,QAA+B,EAAU;EAChE,IAAIC,KAAK;EAET,QAAQD,QAAQ;IACd,KAAK,WAAW;MACdC,KAAK,GAAG,EAAE;MACV;IACF,KAAK,YAAY;MACfA,KAAK,GAAG,GAAG;MACX;IACF,KAAK,OAAO;MACVA,KAAK,GAAG,GAAG;MACX;IACF,KAAK,QAAQ;MACXA,KAAK,GAAG,IAAI;MACZ;IACF,KAAK,OAAO;MACVA,KAAK,GAAG,IAAI;MACZ;IACF,KAAK,MAAM;MACTA,KAAK,GAAG,IAAI,CAAC,CAAC;MACd;IACF;MACEC,oBAAW,CAACC,MAAM,CAACC,IAAI,0DAC6BJ,QAAQ,gCAC3D;MACDC,KAAK,GAAG,IAAI;EAAC;EAGjB,OAAOA,KAAK;AACd;AAQA,IAAII,kBAAkB,GAAG,CAAC;;AAE1B;AACA;AACA;AACA;AACA;AACA;AALA,IAMaC,WAAW;EAAA;EAAA;EAWtB;AACF;AACA;AACA;AACA;AACA;AACA;EACE,qBACEC,WAAwB,EACxBC,mBAAwC,EACxCC,OAAiB,EACjB;IAAA;IAAA;IACA;IAAQ;IAAA;IAAA;IAAA;IAAA;IACRJ,kBAAkB,IAAI,CAAC;IACvB,MAAKE,WAAW,GAAGA,WAAW;IAC9B,MAAKC,mBAAmB,GAAGA,mBAAmB;IAC9C,MAAKC,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAC5B,MAAKC,mBAAmB,EAAE;IAC1B,MAAKC,EAAE,eAAQ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AC9B,WAAW,uDAAhB,mBAAkB+B,QAAQ;IACnC;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAiB;MAAA;MACf,6BAAO,IAAI,CAAC/B,WAAW,uDAAhB,mBAAkBgB,GAAG;IAC9B;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAsC;MAAA;MACpC,6BAAO,IAAI,CAAChB,WAAW,uDAAhB,mBAAkBgC,WAAW;IACtC;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAoB;MAAA;MAClB,6BAAO,IAAI,CAAChC,WAAW,uDAAhB,mBAAkBiC,MAAM;IACjC;;IAEA;AACF;AACA;AACA;EAHE;IAAA;IAAA,OAIA,oCAAkC;MAChC,OAAO,IAAI,CAACjC,WAAW;IACzB;EAAC;EAAA;AAAA,EApL8BkC,oBAAW;AAAA"}
@@ -1,4 +1,4 @@
1
- import { MediaRequest as WcmeMediaRequest } from '@webex/internal-media-core';
1
+ import { StreamRequest } from '@webex/internal-media-core';
2
2
  import { ReceiveSlot } from './receiveSlot';
3
3
  export interface ActiveSpeakerPolicyInfo {
4
4
  policy: 'active-speaker';
@@ -31,7 +31,7 @@ export type MediaRequestId = string;
31
31
  type DegradationPreferences = {
32
32
  maxMacroblocksLimit: number;
33
33
  };
34
- type SendMediaRequestsCallback = (mediaRequests: WcmeMediaRequest[]) => void;
34
+ type SendMediaRequestsCallback = (streamRequests: StreamRequest[]) => void;
35
35
  type Kind = 'audio' | 'video';
36
36
  type Options = {
37
37
  degradationPreferences: DegradationPreferences;
@@ -45,23 +45,23 @@ export declare class MediaRequestManager {
45
45
  private degradationPreferences;
46
46
  private sourceUpdateListener;
47
47
  private debouncedSourceUpdateListener;
48
- private previousWCMEMediaRequests;
48
+ private previousStreamRequests;
49
49
  constructor(sendMediaRequestsCallback: SendMediaRequestsCallback, options: Options);
50
50
  setDegradationPreferences(degradationPreferences: DegradationPreferences): void;
51
51
  private getDegradedClientRequests;
52
52
  /**
53
- * Returns true if two media requests are the same, false otherwise.
53
+ * Returns true if two stream requests are the same, false otherwise.
54
54
  *
55
- * @param {WcmeMediaRequest} mediaRequestA - Media request A for comparison.
56
- * @param {WcmeMediaRequest} mediaRequestB - Media request B for comparison.
55
+ * @param {StreamRequest} streamRequestA - Stream request A for comparison.
56
+ * @param {StreamRequest} streamRequestB - Stream request B for comparison.
57
57
  * @returns {boolean} - Whether they are equal.
58
58
  */
59
- isEqual(mediaRequestA: WcmeMediaRequest, mediaRequestB: WcmeMediaRequest): boolean;
59
+ isEqual(streamRequestA: StreamRequest, streamRequestB: StreamRequest): boolean;
60
60
  /**
61
- * Compares new media requests to previous ones and determines
61
+ * Compares new stream requests to previous ones and determines
62
62
  * if they are the same.
63
63
  *
64
- * @param {WcmeMediaRequest[]} newRequests - Array with new requests.
64
+ * @param {StreamRequest[]} newRequests - Array with new requests.
65
65
  * @returns {boolean} - True if they are equal, false otherwise.
66
66
  */
67
67
  private checkIsNewRequestsEqualToPrev;
@@ -87,7 +87,7 @@ export declare class MediaRequestManager {
87
87
  */
88
88
  private getH264MaxMbps;
89
89
  /**
90
- * Clears the previous media requests.
90
+ * Clears the previous stream requests.
91
91
  *
92
92
  * @returns {void}
93
93
  */
@@ -1,10 +1,10 @@
1
- import { MediaType, ReceiveSlot as WcmeReceiveSlot, SourceState } from '@webex/internal-media-core';
1
+ import { MediaType, ReceiveSlot as WcmeReceiveSlot, StreamState } from '@webex/internal-media-core';
2
2
  import EventsScope from '../common/events/events-scope';
3
3
  export declare const ReceiveSlotEvents: {
4
4
  SourceUpdate: string;
5
5
  MaxFsUpdate: string;
6
6
  };
7
- export type { SourceState } from '@webex/internal-media-core';
7
+ export type { StreamState } from '@webex/internal-media-core';
8
8
  export type CSI = number;
9
9
  export type MemberId = string;
10
10
  export type ReceiveSlotId = string;
@@ -44,7 +44,7 @@ export declare class ReceiveSlot extends EventsScope {
44
44
  /**
45
45
  * Getter for sourceState
46
46
  */
47
- get sourceState(): SourceState;
47
+ get sourceState(): StreamState;
48
48
  /**
49
49
  * registers event handlers with the underlying ReceiveSlot
50
50
  */
@@ -1,4 +1,4 @@
1
- import { MediaType, SourceState } from '@webex/internal-media-core';
1
+ import { MediaType, StreamState } from '@webex/internal-media-core';
2
2
  import EventsScope from '../common/events/events-scope';
3
3
  import { MediaRequestManager } from './mediaRequestManager';
4
4
  import { ReceiveSlot } from './receiveSlot';
@@ -63,7 +63,7 @@ export declare class RemoteMedia extends EventsScope {
63
63
  /**
64
64
  * Getter for source state
65
65
  */
66
- get sourceState(): SourceState;
66
+ get sourceState(): StreamState;
67
67
  /**
68
68
  * Getter for remote media stream
69
69
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/plugin-meetings",
3
- "version": "3.0.0-beta.98",
3
+ "version": "3.0.0-beta.99",
4
4
  "description": "",
5
5
  "license": "Cisco EULA (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)",
6
6
  "contributors": [
@@ -32,12 +32,12 @@
32
32
  "build": "yarn run -T tsc --declaration true --declarationDir ./dist/types"
33
33
  },
34
34
  "devDependencies": {
35
- "@webex/plugin-meetings": "3.0.0-beta.98",
36
- "@webex/test-helper-chai": "3.0.0-beta.98",
37
- "@webex/test-helper-mocha": "3.0.0-beta.98",
38
- "@webex/test-helper-mock-webex": "3.0.0-beta.98",
39
- "@webex/test-helper-retry": "3.0.0-beta.98",
40
- "@webex/test-helper-test-users": "3.0.0-beta.98",
35
+ "@webex/plugin-meetings": "3.0.0-beta.99",
36
+ "@webex/test-helper-chai": "3.0.0-beta.99",
37
+ "@webex/test-helper-mocha": "3.0.0-beta.99",
38
+ "@webex/test-helper-mock-webex": "3.0.0-beta.99",
39
+ "@webex/test-helper-retry": "3.0.0-beta.99",
40
+ "@webex/test-helper-test-users": "3.0.0-beta.99",
41
41
  "chai": "^4.3.4",
42
42
  "chai-as-promised": "^7.1.1",
43
43
  "jsdom-global": "3.0.2",
@@ -46,19 +46,19 @@
46
46
  "typescript": "^4.7.4"
47
47
  },
48
48
  "dependencies": {
49
- "@webex/common": "3.0.0-beta.98",
50
- "@webex/internal-media-core": "1.36.1",
51
- "@webex/internal-plugin-conversation": "3.0.0-beta.98",
52
- "@webex/internal-plugin-device": "3.0.0-beta.98",
53
- "@webex/internal-plugin-llm": "3.0.0-beta.98",
54
- "@webex/internal-plugin-mercury": "3.0.0-beta.98",
55
- "@webex/internal-plugin-metrics": "3.0.0-beta.98",
56
- "@webex/internal-plugin-support": "3.0.0-beta.98",
57
- "@webex/internal-plugin-user": "3.0.0-beta.98",
58
- "@webex/media-helpers": "3.0.0-beta.98",
59
- "@webex/plugin-people": "3.0.0-beta.98",
60
- "@webex/plugin-rooms": "3.0.0-beta.98",
61
- "@webex/webex-core": "3.0.0-beta.98",
49
+ "@webex/common": "3.0.0-beta.99",
50
+ "@webex/internal-media-core": "1.38.0",
51
+ "@webex/internal-plugin-conversation": "3.0.0-beta.99",
52
+ "@webex/internal-plugin-device": "3.0.0-beta.99",
53
+ "@webex/internal-plugin-llm": "3.0.0-beta.99",
54
+ "@webex/internal-plugin-mercury": "3.0.0-beta.99",
55
+ "@webex/internal-plugin-metrics": "3.0.0-beta.99",
56
+ "@webex/internal-plugin-support": "3.0.0-beta.99",
57
+ "@webex/internal-plugin-user": "3.0.0-beta.99",
58
+ "@webex/media-helpers": "3.0.0-beta.99",
59
+ "@webex/plugin-people": "3.0.0-beta.99",
60
+ "@webex/plugin-rooms": "3.0.0-beta.99",
61
+ "@webex/webex-core": "3.0.0-beta.99",
62
62
  "ampersand-collection": "^2.0.2",
63
63
  "bowser": "^2.11.0",
64
64
  "btoa": "^1.2.1",
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable require-jsdoc */
2
2
  import {
3
- MediaRequest as WcmeMediaRequest,
3
+ StreamRequest,
4
4
  Policy,
5
5
  ActiveSpeakerInfo,
6
6
  ReceiverSelectedInfo,
@@ -65,7 +65,7 @@ type DegradationPreferences = {
65
65
  maxMacroblocksLimit: number;
66
66
  };
67
67
 
68
- type SendMediaRequestsCallback = (mediaRequests: WcmeMediaRequest[]) => void;
68
+ type SendMediaRequestsCallback = (streamRequests: StreamRequest[]) => void;
69
69
  type Kind = 'audio' | 'video';
70
70
 
71
71
  type Options = {
@@ -87,7 +87,7 @@ export class MediaRequestManager {
87
87
 
88
88
  private debouncedSourceUpdateListener: () => void;
89
89
 
90
- private previousWCMEMediaRequests: Array<WcmeMediaRequest> = [];
90
+ private previousStreamRequests: Array<StreamRequest> = [];
91
91
 
92
92
  constructor(sendMediaRequestsCallback: SendMediaRequestsCallback, options: Options) {
93
93
  this.sendMediaRequestsCallback = sendMediaRequestsCallback;
@@ -153,32 +153,32 @@ export class MediaRequestManager {
153
153
  }
154
154
 
155
155
  /**
156
- * Returns true if two media requests are the same, false otherwise.
156
+ * Returns true if two stream requests are the same, false otherwise.
157
157
  *
158
- * @param {WcmeMediaRequest} mediaRequestA - Media request A for comparison.
159
- * @param {WcmeMediaRequest} mediaRequestB - Media request B for comparison.
158
+ * @param {StreamRequest} streamRequestA - Stream request A for comparison.
159
+ * @param {StreamRequest} streamRequestB - Stream request B for comparison.
160
160
  * @returns {boolean} - Whether they are equal.
161
161
  */
162
162
  // eslint-disable-next-line class-methods-use-this
163
- public isEqual(mediaRequestA: WcmeMediaRequest, mediaRequestB: WcmeMediaRequest) {
163
+ public isEqual(streamRequestA: StreamRequest, streamRequestB: StreamRequest) {
164
164
  return (
165
- JSON.stringify(mediaRequestA._toJmpScrRequest()) ===
166
- JSON.stringify(mediaRequestB._toJmpScrRequest())
165
+ JSON.stringify(streamRequestA._toJmpStreamRequest()) ===
166
+ JSON.stringify(streamRequestB._toJmpStreamRequest())
167
167
  );
168
168
  }
169
169
 
170
170
  /**
171
- * Compares new media requests to previous ones and determines
171
+ * Compares new stream requests to previous ones and determines
172
172
  * if they are the same.
173
173
  *
174
- * @param {WcmeMediaRequest[]} newRequests - Array with new requests.
174
+ * @param {StreamRequest[]} newRequests - Array with new requests.
175
175
  * @returns {boolean} - True if they are equal, false otherwise.
176
176
  */
177
- private checkIsNewRequestsEqualToPrev(newRequests: WcmeMediaRequest[]) {
177
+ private checkIsNewRequestsEqualToPrev(newRequests: StreamRequest[]) {
178
178
  return (
179
- !isEmpty(this.previousWCMEMediaRequests) &&
180
- this.previousWCMEMediaRequests.length === newRequests.length &&
181
- this.previousWCMEMediaRequests.every((req, idx) => this.isEqual(req, newRequests[idx]))
179
+ !isEmpty(this.previousStreamRequests) &&
180
+ this.previousStreamRequests.length === newRequests.length &&
181
+ this.previousStreamRequests.every((req, idx) => this.isEqual(req, newRequests[idx]))
182
182
  );
183
183
  }
184
184
 
@@ -222,23 +222,23 @@ export class MediaRequestManager {
222
222
  }
223
223
 
224
224
  /**
225
- * Clears the previous media requests.
225
+ * Clears the previous stream requests.
226
226
  *
227
227
  * @returns {void}
228
228
  */
229
229
  public clearPreviousRequests(): void {
230
- this.previousWCMEMediaRequests = [];
230
+ this.previousStreamRequests = [];
231
231
  }
232
232
 
233
233
  private sendRequests() {
234
- const wcmeMediaRequests: WcmeMediaRequest[] = [];
234
+ const streamRequests: StreamRequest[] = [];
235
235
 
236
236
  const clientRequests = this.getDegradedClientRequests();
237
237
 
238
- // map all the client media requests to wcme media requests
238
+ // map all the client media requests to wcme stream requests
239
239
  Object.values(clientRequests).forEach((mr) => {
240
- wcmeMediaRequests.push(
241
- new WcmeMediaRequest(
240
+ streamRequests.push(
241
+ new StreamRequest(
242
242
  mr.policyInfo.policy === 'active-speaker'
243
243
  ? Policy.ActiveSpeaker
244
244
  : Policy.ReceiverSelected,
@@ -270,9 +270,9 @@ export class MediaRequestManager {
270
270
 
271
271
  //! IMPORTANT: this is only a temporary fix. This will soon be done in the jmp layer (@webex/json-multistream)
272
272
  // https://jira-eng-gpk2.cisco.com/jira/browse/WEBEX-326713
273
- if (!this.checkIsNewRequestsEqualToPrev(wcmeMediaRequests)) {
274
- this.sendMediaRequestsCallback(wcmeMediaRequests);
275
- this.previousWCMEMediaRequests = wcmeMediaRequests;
273
+ if (!this.checkIsNewRequestsEqualToPrev(streamRequests)) {
274
+ this.sendMediaRequestsCallback(streamRequests);
275
+ this.previousStreamRequests = streamRequests;
276
276
  LoggerProxy.logger.info(`multistream:sendRequests --> media requests sent. `);
277
277
  } else {
278
278
  LoggerProxy.logger.info(
@@ -3,7 +3,7 @@ import {
3
3
  MediaType,
4
4
  ReceiveSlot as WcmeReceiveSlot,
5
5
  ReceiveSlotEvents as WcmeReceiveSlotEvents,
6
- SourceState,
6
+ StreamState,
7
7
  } from '@webex/internal-media-core';
8
8
 
9
9
  import LoggerProxy from '../common/logs/logger-proxy';
@@ -14,7 +14,7 @@ export const ReceiveSlotEvents = {
14
14
  MaxFsUpdate: 'maxFsUpdate',
15
15
  };
16
16
 
17
- export type {SourceState} from '@webex/internal-media-core';
17
+ export type {StreamState} from '@webex/internal-media-core';
18
18
  export type CSI = number;
19
19
  export type MemberId = string;
20
20
  export type ReceiveSlotId = string;
@@ -40,7 +40,7 @@ export class ReceiveSlot extends EventsScope {
40
40
 
41
41
  #csi?: CSI;
42
42
 
43
- #sourceState: SourceState;
43
+ #sourceState: StreamState;
44
44
 
45
45
  /**
46
46
  * constructor - don't use it directly, you should always use meeting.receiveSlotManager.allocateSlot()
@@ -119,7 +119,7 @@ export class ReceiveSlot extends EventsScope {
119
119
 
120
120
  this.mcReceiveSlot.on(
121
121
  WcmeReceiveSlotEvents.SourceUpdate,
122
- (state: SourceState, csi?: number) => {
122
+ (state: StreamState, csi?: number) => {
123
123
  LoggerProxy.logger.log(
124
124
  `ReceiveSlot#setupEventListeners --> got source update on receive slot ${this.id}, mediaType=${this.mediaType}, csi=${csi}, state=${state}`
125
125
  );
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable valid-jsdoc */
2
- import {MediaType, SourceState} from '@webex/internal-media-core';
2
+ import {MediaType, StreamState} from '@webex/internal-media-core';
3
3
  import LoggerProxy from '../common/logs/logger-proxy';
4
4
  import EventsScope from '../common/events/events-scope';
5
5
 
@@ -233,7 +233,7 @@ export class RemoteMedia extends EventsScope {
233
233
  /**
234
234
  * Getter for source state
235
235
  */
236
- public get sourceState(): SourceState {
236
+ public get sourceState(): StreamState {
237
237
  return this.receiveSlot?.sourceState;
238
238
  }
239
239