Skip to content

Quality Of Service

Kolesnik, Gennadiy edited this page Nov 25, 2024 · 1 revision

The Quality-of-Service (QoS) algorithm adjusts video bitrate and frame rate in response to network and codec performance. This dynamic adjustment ensures smooth video playback, optimizing quality based on real-time transmission conditions.

QoS Operation and Parameters

Frame Rate and Bandwidth Monitoring

The QoS algorithm monitors the frame rate on both the transmitting (Tx) and receiving (Rx) sides. Each frame is sent as an individual message, allowing the algorithm to measure frame rates accurately.

  • Sufficient Bandwidth: When the Rx frame rate matches the Tx frame rate, the network channel is determined to have adequate bandwidth.
  • Bandwidth Constraints: When the channel’s bandwidth becomes limited, the Rx frame rate will begin to lag behind the Tx frame rate. To mitigate this lag, the QoS algorithm gradually reduces the bitrate.

Bitrate Adjustment Process

  1. Bitrate Reduction: The algorithm decreases the bitrate until the Rx frame rate aligns with the Tx frame rate, alleviating any lag.
  2. Bitrate Recovery: Once the network congestion eases, the bitrate is increased in small steps until it either reaches the original target or stabilizes at a sustainable rate.

Encoder and Decoder Queue Depth Monitoring

The QoS algorithm checks the encoder and decoder queue depths to assess codec processing capacity. Queue depths reveal whether the codec can handle the current frame rate and resolution.

  • Optimal Performance: Queue depths of 0 to 1 frame indicate that the codec processes frames smoothly, without delay.
  • Codec Performance Constraints: If queue depths increase, the codec is processing frames too slowly at the current settings.

Frame Rate Adjustment Process

  1. Frame Rate Reduction: The QoS algorithm lowers the frame rate gradually, commanding the display capture component to capture frames at a lower rate until the queue depths return to normal.
  2. Frame Rate Recovery: The frame rate is then increased in small steps, stabilizing at a level where both the encoder and decoder can sustain performance without creating a queue buildup.

Statistics Collection and Panic Mode

Client and Server Statistics

The QoS algorithm relies on statistics collected on both the client and server. Client stats are periodically transmitted to the server, which uses them to adjust transmission parameters.

Panic Mode Triggering

The QoS algorithm initiates "panic" mode under severe conditions:

  1. Client Statistics Timeout: If client stats are not received within a set period, QoS assumes that network traffic is overwhelming, possibly stalling communication.
  2. Queue Depth Threshold: Encoder or decoder queue depths exceeding 10 frames signal significant congestion, also triggering panic mode.

Panic Mode Actions

In panic mode, QoS minimizes all adjustable parameters, reducing bitrate and frame rate drastically. Once client statistics resume, QoS exits panic mode and gradually increases the bitrate and the frame rate to sustainable levels.

This adaptive QoS algorithm enhances the video streaming experience by balancing bitrate and frame rate dynamically, ensuring stability and smooth playback in varying network conditions.