Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin-meetings): streamline is active speaker mqa #3597

Merged
merged 9 commits into from
Jul 5, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export const emptyVideoReceiveStream = {
ssci: 0, // Not avaliable
},
h264CodecProfile: 'BP',
isActiveSpeaker: true,
isActiveSpeaker: false,
optimalFrameSize: 0, // Not avaliable
receivedFrameSize: 0,
receivedHeight: 0,
Expand Down
5 changes: 5 additions & 0 deletions packages/@webex/plugin-meetings/src/statsAnalyzer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,11 @@ export class StatsAnalyzer extends EventsScope {
this.statsResults[mediaType][sendrecvType].totalSamplesDecoded =
result.totalSamplesDecoded || 0;
this.statsResults[mediaType][sendrecvType].concealedSamples = result.concealedSamples || 0;
this.statsResults[mediaType][sendrecvType].isActiveSpeaker =
result.isActiveSpeaker ||
(result.lastActiveSpeakerUpdateTimestamp &&
performance.timeOrigin + performance.now() - result.lastActiveSpeakerUpdateTimestamp <
60000);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ export const getVideoReceiverStreamMqa = ({
statsResults[mediaType][sendrecvType].keyFramesDecoded - lastKeyFramesDecoded || 0;
videoReceiverStream.requestedKeyFrames =
statsResults[mediaType][sendrecvType].totalPliCount - lastPliCount || 0;
videoReceiverStream.isActiveSpeaker =
statsResults[mediaType][sendrecvType].isActiveSpeaker || false;
};

export const getVideoSenderMqa = ({videoSender, statsResults, lastMqaDataSent, baseMediaType}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,8 @@ describe('plugin-meetings', () => {
framesReceived: 0,
packetsLost: 0,
packetsReceived: 0,
isActiveSpeaker: false,
lastActiveSpeakerUpdateTimestamp: 0,
},
{
type: 'remote-outbound-rtp',
Expand Down Expand Up @@ -1456,7 +1458,7 @@ describe('plugin-meetings', () => {
framesDropped: 0,
},
h264CodecProfile: 'BP',
isActiveSpeaker: true,
isActiveSpeaker: false,
optimalFrameSize: 0,
receivedFrameSize: 3600,
receivedHeight: 720,
Expand Down Expand Up @@ -1490,7 +1492,7 @@ describe('plugin-meetings', () => {
framesDropped: 0,
},
h264CodecProfile: 'BP',
isActiveSpeaker: true,
isActiveSpeaker: false,
optimalFrameSize: 0,
receivedFrameSize: 3600,
receivedHeight: 720,
Expand Down Expand Up @@ -1554,7 +1556,7 @@ describe('plugin-meetings', () => {
framesDropped: 0,
},
h264CodecProfile: 'BP',
isActiveSpeaker: true,
isActiveSpeaker: false,
optimalFrameSize: 0,
receivedFrameSize: 3600,
receivedHeight: 720,
Expand Down Expand Up @@ -1586,7 +1588,7 @@ describe('plugin-meetings', () => {
framesDropped: 0,
},
h264CodecProfile: 'BP',
isActiveSpeaker: true,
isActiveSpeaker: false,
optimalFrameSize: 0,
receivedFrameSize: 3600,
receivedHeight: 720,
Expand Down Expand Up @@ -1618,7 +1620,7 @@ describe('plugin-meetings', () => {
framesDropped: 0,
},
h264CodecProfile: 'BP',
isActiveSpeaker: true,
isActiveSpeaker: false,
optimalFrameSize: 0,
receivedFrameSize: 3600,
receivedHeight: 720,
Expand Down Expand Up @@ -1814,6 +1816,26 @@ describe('plugin-meetings', () => {
}
]);
});
it('should emit active speaker status', async () => {
it('should mark active speaker as true', async () => {
fakeStats.video.receivers[0].report[0].isActiveSpeaker = true;
await startStatsAnalyzer();
await progressTime(MQA_INTERVAL);
assert.strictEqual(mqeData.videoReceive[0].streams[0].isActiveSpeaker, true);
})
it('should mark active speaker as true if it was active speaker within the last 60 seconds', async () =>{
fakeStats.video.receivers[0].report[0].lastActiveSpeakerUpdateTimestamp = performance.timeOrigin + performance.now() - 30 * 1000;
fakeStats.video.receivers[0].report[0].isActiveSpeaker = false;
await progressTime(MQA_INTERVAL);
assert.strictEqual(mqeData.videoReceive[0].streams[0].isActiveSpeaker, true);
})
it('should not mark active speaker as true if it was not active speaker within the last 60 seconds', async () =>{
fakeStats.video.receivers[0].report[0].lastActiveSpeakerUpdateTimestamp = performance.timeOrigin + performance.now() + 30 * 1000;
fakeStats.video.receivers[0].report[0].isActiveSpeaker = false;
await progressTime(MQA_INTERVAL);
assert.strictEqual(mqeData.videoReceive[0].streams[0].isActiveSpeaker, false);
})
})
});
});
});
Loading