Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
test(media) check that remote video is actually decoded after unmute
damencho6776d695e5a6
diff --git a/tests/helpers/Participant.ts b/tests/helpers/Participant.tsindex a8a230885a..46962d4cd1 100644--- a/tests/helpers/Participant.ts+++ b/tests/helpers/Participant.ts@@ -535,6 +535,26 @@ export class Participant {});}+ /**+ * Waits until the stats report a positive framerate for the video of the given remote endpoint, which means that+ * frames from that endpoint are actually being decoded. Receiving data is not enough on its own, when the sender+ * uses a payload type that was not negotiated the packets are received but not a single frame gets decoded.+ *+ * @param {string} endpointId - The endpoint ID of the participant whose video should be decoded.+ * @param {number} timeout - Max time to wait in ms.+ * @returns {Promise<boolean>}+ */+ async waitForRemoteVideoDecoding(endpointId: string, timeout = 15_000): Promise<boolean> {+ return this.driver.waitUntil(() => this.execute(id => {+ const framerates: { [ssrc: string]: number; } = APP?.conference?.getStats()?.framerate?.[id] ?? {};++ return Object.values(framerates).some(fps => fps > 0);+ }, endpointId), {+ timeout,+ timeoutMsg: `expected video of ${endpointId} to be decoded in ${timeout / 1000}s by ${this.name}`+ });+ }+/*** Waits until there are at least [number] participants that have at least one track.*diff --git a/tests/specs/media/mute.spec.ts b/tests/specs/media/mute.spec.tsindex 8d2cb626e2..19e0e45b56 100644--- a/tests/specs/media/mute.spec.ts+++ b/tests/specs/media/mute.spec.ts@@ -142,4 +142,5 @@ async function muteP1BeforeP2JoinsAndScreenshare(p2p: boolean) {await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1);await unmuteVideoAndCheck(p1, p2);await p2.waitForRemoteVideo(await p1.getEndpointId());+ await p2.waitForRemoteVideoDecoding(await p1.getEndpointId());}diff --git a/tests/specs/media/stopVideo.spec.ts b/tests/specs/media/stopVideo.spec.tsindex 25764c98bd..4ce7c0f6ee 100644--- a/tests/specs/media/stopVideo.spec.ts+++ b/tests/specs/media/stopVideo.spec.ts@@ -1,3 +1,4 @@+import type { Participant } from '../../helpers/Participant';import { setTestProperties } from '../../helpers/TestProperties';import { ensureTwoParticipants } from '../../helpers/participants';import { muteVideoAndCheck, unmuteVideoAndCheck } from '../helpers/mute';@@ -11,7 +12,7 @@ describe('Stop video', () => {it('stop video and check', () => muteVideoAndCheck(ctx.p1, ctx.p2));- it('start video and check', () => unmuteVideoAndCheck(ctx.p1, ctx.p2));+ it('start video and check', () => unmuteVideoAndCheckMedia(ctx.p1, ctx.p2));it('start video and check stream', async () => {await muteVideoAndCheck(ctx.p1, ctx.p2);@@ -19,7 +20,7 @@ describe('Stop video', () => {// now participant2 should be on large videoconst largeVideoId = await ctx.p1.getLargeVideo().getId();- await unmuteVideoAndCheck(ctx.p1, ctx.p2);+ await unmuteVideoAndCheckMedia(ctx.p1, ctx.p2);// check if video stream from second participant is still on large videoexpect(largeVideoId).toBe(await ctx.p1.getLargeVideo().getId());@@ -27,7 +28,7 @@ describe('Stop video', () => {it('stop video on participant and check', () => muteVideoAndCheck(ctx.p2, ctx.p1));- it('start video on participant and check', () => unmuteVideoAndCheck(ctx.p2, ctx.p1));+ it('start video on participant and check', () => unmuteVideoAndCheckMedia(ctx.p2, ctx.p1));it('stop video on before second joins', async () => {await ctx.p2.hangup();@@ -42,6 +43,19 @@ describe('Stop video', () => {await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1);- await unmuteVideoAndCheck(p1, p2);+ await unmuteVideoAndCheckMedia(p1, p2);});});++/**+ * Unmutes the video of testee and checks that observer sees it unmuted and that observer is decoding frames from it.+ * The mute state alone is signalled over the presence, seeing it does not mean that any media is being received.+ *+ * @param testee The participant that unmutes its video.+ * @param observer The participant that should receive and decode the video of testee.+ */+async function unmuteVideoAndCheckMedia(testee: Participant, observer: Participant): Promise<void> {+ await unmuteVideoAndCheck(testee, observer);++ await observer.waitForRemoteVideoDecoding(await testee.getEndpointId());+}