CallHealthMonitor

class CallHealthMonitor(val call: Call, val callScope: CoroutineScope, val onIceRecoveryFailed: () -> Unit)

Monitors

  • Publisher and subscriber Peer connection states -> immediately reconnect

  • Network up/down -> mark down instantly when down. reconnect when up

  • Interval every 2 seconds. check and decide what to do

Calls call.reconnectOrSwitchSfu() when needed

Notes

  • There is a delay after a restart till connections show healthy again

  • So we shouldn't immediately try to reconnect if we're already reconnecting

Constructors

Link copied to clipboard
constructor(call: Call, callScope: CoroutineScope, onIceRecoveryFailed: () -> Unit)

Properties

Link copied to clipboard
val badStates: List<PeerConnection.PeerConnectionState>
Link copied to clipboard
val badStatesExcludingClosed: List<PeerConnection.PeerConnectionState>
Link copied to clipboard
val call: Call
Link copied to clipboard
val callScope: CoroutineScope
Link copied to clipboard
val goodStates: List<PeerConnection.PeerConnectionState>
Link copied to clipboard

Functions

Link copied to clipboard

Checks the peer connection states. Launches reconnect() if not healthy

Link copied to clipboard
suspend fun reconnect(forceRestart: Boolean)

Only 1 reconnect attempt runs at the same time Will skip if we already tried to reconnect less than reconnectDebounceMs ms ago

Link copied to clipboard
fun start()
Link copied to clipboard
fun stop()
Link copied to clipboard
fun stopTimer()