Package io.getstream.video.android.core
Class CallHealthMonitor
-
- All Implemented Interfaces:
public final class CallHealthMonitorMonitors
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
-
-
Field Summary
Fields Modifier and Type Field Description private BooleanreconnectInProgressprivate IntegerreconnectionAttemptsprivate final LongcheckIntervalprivate OffsetDateTimelastReconnectAtprivate final LongreconnectDebounceMsprivate final List<PeerConnection.PeerConnectionState>badStatesprivate final List<PeerConnection.PeerConnectionState>goodStatesprivate final Callcallprivate final CoroutineScopecallScope
-
Constructor Summary
Constructors Constructor Description CallHealthMonitor(Call call, CoroutineScope callScope)
-
Method Summary
Modifier and Type Method Description final BooleangetReconnectInProgress()final UnitsetReconnectInProgress(Boolean reconnectInProgress)final IntegergetReconnectionAttempts()final UnitsetReconnectionAttempts(Integer reconnectionAttempts)final LonggetCheckInterval()final OffsetDateTimegetLastReconnectAt()final UnitsetLastReconnectAt(OffsetDateTime lastReconnectAt)final LonggetReconnectDebounceMs()final List<PeerConnection.PeerConnectionState>getBadStates()final List<PeerConnection.PeerConnectionState>getGoodStates()final CallgetCall()final CoroutineScopegetCallScope()final Unitstart()final Unitstop()final Unitcheck()Checks the peer connection states. final Unitreconnect()Only 1 reconnect attempt runs at the same time Will skip if we already tried to reconnect less than reconnectDebounceMs ms ago final UnitmonitorPeerConnection()final UnitmonitorInterval()-
-
Constructor Detail
-
CallHealthMonitor
CallHealthMonitor(Call call, CoroutineScope callScope)
-
-
Method Detail
-
getReconnectInProgress
final Boolean getReconnectInProgress()
-
setReconnectInProgress
final Unit setReconnectInProgress(Boolean reconnectInProgress)
-
getReconnectionAttempts
final Integer getReconnectionAttempts()
-
setReconnectionAttempts
final Unit setReconnectionAttempts(Integer reconnectionAttempts)
-
getCheckInterval
final Long getCheckInterval()
-
getLastReconnectAt
final OffsetDateTime getLastReconnectAt()
-
setLastReconnectAt
final Unit setLastReconnectAt(OffsetDateTime lastReconnectAt)
-
getReconnectDebounceMs
final Long getReconnectDebounceMs()
-
getBadStates
final List<PeerConnection.PeerConnectionState> getBadStates()
-
getGoodStates
final List<PeerConnection.PeerConnectionState> getGoodStates()
-
getCallScope
final CoroutineScope getCallScope()
-
check
@Synchronized() final Unit check()
Checks the peer connection states. Launches reconnect() if not healthy
-
reconnect
final Unit reconnect()
Only 1 reconnect attempt runs at the same time Will skip if we already tried to reconnect less than reconnectDebounceMs ms ago
-
monitorPeerConnection
final Unit monitorPeerConnection()
-
monitorInterval
final Unit monitorInterval()
-
-
-
-