CloudHub Docs
Download Documents

RTC


In-call quality monitoring

Function description

After joining the channel. the SDK will automatically trigger the following callbacks related to the call quality every 2 seconds . You can understand the network quality of the current call,Geostatistics, audio quality and video quality.

onNetworkQuality callback reports to you the last mile network quality of each user/host in the current call, see Quality for detailsScore. Among them, last mile refers to the network from your device to the CloudHub edge server. Up last mileThe network quality score is based on the actual transmission code rate, uplink network packet loss rate, average round-trip delay and uplink network jitter calculation; downlink last mileThe network quality score is calculated based on the downstream network packet loss rate, average round-trip delay and downstream network jitter.

Statistics report

The onRtcStats callback reports local call statistics to you. You can know the duration of the call, the number of people in the current call channel, the currentThe CPU usage of the system, the CPU usage of the current App, and the following important parameters.

parameterdescribeRemark
txBytes/rxBytesCumulative sending/receivingThe number of bytes.The number of bytes accumulated since joining the channel.
txAudioBytes/rxAudioByteCumulative sending/receivingThe number of audio bytes.The number of bytes accumulated since joining the channel.
txVideoBytes/rxVideoBytesCumulative sending/receivingThe number of video bytes.The number of bytes accumulated since joining the channel.
txKBitRate/rxKBitRateSend/receive codeRate.Codes actually sent/received during the statistical periodRate.
txAudioKBitRate/rxAudioKBitRateAudio send/receiveBit rate.Codes actually sent/received during the statistical periodRate.
txVideoKBitRate/rxVideoKBitRateVideo send/receiveBit rate.Codes actually sent/received during the statistical periodRate.
lastmileDelayLocal client toCloudHub edgeServer network extensionLate.1. This refers to the average round-trip delayHalf, not the client to CloudHubOne-way latency of the edge server.
2. The network delay here does not distinguish between audio andVideo is the data obtained by UDP packet.
txPacketLossRateLocal client toCloudHub edgeServer packet lossRate.1. Comparison of audio and video upstream packet loss ratesGreat value.
2. Use anti-packet loss loss before technologyRate.
rxPacketLossRateCloudHub edgeServer to local clientThe packet loss rate of the client.1. Comparison of audio and video downstream packet loss ratesGreat value.
2. Use anti-packet loss loss before technologyRate.

Audio quality report

onLocalAudioStats callback reports to you the statistics of the audio stream sent by the local device. You can know the number of channels in the current call(Mono or dual-channel), the sampling rate of the transmitted audio and the bit rate of the transmitted audio. The SDK will automatically trigger this callback every 2 seconds. The sample rate of sending audio refers to the actual sample rate of sending audio during the statistical period.Send audio bit rate refers to the rate of statistical period average value.

When the status of the local audio changes (including the recording status of the local microphone and the audio encoding status), the SDK will triggerThe onLocalAudioStateChanged callback reports the current local audio state to you. When the local audio fails, you can passError code troubleshooting

onRemoteAudioStats callback reports to you the statistics of each remote user/host audio stream in the current call. You can understandThe quality of the audio stream sent by each remote user/host (see Quality Score for details), the number of channels (mono or dual), and the following important parametersinformation.

parameterdescribeRemark
networkTransportDelayAudio sender to receiverNetwork latency.Phase 2 + 3 + 4 in the figure
jitterBufferDelaySlow jitter from receiving end to networkThe network delay of the punching end.Stage 5 in the figure
audioLossRateDuring the statistical period, the actualThe received remote audio stream is lostFrame rate.1. Stage 2 + 3 + 4 + 5 in the figure
2. In a statistical period, the audio frame loss rate reaches 4%Counts as an audio Caton .
receivedSampleRateDuring the statistical period, receivedSampling of the far-end audio streamRate.
receivedBitrateDuring the statistical period, receivedThe distal end of the audio streams mean Bit rate.
totalFrozenTimeRemote user/host is addingAfter the occurrence of the audio channel cardThe cumulative duration of the pause .1. CloudHub defines totalFrozenTime =Audio Caton times × 2 × 1000 (ms).
2. Cumulative duration is Since joining the channel when accumulatedlong.
frozenRateRemote user/host audioThe cumulative duration of the freeze is accounted for in the audioPercentage of total effective timeCompare.Audio total valid length refers to the remote user / anchorAfter joining the channel, neither stopped sending audio streams,There is also no disabling of the call duration of the audio module.

