LatencyTracker class
Tracks and calculates latency metrics for WebRTC call establishment.
This class provides detailed timing information for:
- Registration latency: Time from login to CLIENT_READY
- Inbound call latency: Time from acceptCall() to first RTP packet
- Outbound call latency: Time from newInvite() to first RTP packet
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isTrackingRegistration → bool
-
Whether registration tracking is currently in progress.
no setter
-
latencyMetricsStream
→ Stream<
LatencyMetrics> -
Stream of latency metrics updates.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
calculateAnswerDelay(
String callId) → int? - Calculates the answer delay for inbound calls. This is the time from invite received to user answering.
-
calculateRemoteAnswerTime(
String callId) → int? - Calculates the time for remote side to answer (outbound calls). This is from invite sent to call answered.
-
cancelCallTracking(
String callId) → void - Cancels tracking for a call (e.g., if call fails).
-
completeCallTracking(
String callId) → void - Completes call tracking and emits the final metrics. Call this when the call reaches ACTIVE state.
-
completeRegistrationTracking(
) → void - Completes registration tracking and emits metrics. Call this when CLIENT_READY is received.
-
dispose(
) → void - Disposes resources.
-
getCurrentCallMetrics(
String callId) → LatencyMetrics? - Gets current metrics snapshot for a call in progress.
-
markAnswerInitiated(
String callId) → void - Marks when the user initiates answering an inbound call. Call this at the start of acceptCall().
-
markCallAnsweredByRemote(
String callId) → void - Marks when the remote side answers the call (outbound calls). Call this when SIP 200 OK or equivalent is received.
-
markCallMilestone(
String callId, String milestone) → void - Records a milestone for a specific call.
-
markFirstRtp(
String callId, {bool isSent = false}) → void - Marks when the first RTP packet is sent or received.
-
markFirstSrflxRelayCandidate(
String callId, String candidateType) → void - Marks when the first server-reflexive or relay ICE candidate is found.
-
markInviteReceived(
String callId) → void - Marks when an inbound call invite is received. Call this when the invite arrives, before user answers.
-
markMediaDevicesAcquired(
String callId) → void - Marks when media devices (microphone/camera) are acquired.
-
markPeerSetupComplete(
String callId) → void - Marks when peer setup is complete.
-
markRegistrationMilestone(
String milestone) → void - Records a milestone during registration.
-
markRemoteRinging(
String callId) → void - Marks when the remote side starts ringing (outbound calls). Call this when SIP 180 Ringing or equivalent is received.
-
markSdpNegotiationStarted(
String callId) → void - Marks when SDP negotiation starts (createOffer/createAnswer).
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void - Clears all tracking state.
-
setLatencyMetricsListener(
LatencyMetricsCallback? listener) → void - Sets the callback for latency metrics updates.
-
startCallTracking(
String callId, {bool isOutbound = false}) → void -
Starts tracking latency for a new call.
callIdThe unique identifier for the call.isOutboundTrue for outbound calls, false for inbound. -
startRegistrationTracking(
) → void - Starts tracking registration latency. Call this when login/connect is initiated.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- milestoneAnswerInitiated → const String
- milestoneAnswerSent → const String
- milestoneCallActive → const String
- milestoneCallAnsweredByRemote → const String
- milestoneCallInitiated → const String
- milestoneClientReady → const String
- milestoneDtlsConnected → const String
- milestoneDtlsConnecting → const String
- milestoneFirstIceCandidate → const String
- milestoneFirstRtpReceived → const String
- milestoneFirstRtpSent → const String
- milestoneFirstSrflxRelayCandidate → const String
- milestoneIceChecking → const String
- milestoneIceCompleted → const String
- milestoneIceConnected → const String
- milestoneIceGatheringComplete → const String
- milestoneIceGatheringStarted → const String
- milestoneInviteReceived → const String
- milestoneInviteSent → const String
- milestoneLocalSdpCreated → const String
- milestoneLocalSdpSet → const String
- milestoneLoginInitiated → const String
- milestoneLoginSent → const String
- milestoneMediaActive → const String
- milestoneMediaDevicesAcquired → const String
- milestonePeerConnected → const String
- milestonePeerCreated → const String
- milestonePeerSetupComplete → const String
- milestoneRemoteRinging → const String
- milestoneRemoteSdpReceived → const String
- milestoneRemoteSdpSet → const String
- milestoneSdpNegotiationStarted → const String
- milestoneSocketConnected → const String