logo
On this page

Call Quality Monitoring


Introduction

During the publishing and playing process, users can register relevant callbacks to monitor the quality of specific publishing and playing streams.

Example Source Code Download

Please refer to Download Example Source Code to obtain the source code.

  • For publishing: please check the "/ZegoExpressExample/src/Publish/ZegoPublishDemo.cpp" file.
  • For playing: please check the "/ZegoExpressExample/src/Play/ZegoPlayDemo.cpp" file.

Usage Steps

Monitor Publishing Stream Quality

  • Interface prototype
    /**
     * Publishing stream quality callback
     * This callback is received every 3 seconds after successful publishing
     * @param streamID Stream ID
     * @param quality Publishing stream quality
     */
    virtual void onPublisherQualityUpdate(const std::string& streamID, const ZegoPublishStreamQuality& quality) {}
  • Usage example
    class MyEventHandler: public IZegoEventHandler
    {
        void onPublisherQualityUpdate(const std::string& streamID, const ZegoPublishStreamQuality& quality) {
            printf("onPublisherQualityUpdate: streamID=%s", streamID.c_str());
        }
    };

Publishing Stream Quality Details

Publishing stream quality includes the frame rate of the audio/video stream during the capture and encoding stages, the frame rate and bitrate of the audio/video stream during the transmission (sending) stage, delay, and packet loss rate. The specific definition is as follows:

struct ZegoPublishStreamQuality
{
    /** Video capture frame rate, unit is f/s */
    double videoCaptureFPS;

    /** Video encoding frame rate, unit is f/s */
    double videoEncodeFPS;

    /** Video sending frame rate, unit is f/s */
    double videoSendFPS;

    /** Video bitrate, unit is kbps */
    double videoKBPS;

    /** Audio capture frame rate, unit is f/s */
    double audioCaptureFPS;

    /** Audio sending frame rate, unit is f/s */
    double audioSendFPS;

    /** Audio bitrate, unit is kbps */
    double audioKBPS;

    /** Delay from local device to server, unit is milliseconds */
    int rtt;

    /** Packet loss rate, unit is percentage, 0.0 ~ 1.0 */
    double packetLostRate;

    /** Publishing stream quality level */
    ZegoStreamQualityLevel level;

    /** Whether hardware encoding is enabled */
    bool isHardwareEncode;

    /** Video encoding format */
    ZegoVideoCodecID videoCodecID;

    /** Total sent byte count, including audio, video, and SEI */
    double totalSendBytes;

    /** Sent audio byte count */
    double audioSendBytes;

    /** Sent video byte count */
    double videoSendBytes;

};

Publishing Capture Quality

Publishing capture quality is close to the user's subjective feeling during local preview when publishing. When publishing, the SDK's relevant parameters for audio/video quality during the capture stage are as follows:

  • audioCaptureFPS: Audio capture frame rate (fps)
  • videoCaptureFPS: Video capture frame rate (fps)

Publishing Encoding Quality

Publishing encoding quality is the quality of the audio/video stream during the encoding stage by the SDK when publishing. The relevant parameters are as follows:

videoEncodeFPS: Target video encoding frame rate of the current encoder (fps)

Publishing Sending Quality

Publishing sending quality is the actual publishing quality, related to the actual network quality. The relevant members are as follows:

  • audioSendFPS: Actual audio sending frame rate (fps)
  • audioKBPS: Actual audio sending bitrate (kbps)
  • videoSendFPS: Actual video sending frame rate (fps)
  • videoKBPS: Actual video sending bitrate (kbps)
  • rtt: Round-trip delay from device to ZEGO Server (ms)
  • packetLostRate: Device uplink packet loss rate

Monitor Playing Stream Quality

  • Interface prototype
    /**
     * Playing stream quality callback
     * This callback is received every 3 seconds after successful playing
     * @param streamID Stream ID
     * @param quality Playing stream quality
     */
    virtual void onPlayerQualityUpdate(const std::string& streamID, const ZegoPlayStreamQuality& quality) {}
  • Usage example
    class MyEventHandler: public IZegoEventHandler
    {
        void onPlayerQualityUpdate(const std::string& streamID, const ZegoPlayStreamQuality& quality) {
            printf("onPlayerQualityUpdate: streamID=%s", streamID.c_str());
        }
    };

