Skip to content

Commit

Permalink
fix(plugin-meetings): revert peripherals MQE back to array (#3627)
Browse files Browse the repository at this point in the history
Co-authored-by: Bryce Tham <[email protected]>
  • Loading branch information
brycetham and Bryce Tham authored May 31, 2024
1 parent 165d0f2 commit fbdc4bc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 25 deletions.
6 changes: 6 additions & 0 deletions packages/@webex/plugin-meetings/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
27 changes: 17 additions & 10 deletions packages/@webex/plugin-meetings/src/statsAnalyzer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -360,23 +367,23 @@ 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) =>
item.includes('video-send')
);

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
});
Expand All @@ -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_
);
});
Expand Down

0 comments on commit fbdc4bc

Please sign in to comment.