Skip to content

Commit

Permalink
squash: Log number of hidden participants.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev committed Feb 20, 2024
1 parent 7323325 commit 570cd80
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
22 changes: 22 additions & 0 deletions src/main/kotlin/org/jitsi/jibri/selenium/pageobjects/CallPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,28 @@ class CallPage(driver: RemoteWebDriver) : AbstractPageObject(driver) {
}
}

/** How many of the participants are hidden or hiddenFromRecorder. */
fun numHiddenParticipants(): Int {
val result = driver.executeScript(
"""
try {
return APP.conference._room.getParticipants()
.filter(p => (p.isHidden() || p.isHiddenFromRecorder())
.length;
} catch (e) {
return e.message;
}
""".trimMargin()
)
return when (result) {
is Number -> result.toInt()
else -> {
logger.error("error running numHiddenParticipants script: $result ${result::class.java}")
0
}
}
}

/**
* Return true if ICE is connected.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ class MediaReceivedStatusCheck(
val numParticipants = callPage.getNumParticipants() - 1
val numMutedParticipants = callPage.numRemoteParticipantsMuted()
val numJigasiParticipants = callPage.numRemoteParticipantsJigasi()
val numHiddenParticipants = callPage.numHiddenParticipants()
// We don't get any mute state for Jigasi participants, so to prevent timing out when only Jigasi participants
// may be speaking, always count them as "muted"
val allClientsMuted = (numMutedParticipants + numJigasiParticipants) == numParticipants
logger.info(
"Jibri client receive bitrates: $bitrates, num participants: $numParticipants, " +
"numMutedParticipants: $numMutedParticipants, numJigasis: $numJigasiParticipants, " +
"all clients muted? $allClientsMuted"
"numHiddenParticipants: $numHiddenParticipants, all clients muted? $allClientsMuted"
)
clientsAllMutedTransitionTime.maybeUpdate(allClientsMuted)
val downloadBitrate = bitrates.getOrDefault("download", 0L) as Long
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class MediaReceivedStatusCheckTest : ShouldSpec() {
override fun isolationMode(): IsolationMode? = IsolationMode.InstancePerLeaf

private val clock: FakeClock = spyk()
private val callPage: CallPage = mockk()
private val callPage: CallPage = mockk {
every { numHiddenParticipants() } returns 0
}
private val logger: Logger = mockk(relaxed = true)

private val check = MediaReceivedStatusCheck(logger, clock)
Expand Down

0 comments on commit 570cd80

Please sign in to comment.