Report In-call Statistics
Update time: 2025/06/11 16:45:39
In a call scenario, developers often need to be aware of information such as the current call quality and device status so as to monitor the overall experience of the call. They can also present part of the quality data to the user at the UI level, helping users to promptly understand the overall quality of the current call.
The NERTC SDK supports the real-time callback of key indicators like audio and video conditions, network conditions and device status to the APP application layer, and after that, the application layer can display or statisticize the received data.
Uplink and downlink network quality synchronization
The callback of onNetworkQuality allows the synchronization of the uplink and downlink network quality of each member in the current call.
- The uplink network quality score is calculated based on the actual transmission code rate, the uplink network packet loss rate, the average round-trip delay and the uplink network jitter.
- The downlink network quality score is calculated based on the downlink network packet loss rate, the average round-trip delay and the downlink network jitter.
Note:
- In every 2 seconds, you will receive the network quality synchronization from all users in the room.
- The higher the ratio of the actual transmission code rate to the target transmission code rate, the better the call quality under the network, and the higher the network quality score.
Statistics synchronization
The callback of onRtcStats allows the synchronization of local call statistics. Such statistics information includes the duration of call, the number of people in the current call room, the CPU utilization of current system, the CPU utilization of the current App, and other important data.
| Parameter | Description |
| cpuAppUsage and cpuTotalUsage | CPU utilization of App, and CPU utilization of system. |
| memoryAppUsageRatio, memoryAppUsageInKBytes, and memoryTotalUsageRatio | Memory utilization of App, memory usage of App, and memory utilization of system |
| totalDuration | Total duration of call (in sec). |
| txBytes/rxBytes | Cumulative number of sent/received bytes. |
| txAudioBytes/rxAudioBytes | Sent/received bytes of audio. |
| txVideoBytes/rxVideoBytes | Sent/received bytes of video. |
| txAudioKBitRate/rxAudioKBitRate | Audio receiving/sending code rate (in kbps). |
| txVideoKBitRate/rxVideoKBitRate | Video receiving/sending code rate (in kbps). |
| upRtt/downRtt | Average round-trip delay for uplink/downlink (in ms). |
| txAudioPacketLossRate/rxAudioPacketLossRate | Actual packet loss rate of local uplink/downlink audio. |
| txAudioPacketLossSum/rxAudioPacketLossSum | Actual packet loss of local uplink/downlink audio. |
| txAudioJitter/rxAudioJitter | Jitter for local uplink/downlink audio (in ms). |
| txVideoJitter/rxVideoJitter | Jitter for local uplink/downlink video (in ms). |
| txVideoPacketLossRate/rxVideoPacketLossRate | Actual packet loss rate of local uplink/downlink video. |
| txVideoPacketLossSum/rxVideoPacketLossSum | Actual packet loss of local uplink/downlink video. |
Audio quality synchronization
Local audio stream stats synchronization
The callback of onLocalAudioStats sends you the statistics information of the audio stream synchronized with the local device. Such statistics information includes the number of sound channels (mono or dual) in the current call, the sample rate of the transmitted audio, and the bitrate of the transmitted audio. The SDK will automatically trigger this callback every 2 seconds.
| Parameter | Description |
|---|---|
| numChannels | A number of currently collected sound channels. |
| sentSampleRate | Sample rate of local uplink audio within the statistical period (in Hz). |
| kbps | Average sending code rate within the statistical period (in Kbps). |
| lossRate | Audio packet loss rate within a specific period. |
| rtt | Average round-trip delay (RTT). |
| volume | Volume range is 0 to 100 |
Remote audio stream stats synchronization
The callback of onRemoteAudioStats allows allows the synchronization of the audio stream statistics of each remote user in the current call to you. Such statistics information includes the quality of audio stream and the number of sound channels sent by each remote user. In every 2 seconds you will receive the network quality synchronization from all remote users in the room.
| Parameter | Description |
| uid | User ID; used to specify the owner of a specific audio stream. |
| kbps | Average receiving code rate within the statistical period (in Kbps). |
| totalFrozenTime | Accumulated duration of audio freeze after a remote user joins a room (in ms). The audio stream with an audio frame loss rate of 4% within a statistical period is recorded as an audio freeze. |
| frozenRate | Average freezing rate of downlink audio for remote users. It is calculated as the percentage of the accumulated duration of audio freeze that a remote user has experienced after joining a room to the total effective duration of the audio. |
| lossRate | Frame loss rate of remote audio stream within the statistical period. |
| volume | Volume range is 0 to 100 |
Video quality synchronization
Local video stream stats synchronization
The callback of onLocalVideoStats sends you the statistics of the video stream synchronized with the local device. You can obtain information such as video encoding width/height. The SDK will automatically trigger this callback every 2 seconds.
If you have previously called the enableDualStreamMode method to enable dual-stream mode, this callback will function to describe the statistics of the large video stream sent by the local device.
| Parameter | Description |
| layerType | Video stream channel type. 1: main stream; 2: SubStream. |
| width | Video encoding width (in px). |
| height | Video encoding height (in px). |
| captureFrameRate | Video collection frame rate (in fps). |
| renderFrameRate | Video rendering frame rate (in fps). |
| encoderOutputFrameRate | Encoding frame rate (in fps). |
| sentFrameRate | Actual sending frame rate (in fps), which does not cover the sending frame rate for resending video after packet loss. |
| sendBitrate | Actual sending code rate (in kbps), which does not cover the sending code rate for resending video after packet loss. |
| targetBitrate | Target encoding rate of current encoder (in kbps), which is estimated by SDK based on current network conditions. |
| encoderBitrate | Actual encoding rate of encoder (in Kbps). |
| encoderName | Video encoder name. |
Remote video stream stats synchronization
The callback of onRemoteVideoStats allows the synchronization of the statistics of the video stream of each remote user/host in the current call. Such statistics information includes video width/height and other parameter information of each remote user. The SDK will automatically trigger this callback every 2 seconds.
| Parameter | Description |
| layerType | Video stream channel type. 1: main stream; 2: SubStream. |
| width | Remote video encoding width (in px). |
| height | Remote video encoding height (in px). |
| receivedBitrate | Receiving code rate (in Kbps). |
| fps | Receiving frame rate (in fps). |
| decoderOutputFrameRate | Decoding frame rate (in fps). |
| rendererOutputFrameRate | Rendering frame rate (in fps). |
| packetLossRate | Remote video downlink packet loss rate. |
| totalFrozenTime | Accumulated duration of downlink video freeze after a remote user joins a room (in ms). |
| frozenRate | Average freezing rate of downlink video after a remote user joins a room. It is calculated as the percentage of the accumulated duration of video freeze to the total effective duration of the video. |
| decoderName | Video encoder name. |
Method
- You can register a quality monitoring observer (NERtcStatsObserver), and actively set the corresponding callback through NERtc.getInstance().setStatsObserver.
- If you want to disable the quality monitoring function, just input null.
Sample code
NERtc.getInstance().setStatsObserver(NERtcStatsObserver)
API reference
| Class | Function description |
|---|---|
| NERtcStatsObserver | Statistics callback class |
| Event | Function description |
|---|---|
| onRtcStats | Callback of current call statistics |
| onLocalAudioStats | Callback of local audio stream statistics |
| onRemoteAudioStats | Callback of remote audio stream statistics |
| onLocalVideoStats | Callback of local video stream statistics |
| onRemoteVideoStats | Callback of remote video stream statistics |
| onNetworkQuality | Callback of network status of all users |





