Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sdroege/gst-plugin-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/net/rtp
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2022-12-13 12:43:16 +0300
committerSebastian Dröge <sebastian@centricular.com>2022-12-13 12:43:16 +0300
commit3f904553ea1336fc73333ec680493c41250a03fe (patch)
treeea270ea2f9b5484fc729a4a174ea2a0261e89f9a /net/rtp
parent289e8a08c31610fbf62056f8a156eb647e9c3a2a (diff)
Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1011>
Diffstat (limited to 'net/rtp')
-rw-r--r--net/rtp/src/av1/depay/imp.rs4
-rw-r--r--net/rtp/src/av1/pay/imp.rs2
-rw-r--r--net/rtp/src/gcc/imp.rs31
3 files changed, 16 insertions, 21 deletions
diff --git a/net/rtp/src/av1/depay/imp.rs b/net/rtp/src/av1/depay/imp.rs
index 83e1a23e..88b26fce 100644
--- a/net/rtp/src/av1/depay/imp.rs
+++ b/net/rtp/src/av1/depay/imp.rs
@@ -370,12 +370,12 @@ impl RTPAv1Depay {
let mut bitreader = BitReader::endian(reader, ENDIANNESS);
parse_leb128(&mut bitreader)
.map_err(err_opt!(self, leb_read))
- .ok()? as u32
+ .ok()?
}
} else {
element_size = parse_leb128(&mut BitReader::endian(&mut *reader, ENDIANNESS))
.map_err(err_opt!(self, leb_read))
- .ok()? as u32;
+ .ok()?;
is_last_obu = match rtp
.payload_size()
.cmp(&(reader.position() as u32 + element_size))
diff --git a/net/rtp/src/av1/pay/imp.rs b/net/rtp/src/av1/pay/imp.rs
index 66e5a874..0ec6b79b 100644
--- a/net/rtp/src/av1/pay/imp.rs
+++ b/net/rtp/src/av1/pay/imp.rs
@@ -471,7 +471,7 @@ impl RTPAv1Pay {
state.open_obu_fragment = true;
size
} else {
- last_obu.bytes.len() as u32 - last_obu.offset as usize as u32
+ last_obu.bytes.len() as u32 - last_obu.offset as u32
};
if !packet.omit_last_size_field {
diff --git a/net/rtp/src/gcc/imp.rs b/net/rtp/src/gcc/imp.rs
index b2fb1fd3..383216d3 100644
--- a/net/rtp/src/gcc/imp.rs
+++ b/net/rtp/src/gcc/imp.rs
@@ -397,8 +397,8 @@ impl Detector {
- self.last_received_packets.iter().next().unwrap().1.arrival;
let bits = self
.last_received_packets
- .iter()
- .map(|(_seqnum, p)| p.size as f64)
+ .values()
+ .map(|p| p.size as f64)
.sum::<f64>()
* 8.;
@@ -523,7 +523,7 @@ impl Detector {
}
}
- self.compute_loss_average(lost_packets as f64 / n_packets as f64);
+ self.compute_loss_average(lost_packets / n_packets as f64);
}
fn compute_loss_average(&mut self, loss_fraction: f64) {
@@ -828,7 +828,7 @@ impl State {
}
};
- if effective_bitrate as f64 - target_bitrate as f64 > 5. * target_bitrate / 100. {
+ if effective_bitrate as f64 - target_bitrate > 5. * target_bitrate / 100. {
gst::info!(
CAT,
"Effective rate {} >> target bitrate {} - we should avoid that \
@@ -850,16 +850,11 @@ impl State {
let threshold_on_effective_bitrate = 1.5 * effective_bitrate as f64;
let increase = f64::max(
1000.0f64,
- 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.,
- ),
- ),
+ // 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),
);
/* Additive increase */
@@ -1259,8 +1254,8 @@ impl ObjectImpl for BandwidthEstimator {
the element to configure the starting bitrate, in which case the
encoder should also use it as target bitrate",
1,
- u32::MAX as u32,
- DEFAULT_MIN_BITRATE as u32,
+ u32::MAX,
+ DEFAULT_MIN_BITRATE,
glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
),
glib::ParamSpecUInt::new(
@@ -1268,7 +1263,7 @@ impl ObjectImpl for BandwidthEstimator {
"Minimal Bitrate",
"Minimal bitrate to use (in bit/sec) when computing it through the bandwidth estimation algorithm",
1,
- u32::MAX as u32,
+ u32::MAX,
DEFAULT_MIN_BITRATE,
glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
),
@@ -1277,7 +1272,7 @@ impl ObjectImpl for BandwidthEstimator {
"Maximal Bitrate",
"Maximal bitrate to use (in bit/sec) when computing it through the bandwidth estimation algorithm",
1,
- u32::MAX as u32,
+ u32::MAX,
DEFAULT_MAX_BITRATE,
glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
),