Skip to content

Commit

Permalink
fix(plugin-meetings): update isMain in MQA (#3354)
Browse files Browse the repository at this point in the history
Co-authored-by: Bryce Tham <[email protected]>
  • Loading branch information
brycetham and brycetham authored Feb 6, 2024
1 parent 89572ad commit 13645e2
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 20 deletions.
4 changes: 4 additions & 0 deletions packages/@webex/plugin-meetings/src/statsAnalyzer/mqaUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
],
},
Expand All @@ -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',
},
],
},
Expand All @@ -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',
},
],
},
Expand All @@ -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',
},
],
},
Expand All @@ -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]],
},
}),
};
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand Down

0 comments on commit 13645e2

Please sign in to comment.