rtpgccbwe: Don't use clamp() if there's no clear min/max value

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/305

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1078>
This commit is contained in:
Sebastian Dröge 2023-02-06 21:56:46 +02:00
parent 3a408c0146
commit 0ed74d0aa4

View file

@ -846,11 +846,16 @@ impl State {
let threshold_on_effective_bitrate = 1.5 * effective_bitrate as f64; let threshold_on_effective_bitrate = 1.5 * effective_bitrate as f64;
let increase = f64::max( let increase = f64::max(
1000.0f64, 1000.0f64,
// Stuffing should ensure that the effective bitrate is not f64::min(
// < target bitrate, still, make sure to always increase alpha * avg_packet_size_bits,
// the bitrate by a minimum amount of 160.bits // Stuffing should ensure that the effective bitrate is not
(threshold_on_effective_bitrate - self.target_bitrate_on_delay as f64) // < target bitrate, still, make sure to always increase
.clamp(160.0, alpha * avg_packet_size_bits), // the bitrate by a minimum amount of 160.bits
f64::max(
threshold_on_effective_bitrate - self.target_bitrate_on_delay as f64,
160.0,
),
),
); );
/* Additive increase */ /* Additive increase */