onRemoteAudioStats focuses on reporting the full-link audio quality of the remote audio stream, which is closer to your subjective feelings. Even if the network is lostPackage, since the FEC (Forward Error Correction), the retransmission bandwidth estimation recovery and other anti-loss and congestion control techniques, finallyThe audio frame loss rate at the receiving end may not be high, so the audio quality you perceive may also be better.

When the remote user/host audio state changes, the SDK will trigger the onRemoteAudioStateChanged callback to report the remote audio to youThe current status of the frequency stream and the reason for the status change.

Video quality report

onLocalVideoStats callback reports to you the statistics of the video stream sent by the local device. You can understand the video encoding width/height andNext important parameter information.

If you previously called the enableDualStreamMode method to enable dual-stream mode, this callback describes the video stream sent by the local deviceStatistics.

parameterdescribeRemark
rendererOutputFrameRateThe output of the local video rendererFrame rate.
encoderOutputFrameRateThe output of the local video encoderFrame rate.
targetBitrateThe target encoding of the current encoderBit rate.The code rate is pre-defined by the SDK according to the current network conditions.An estimated value.
targetFrameRateThe target encoding of the current encoderFrame rate.
encodedBitrateVideo encoding rate.After packet loss does not include retransmission video video codeRate.
sentBitrateDuring the statistical period, actually sentVideo bitrate.After packet loss does not include retransmission video video codeRate.
sentFrameRateDuring the statistical period, actually sentVideo frame rate.After packet loss does not include retransmission video video codeRate.
encodedFrameCountThe cumulative number of frames sent by the video.The cumulative value since joining the channel.
codecTypeThe encoding type of the video.1.VIDEO_CODEC_VP8 = 1: VP8
2.VIDEO_CODEC_H264 = 2: (default Accepted value)H.264
qualityAdaptIndicationThe video quality adaptation of this statistics.Compared to the last statistics (2 seconds ago) video quality(Based on target bitrate/ targetBitrate and target frame rate/ targetFrameRate ), the video quality this time:
1. The local video quality remains unchanged. Local video quality improved.
2. The local video quality has deteriorated.

When the state of the local video changes, the SDK will trigger the onLocalVideoStateChanged callback to report the current local video state to you.state. When the local video fails, you can use the error code to troubleshoot the problem.

onRemoteVideoStats callback reports the video stream statistics of each remote user/host in the current call. You can understandTo each remote user/host video width/height and the following important parameter information.

parameterdescribeRemark
rxStreamTypeVideo stream type.For large or small video streams, see Dual Stream Mode for details.
receivedBitrateDuring the statistical period, the actualRemote video receivedBit rate.
packetLossRateDuring the statistical period, the actualRemote video receivedFlow packet loss rate.1. Stage 2 + 3 + 4 in the figure
2. herein refers to the use of anti-packet loss loss after technologyRate, than the use of anti-packet loss packet loss rate before the technology is moreLow.
decoderOutputFrameRateRemote video decoderOutput frame rate.
rendererOutputFrameRateRemote video rendererOutput frame rate.
totalFrozenTimeThe remote user/host is atSend video after joining the channelFrequency Caton when the cumulativelong.During the call, the video frame rate should not be lower than 5 fpsWhen the interval between two consecutively rendered videos exceeds500 ms, it counts as a video Caton .
frozenRateRemote user/host cardThe cumulative duration of the instant accounts for the videoPercentage of effective timeCompare.Video duration effective means remote user / anchor frequency is addedAfter the channel, neither stopped sending the video stream, norDisable the call duration of the video module.

When the video stream status of the remote user/host changes, the SDK will trigger the onRemoteVideoStateChanged callback to report the remote video to youThe current status of the frequency stream and the reason for the status change

API reference

Development considerations

onLocalAudioStateChangedonRemoteAudioStateChangedonLocalVideoStateChanged and onRemoteVideoStateChanged Correction state monitor not every 2 seconds SDK is triggered automatically, each trigger conditions see text.