From fbdc4bced9d3bc61be958ce5289c65326704c34c Mon Sep 17 00:00:00 2001 From: Bryce Tham Date: Fri, 31 May 2024 13:03:05 -0400 Subject: [PATCH] fix(plugin-meetings): revert peripherals MQE back to array (#3627) Co-authored-by: Bryce Tham --- .../@webex/plugin-meetings/src/constants.ts | 6 +++++ .../src/mediaQualityMetrics/config.ts | 12 +-------- .../src/statsAnalyzer/index.ts | 27 ++++++++++++------- .../test/unit/spec/stats-analyzer/index.js | 12 ++++++--- 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/packages/@webex/plugin-meetings/src/constants.ts b/packages/@webex/plugin-meetings/src/constants.ts index 690ac6d9840..60c2c8c5057 100644 --- a/packages/@webex/plugin-meetings/src/constants.ts +++ b/packages/@webex/plugin-meetings/src/constants.ts @@ -1249,6 +1249,12 @@ export const AVAILABLE_RESOLUTIONS = { export const MQA_INTERVAL = 60000; // mqa analyzer interval its fixed to 60000 +export const MEDIA_DEVICES = { + MICROPHONE: 'microphone', + SPEAKER: 'speaker', + CAMERA: 'camera', +}; + export const PSTN_STATUS = { JOINED: 'JOINED', // we have provisioned a pstn device, which can be used to connect CONNECTED: 'CONNECTED', // user is connected to audio with pstn device diff --git a/packages/@webex/plugin-meetings/src/mediaQualityMetrics/config.ts b/packages/@webex/plugin-meetings/src/mediaQualityMetrics/config.ts index c5035bc15e9..49c47681376 100644 --- a/packages/@webex/plugin-meetings/src/mediaQualityMetrics/config.ts +++ b/packages/@webex/plugin-meetings/src/mediaQualityMetrics/config.ts @@ -1,19 +1,9 @@ -import {_UNKNOWN_} from '../constants'; - export const emptyMqaInterval = { audioReceive: [], audioTransmit: [], intervalMetadata: { peerReflexiveIP: '0.0.0.0', - speakerInfo: { - deviceName: _UNKNOWN_, - }, - microphoneInfo: { - deviceName: _UNKNOWN_, - }, - cameraInfo: { - deviceName: _UNKNOWN_, - }, + peripherals: [], processAverageCPU: 0, processMaximumCPU: 0, systemAverageCPU: 0, diff --git a/packages/@webex/plugin-meetings/src/statsAnalyzer/index.ts b/packages/@webex/plugin-meetings/src/statsAnalyzer/index.ts index 316bb100d82..2fba7a75b8a 100644 --- a/packages/@webex/plugin-meetings/src/statsAnalyzer/index.ts +++ b/packages/@webex/plugin-meetings/src/statsAnalyzer/index.ts @@ -4,7 +4,14 @@ import {cloneDeep, isEmpty} from 'lodash'; import {ConnectionState} from '@webex/internal-media-core'; import EventsScope from '../common/events/events-scope'; -import {DEFAULT_GET_STATS_FILTER, STATS, MQA_INTERVAL, NETWORK_TYPE, _UNKNOWN_} from '../constants'; +import { + DEFAULT_GET_STATS_FILTER, + STATS, + MQA_INTERVAL, + NETWORK_TYPE, + MEDIA_DEVICES, + _UNKNOWN_, +} from '../constants'; import { emptyAudioReceive, emptyAudioTransmit, @@ -360,13 +367,12 @@ export class StatsAnalyzer extends EventsScope { newMqa.intervalMetadata.peerReflexiveIP = this.statsResults.connectionType.local.ipAddress; // Adding peripheral information - newMqa.intervalMetadata.speakerInfo = { - deviceName: _UNKNOWN_, - }; + newMqa.intervalMetadata.peripherals.push({information: _UNKNOWN_, name: MEDIA_DEVICES.SPEAKER}); if (this.statsResults['audio-send']) { - newMqa.intervalMetadata.microphoneInfo = { - deviceName: this.statsResults['audio-send'].trackLabel || _UNKNOWN_, - }; + newMqa.intervalMetadata.peripherals.push({ + information: this.statsResults['audio-send'].trackLabel || _UNKNOWN_, + name: MEDIA_DEVICES.MICROPHONE, + }); } const existingVideoSender = Object.keys(this.statsResults).find((item) => @@ -374,9 +380,10 @@ export class StatsAnalyzer extends EventsScope { ); if (existingVideoSender) { - newMqa.intervalMetadata.cameraInfo = { - deviceName: this.statsResults[existingVideoSender].trackLabel || _UNKNOWN_, - }; + newMqa.intervalMetadata.peripherals.push({ + information: this.statsResults[existingVideoSender].trackLabel || _UNKNOWN_, + name: MEDIA_DEVICES.CAMERA, + }); } newMqa.networkType = this.statsResults.connectionType.local.networkType; diff --git a/packages/@webex/plugin-meetings/test/unit/spec/stats-analyzer/index.js b/packages/@webex/plugin-meetings/test/unit/spec/stats-analyzer/index.js index 16b42796f3c..8bff7ab9552 100644 --- a/packages/@webex/plugin-meetings/test/unit/spec/stats-analyzer/index.js +++ b/packages/@webex/plugin-meetings/test/unit/spec/stats-analyzer/index.js @@ -776,11 +776,13 @@ describe('plugin-meetings', () => { await progressTime(); assert.strictEqual( - mqeData.intervalMetadata.microphoneInfo.deviceName, + mqeData.intervalMetadata.peripherals.find((val) => val.name === MEDIA_DEVICES.MICROPHONE) + .information, 'fake-microphone' ); assert.strictEqual( - mqeData.intervalMetadata.cameraInfo.deviceName, + mqeData.intervalMetadata.peripherals.find((val) => val.name === MEDIA_DEVICES.CAMERA) + .information, 'fake-camera' ); }); @@ -794,11 +796,13 @@ describe('plugin-meetings', () => { await progressTime(); assert.strictEqual( - mqeData.intervalMetadata.microphoneInfo.deviceName, + mqeData.intervalMetadata.peripherals.find((val) => val.name === MEDIA_DEVICES.MICROPHONE) + .information, _UNKNOWN_ ); assert.strictEqual( - mqeData.intervalMetadata.cameraInfo.deviceName, + mqeData.intervalMetadata.peripherals.find((val) => val.name === MEDIA_DEVICES.CAMERA) + .information, _UNKNOWN_ ); });