diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2023-02-06 22:56:46 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-02-06 22:56:46 +0300 |
commit | 0ed74d0aa45c7e0160acc47661cf20c844101298 (patch) | |
tree | 3f9d443b0183384a61bd4ff8163433f4b801e2d9 /net/rtp | |
parent | 3a408c01467864b8950c8a27cb1f5dccfc263bfd (diff) |
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>
Diffstat (limited to 'net/rtp')
-rw-r--r-- | net/rtp/src/gcc/imp.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/rtp/src/gcc/imp.rs b/net/rtp/src/gcc/imp.rs index bbf5b7769..bfa827ae2 100644 --- a/net/rtp/src/gcc/imp.rs +++ b/net/rtp/src/gcc/imp.rs @@ -846,11 +846,16 @@ impl State { let threshold_on_effective_bitrate = 1.5 * effective_bitrate as f64; let increase = f64::max( 1000.0f64, - // Stuffing should ensure that the effective bitrate is not - // < target bitrate, still, make sure to always increase - // the bitrate by a minimum amount of 160.bits - (threshold_on_effective_bitrate - self.target_bitrate_on_delay as f64) - .clamp(160.0, alpha * avg_packet_size_bits), + f64::min( + alpha * avg_packet_size_bits, + // Stuffing should ensure that the effective bitrate is not + // < target bitrate, still, make sure to always increase + // 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 */ |