mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Display audio levels for each participant in group calls.
This commit is contained in:
committed by
Cody Henthorne
parent
a9f208153c
commit
ec92d5ddb7
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user