Display audio levels for each participant in group calls.

This commit is contained in:
Rashad Sookram
2022-04-01 17:09:56 -04:00
committed by Cody Henthorne
parent a9f208153c
commit ec92d5ddb7
19 changed files with 379 additions and 32 deletions

View File

@@ -16,6 +16,7 @@ data class CallParticipant constructor(
val isVideoEnabled: Boolean = false,
val isMicrophoneEnabled: Boolean = false,
val lastSpoke: Long = 0,
val audioLevel: AudioLevel? = null,
val isMediaKeysReceived: Boolean = true,
val addedToCallTime: Long = 0,
val isScreenSharing: Boolean = false,
@@ -73,6 +74,33 @@ data class CallParticipant constructor(
PRIMARY, SECONDARY
}
enum class AudioLevel {
LOWEST,
LOW,
MEDIUM,
HIGH,
HIGHEST;
companion object {
/**
* Converts a raw audio level from RingRTC (value in [0, 32767]) to a level suitable for
* display in the UI.
*/
@JvmStatic
fun fromRawAudioLevel(raw: Int?): AudioLevel? {
return when {
raw == null -> null
raw < 500 -> LOWEST
raw < 2000 -> LOW
raw < 8000 -> MEDIUM
raw < 20000 -> HIGH
else -> HIGHEST
}
}
}
}
companion object {
@JvmField
val EMPTY: CallParticipant = CallParticipant()