Playing Stream Quality Details

Playing stream quality includes the frame rate, bitrate, delay, and packet loss rate of the received audio/video stream, the frame rate of the audio/video stream during the decoding stage, and the frame rate, freeze rate, and overall video quality during the rendering stage. The specific definition is as follows:

struct ZegoPlayStreamQuality
{
    /** Video receive frame rate, unit is f/s */
    double videoRecvFPS;

    /** Video anti-jitter frame rate, unit is f/s */
    double videoDejitterFPS;

    /** Video decode frame rate, unit is f/s */
    double videoDecodeFPS;

    /** Video render frame rate, unit is f/s */
    double videoRenderFPS;

    /** Video bitrate, unit is kbps */
    double videoKBPS;

    /** Video freeze rate, unit is (freeze count per 10 seconds) */
    /** No data playback for more than 500ms, i.e., one video freeze */
    double videoBreakRate;

    /** Audio receive frame rate, unit is f/s */
    double audioRecvFPS;

    /** Audio anti-jitter frame rate, unit is f/s */
    double audioDejitterFPS;

    /** Audio decode frame rate, unit is f/s */
    double audioDecodeFPS;

    /** Audio render frame rate, unit is f/s */
    double audioRenderFPS;

    /** Audio bitrate, unit is kbps */
    double audioKBPS;

    /** Audio freeze rate, unit is (freeze count per 10 seconds) */
    /** No data playback for 3 consecutive frames and no audio data rendering within a given freeze threshold, i.e., one audio freeze */
    double audioBreakRate;

    /** Delay from server to local device, unit is milliseconds */
    int rtt;

    /** Packet loss rate, unit is percentage, 0.0 ~ 1.0 */
    double packetLostRate;

    /** Delay from server to peer, unit is milliseconds */
    int peerToPeerDelay;

    /** Packet loss rate to peer, unit is percentage, 0.0 ~ 1.0 */
    double peerToPeerPacketLostRate;

    /** Playing stream quality level */
    ZegoStreamQualityLevel level;

    /** Delay from receiving data locally to playback, unit is milliseconds */
    int delay;

    /** Difference between video timestamp and audio timestamp, used to reflect audio-video synchronization, unit is milliseconds. A value less than 0 indicates the number of milliseconds video is ahead of audio, greater than 0 indicates the number of milliseconds video is behind audio, equal to 0 indicates no difference. When the absolute value is less than 200, audio-video synchronization can be basically considered normal. When the absolute value is continuously greater than 200 for 10 seconds, it can be considered abnormal */
    int avTimestampDiff;

    /** Whether hardware decoding is enabled */
    bool isHardwareDecode;

    /** Video encoding format */
    ZegoVideoCodecID videoCodecID;

    /** Total received byte count, including audio, video, and SEI */
    double totalRecvBytes;

    /** Received audio byte count */
    double audioRecvBytes;

    /** Received video byte count */
    double videoRecvBytes;

};

Playing Receiving Quality

Playing receiving quality is the actual playing quality, related to the actual publishing quality and current network quality. The relevant parameters are as follows:

  • audioRecvFPS: Actual received audio frame rate (fps)
  • audioKBPS: Actual received audio bitrate (kbps)
  • audioBreakRate: Actual received audio freeze rate (freeze count per 10 seconds)
  • videoKBPS: Actual received video frame rate (fps)
  • videoRecvFPS: Actual received video bitrate (kbps)
  • videoBreakRate: Actual received video freeze rate (freeze count per 10 seconds)
  • packetLostRate: Device downlink packet loss rate
  • rtt: Round-trip delay from device to ZEGO Server (ms)

Playing Rendering Quality

Playing rendering quality is close to the user's subjective feeling when watching the video. This quality may be lower than the actual playing stream quality value due to decoder impact. The relevant parameters are as follows:

  • audioRenderFPS: Actual audio rendering frame rate
  • videoRenderFPS: Actual video rendering frame rate

API Reference List

MethodDescription
onPublisherQualityUpdatePublishing stream quality callback
onPlayerQualityUpdatePlaying stream quality update callback

Previous

Using Token Authentication

Next

Network Speed Test