pub enum LiveBandwidthMode {
    Max(DataRate),
    Input {
        rate: DataRate,
        overhead: Percent,
    },
    Estimated {
        overhead: Percent,
        expected: DataRate,
    },
    Unlimited,
}
Expand description

https://datatracker.ietf.org/doc/html/draft-sharabayko-srt-00#section-5.1.1

Note that Maximum Bandwidth, Input Rate, and Input Rate Estimate are bytes per second and Overhead is a percentage.

Variants

Max(DataRate)

Tuple Fields

Set the maximum bandwidth explicitly.

The recommended default value is 1 Gbps. The default value is set only for live streaming.

Note that this static setting is not well-suited to a variable input, like when you change the bitrate on an encoder. Each time the input bitrate is configured on the encoder, this value should also be reconfigured.

Input

Fields

rate: DataRate
overhead: Percent

Set the SRT send input rate and overhead. In this mode, SRT calculates the maximum bandwidth as follows:

Maximum Bandwidth = Input Rate * (1 + Overhead / 100)

Note that Input mode reduces to the Set mode and the same restrictions apply.

Estimated

Fields

overhead: Percent
expected: DataRate

Measure the SRT send input rate internally and set the Overhead.

In this mode, SRT adjusts the value of maximum bandwidth each time it gets the updated Input Rate Estimate of the Input Rate:

Maximum Bandwidth = Input Rate Estimate * (1 + Overhead / 100)

Estimated mode is recommended for setting the Maximum Bandwidth as it follows the fluctuations in SRT send Input Rate. However, there are certain considerations that should be taken into account.

In Estimated mode, SRT takes as an initial Expected Input Rate. This should match the configured output bitrate rate of an encoder (in terms of bitrate for the packets including audio and overhead). But it is normal for an encoder to occasionally overshoot. At a low bitrate, sometimes an encoder can be too optimistic and will output more bits than expected. Under these conditions, SRT packets would not go out fast enough because the configured bandwidth limitation would be too low. This is mitigated by calculating the bitrate internally.

SRT examines the packets being submitted and calculates an Input Rate Estimate as a moving average. However, this introduces a bit of a delay based on the content. It also means that if an encoder encounters black screens or still frames, this would dramatically lower the bitrate being measured, which would in turn reduce the SRT output rate. And then, when the video picks up again, the input rate rises sharply. SRT would not start up again fast enough on output because of the time it takes to measure the speed. Packets might be accumulated in the SRT send buffer, and delayed as a result, causing them to arrive too late at the decoder, and possible drops by the receiver.

Unlimited

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.