The in-call audio-and-video statistics reflect the overall quality of a call after the SDK joins a channel and are reported once every two seconds.

The statistics include the:

  • Uplink and downlink ratings of each user in the channel.
  • Audio statistics of the remote users:
    • End-to-end audio statistics.
    • Transport-layer audio statistics.
  • Video statistics of the remote users:
    • End-to-end video statistics.
    • Transport-layer video statistics.
  • Video statistics of the local user.
    • Sent frame rate and bitrate.

Feature Description

After joining a channel, you can get the ratings of the uplink or downlink last-mile network quality of each user/host in a channel through the onNetworkQuality callback.

The onNetworkQuality callback uses the uid parameter. If a channel has multiple users/hosts, the SDK triggers this callback as many times. The ratings include:

  • txQuality: The uplink last-mile (from the device to the Agora edge server) network quality rating (EXCELLENT~VBAD) [1] in terms of:
    • The ratio of the sent uplink video bitrate to the target uplink bitrate. The higher the ratio, the higher the quality.
    • The uplink packet loss rate.
    • The average round-trip time (RTT).
    • The uplink jitter.
  • rxQuality: The downlink last-mile network quality rating (EXCELLENT~VBAD) [1] in terms of:
    • The downlink packet loss rate.
    • The average round-trip time (RTT).
    • The downlink jitter.

[1] Quality Rating Table:

Rating Description
0 UNKNOWN: The network quality is unknown.
1 EXCELLENT: The network quality is excellent.
2 GOOD: The network quality is quite good, but the bitrate may be slightly lower than excellent.
3 POOR: Users can feel the communication slightly impaired.
4 BAD: Users cannot communicate smoothly.
5 VBAD: The network is so bad that users can barely communicate.

API Reference

onNetworkQuality

void onNetworkQuality(int uid, int txQuality, int rxQuality) {
    }

Considerations

Here are the differences between the onNetworkQuality and onLastmileQuality callbacks:

onNetworkQuality:

  • The SDK triggers the onNetworkQuality callback after a user joins a channel.
  • The onNetworkQuality reports the uplink and downlink last-mile quality between the device of each user/host in a channel and Agora's edge server.
  • If a channel has multiple channels, the SDK triggers the onNetworkQuality callback as many times.

onLastmileQuality:

  • The SDK triggers the onLastmileQuality callback when a user calls the enableLastmileTest method before joining a channel.
  • The onLastmileQuality callback reports the uplink and downlink last-mile quality between the local device and Agora's edge server.

Audio Statistics of the Remote Users

Feature Description

As shown in the figure above, this feature reports the end-to-end audio quality and of the transport layer.

  • onRemoteAudioStats: The SDK triggers this callback once every two seconds to report the end-to-end quality of a remote audio stream that is closely linked to the real-user experience. This callback returns the following information:
    • quality: Audio quality rating at the receiver's end (EXCELLENT~VBAD) [2].
    • networkTransportDelay: Network delay in the transport layer (ms); networkTransportDelay = Delay 2 + Delay 3 + Delay 4.
    • jitterBufferDelay: Jitter buffer delay at the receiver's end (ms); jitterBufferDelay = Delay 5.
    • audioLossRate: Audio packet loss rate (%).
  • onRemoteAudioTransportStats: The SDK triggers this callback once every two seconds to report the transport layer quality of a remote audio stream. This callback returns the following information:
    • delay: Network delay in the transport layer (ms); delay = Delay 2 + Delay 3 + Delay 4.
    • lost: Audio packet loss rate in the transport layer (%); lost = (packetLoss 2 + packetLoss 3 + packetLoss 4) / totalPacketsSent.
    • rxKBitRate: Received audio bitrate (Kbps).

[2] See the quality rating table.

API Reference

void onRemoteAudioStats(RemoteAudioStats stats) {
    }
void onRemoteAudioTransportStats(int uid, int delay, int lost, int rxKBitRate) {
    }

Considerations

Here is the difference between the onRemoteAudioStats and onRemoteAudioTransportStats callbacks:

  • The onRemoteAudioTransportStats callback reports the network quality between the Agora edge servers at the two ends with objective audio statistics, such as the packet loss rate and network delay.
  • The onRemoteAudioStats callback reports the overall audio quality from end to end that is closely linked to the real-user experience. Schemes such as FEC (Forward Error Correction) or retransmission counter the frame loss rate. Hence, users may find the overall audio quality acceptable even when the packet loss rate is high.

Video Statistics of the Remote Users

Feature Description

As shown in the figure above, this feature reports the video quality of the end-to-end and transport layer.

  • onRemoteVideoStats: The SDK triggers this callback once every two seconds to report the end-to-end quality of a remote video stream that is closely linked to the real-user experience. This callback returns the following information:
    • receivedBitrate: Received bitrate (Kbps).
    • receivedFrameRate: Received frame rate (fps).
    • rxStreamType: Received stream type.
  • onRemoteVideoTransportStats: The SDK triggers this callback once every two seconds to report the transport layer quality of a remote video stream. This callback returns the following information:
    • delay: Network delay in the transport layer (ms); delay = Delay 2 + Delay 3 + Delay 4.
    • lost: Video packet loss rate in the transport layer (%); lost = (packetLoss 2 + packetLoss 3 + packetLoss 4) / totalPacketsSent.
    • rxKBitRate: Received video bitrate (Kbps).

API Reference

Considerations

Here is the difference between the onRemoteVideoTransportStats and onRemoteVideoStats callbacks:

  • The onRemoteVideoTransportStats callback reports the network quality between the Agora edge servers at the two ends with objective video statistics, such as the packet loss rate and network delay.
  • The onRemoteVideoStats callback reports the overall video quality from end to end that is closely linked to the real-user experience.

Video Statistics of the Local User

Feature Description

This feature reports the video quality of the local video stream.

  • onLocalVideoStats: The SDK triggers this callback once every two seconds to report the video quality of the local video stream. This callback returns the following information:
    • sentBitrate: Sent bitrate (Kbps).
    • sentFrameRate: Sent frame rate (fps).

API Reference

onLocalVideoStats

void onLocalVideoStats(LocalVideoStats stats) {
    }