From 3f904553ea1336fc73333ec680493c41250a03fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 13 Dec 2022 11:43:16 +0200 Subject: Fix various new clippy warnings Part-of: --- generic/sodium/src/decrypter/imp.rs | 2 +- generic/threadshare/examples/benchmark.rs | 2 +- generic/threadshare/src/jitterbuffer/imp.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'generic') diff --git a/generic/sodium/src/decrypter/imp.rs b/generic/sodium/src/decrypter/imp.rs index 1e0fd5f7a..f01ee29b8 100644 --- a/generic/sodium/src/decrypter/imp.rs +++ b/generic/sodium/src/decrypter/imp.rs @@ -498,7 +498,7 @@ impl Decrypter { gst::debug!(CAT, obj: pad, "Requested offset: {}", offset); gst::debug!(CAT, obj: pad, "Requested size: {}", requested_size); - let chunk_index = offset as u64 / block_size as u64; + let chunk_index = offset / block_size as u64; gst::debug!(CAT, obj: pad, "Stream Block index: {}", chunk_index); let pull_offset = offset - (chunk_index * block_size as u64); diff --git a/generic/threadshare/examples/benchmark.rs b/generic/threadshare/examples/benchmark.rs index c7e98af75..3903f7a1f 100644 --- a/generic/threadshare/examples/benchmark.rs +++ b/generic/threadshare/examples/benchmark.rs @@ -158,7 +158,7 @@ fn main() { let context = build_context(); let source = gst::ElementFactory::make("ts-tonesrc") .name(format!("source-{}", i).as_str()) - .property("samples-per-buffer", (wait as u32) * 8000 / 1000) + .property("samples-per-buffer", wait * 8000 / 1000) .property("context", &context) .property("context-wait", wait) .build() diff --git a/generic/threadshare/src/jitterbuffer/imp.rs b/generic/threadshare/src/jitterbuffer/imp.rs index 7105720a0..289739bcc 100644 --- a/generic/threadshare/src/jitterbuffer/imp.rs +++ b/generic/threadshare/src/jitterbuffer/imp.rs @@ -28,7 +28,7 @@ use gst_rtp::RTPBuffer; use once_cell::sync::Lazy; -use std::cmp::{max, min, Ordering}; +use std::cmp::Ordering; use std::collections::{BTreeSet, VecDeque}; use std::mem; use std::sync::Arc; @@ -412,7 +412,7 @@ impl SinkHandler { } if let Some(last_in_seqnum) = inner.last_in_seqnum { - let gap = gst_rtp::compare_seqnum(last_in_seqnum as u16, seq); + let gap = gst_rtp::compare_seqnum(last_in_seqnum, seq); if gap == 1 { self.calculate_packet_spacing(inner, &mut state, rtptime, pts); } else { @@ -463,7 +463,7 @@ impl SinkHandler { state.equidistant += 1; } - state.equidistant = min(max(state.equidistant, -7), 7); + state.equidistant = state.equidistant.clamp(-7, 7); inner.last_rtptime = Some(rtptime); @@ -679,7 +679,7 @@ impl SrcHandler { // FIXME reason why we can expect Some for the 2 lines below let mut last_popped_pts = state.last_popped_pts.unwrap(); let interval = pts.into().unwrap().saturating_sub(last_popped_pts); - let spacing = interval / (gap as u64 + 1); + let spacing = interval / (gap + 1); *discont = true; -- cgit v1.2.3