From 13645e2e2400083c1084f87a1f90aebbf4a6bc6e Mon Sep 17 00:00:00 2001 From: Bryce Tham Date: Tue, 6 Feb 2024 04:28:04 -0500 Subject: [PATCH] fix(plugin-meetings): update isMain in MQA (#3354) Co-authored-by: Bryce Tham --- .../src/statsAnalyzer/mqaUtil.ts | 4 ++ .../test/unit/spec/stats-analyzer/index.js | 67 +++++++++++++------ 2 files changed, 51 insertions(+), 20 deletions(-) diff --git a/packages/@webex/plugin-meetings/src/statsAnalyzer/mqaUtil.ts b/packages/@webex/plugin-meetings/src/statsAnalyzer/mqaUtil.ts index 4be643ef99e..b87f627adb6 100644 --- a/packages/@webex/plugin-meetings/src/statsAnalyzer/mqaUtil.ts +++ b/packages/@webex/plugin-meetings/src/statsAnalyzer/mqaUtil.ts @@ -23,6 +23,7 @@ export const getAudioReceiverMqa = ({audioReceiver, statsResults, lastMqaDataSen } audioReceiver.common.common.direction = statsResults[mediaType].direction; + audioReceiver.common.common.isMain = !mediaType.includes('-share'); audioReceiver.common.transportType = statsResults.connectionType.local.transport; // add rtpPacket info inside common as also for call analyzer @@ -83,6 +84,7 @@ export const getAudioSenderMqa = ({audioSender, statsResults, lastMqaDataSent, m } audioSender.common.common.direction = statsResults[mediaType].direction; + audioSender.common.common.isMain = !mediaType.includes('-share'); audioSender.common.transportType = statsResults.connectionType.local.transport; audioSender.common.maxRemoteJitter = @@ -146,6 +148,7 @@ export const getVideoReceiverMqa = ({videoReceiver, statsResults, lastMqaDataSen } videoReceiver.common.common.direction = statsResults[mediaType].direction; + videoReceiver.common.common.isMain = !mediaType.includes('-share'); videoReceiver.common.transportType = statsResults.connectionType.local.transport; // collect the packets received for the last min @@ -226,6 +229,7 @@ export const getVideoSenderMqa = ({videoSender, statsResults, lastMqaDataSent, m } videoSender.common.common.direction = statsResults[mediaType].direction; + videoSender.common.common.isMain = !mediaType.includes('-share'); videoSender.common.transportType = statsResults.connectionType.local.transport; // @ts-ignore 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 5f0e0ead2d6..fea7dc253c5 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 @@ -130,17 +130,17 @@ describe('plugin-meetings', () => { { type: 'candidate-pair', state: 'succeeded', - localCandidateId: 'fake-candidate-id' + localCandidateId: 'fake-candidate-id', }, { type: 'candidate-pair', state: 'failed', - localCandidateId: 'bad-candidate-id' + localCandidateId: 'bad-candidate-id', }, { type: 'local-candidate', id: 'fake-candidate-id', - protocol: 'tcp' + protocol: 'tcp', }, ], }, @@ -156,17 +156,17 @@ describe('plugin-meetings', () => { { type: 'candidate-pair', state: 'succeeded', - localCandidateId: 'fake-candidate-id' + localCandidateId: 'fake-candidate-id', }, { type: 'candidate-pair', state: 'failed', - localCandidateId: 'bad-candidate-id' + localCandidateId: 'bad-candidate-id', }, { type: 'local-candidate', id: 'fake-candidate-id', - protocol: 'tcp' + protocol: 'tcp', }, ], }, @@ -185,17 +185,17 @@ describe('plugin-meetings', () => { { type: 'candidate-pair', state: 'succeeded', - localCandidateId: 'fake-candidate-id' + localCandidateId: 'fake-candidate-id', }, { type: 'candidate-pair', state: 'failed', - localCandidateId: 'bad-candidate-id' + localCandidateId: 'bad-candidate-id', }, { type: 'local-candidate', id: 'fake-candidate-id', - protocol: 'tcp' + protocol: 'tcp', }, ], }, @@ -214,17 +214,17 @@ describe('plugin-meetings', () => { { type: 'candidate-pair', state: 'succeeded', - localCandidateId: 'fake-candidate-id' + localCandidateId: 'fake-candidate-id', }, { type: 'candidate-pair', state: 'failed', - localCandidateId: 'bad-candidate-id' + localCandidateId: 'bad-candidate-id', }, { type: 'local-candidate', id: 'fake-candidate-id', - protocol: 'tcp' + protocol: 'tcp', }, ], }, @@ -244,12 +244,12 @@ describe('plugin-meetings', () => { receivers: [fakeStats.video.receivers[0]], }, screenShareAudio: { - senders: [], - receivers: [], + senders: [fakeStats.audio.senders[0]], + receivers: [fakeStats.audio.receivers[0]], }, screenShareVideo: { - senders: [], - receivers: [], + senders: [fakeStats.video.senders[0]], + receivers: [fakeStats.video.receivers[0]], }, }), }; @@ -300,6 +300,17 @@ describe('plugin-meetings', () => { }; const checkMqeData = () => { + for (const data of [ + mqeData.audioTransmit, + mqeData.audioReceive, + mqeData.videoTransmit, + mqeData.videoReceive, + ]) { + assert.strictEqual(data.length, 2); + assert.strictEqual(data[0].common.common.isMain, true); + assert.strictEqual(data[1].common.common.isMain, false); + } + assert.strictEqual(mqeData.videoReceive[0].streams[0].receivedFrameSize, 3600); assert.strictEqual(mqeData.videoReceive[0].streams[0].receivedHeight, 720); assert.strictEqual(mqeData.videoReceive[0].streams[0].receivedWidth, 1280); @@ -422,8 +433,16 @@ describe('plugin-meetings', () => { await progressTime(); - assert.strictEqual(mqeData.intervalMetadata.peripherals.find((val) => val.name === MEDIA_DEVICES.MICROPHONE).information, 'fake-microphone'); - assert.strictEqual(mqeData.intervalMetadata.peripherals.find((val) => val.name === MEDIA_DEVICES.CAMERA).information, 'fake-camera'); + assert.strictEqual( + mqeData.intervalMetadata.peripherals.find((val) => val.name === MEDIA_DEVICES.MICROPHONE) + .information, + 'fake-microphone' + ); + assert.strictEqual( + mqeData.intervalMetadata.peripherals.find((val) => val.name === MEDIA_DEVICES.CAMERA) + .information, + 'fake-camera' + ); }); it('emits the correct peripherals in MEDIA_QUALITY events when localTrackLabel is undefined', async () => { @@ -434,8 +453,16 @@ describe('plugin-meetings', () => { await progressTime(); - assert.strictEqual(mqeData.intervalMetadata.peripherals.find((val) => val.name === MEDIA_DEVICES.MICROPHONE).information, _UNKNOWN_); - assert.strictEqual(mqeData.intervalMetadata.peripherals.find((val) => val.name === MEDIA_DEVICES.CAMERA).information, _UNKNOWN_); + assert.strictEqual( + mqeData.intervalMetadata.peripherals.find((val) => val.name === MEDIA_DEVICES.MICROPHONE) + .information, + _UNKNOWN_ + ); + assert.strictEqual( + mqeData.intervalMetadata.peripherals.find((val) => val.name === MEDIA_DEVICES.CAMERA) + .information, + _UNKNOWN_ + ); }); it('emits the correct frameRate', async () => {