mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 04:51:26 +00:00
Fix various new clippy 1.79 warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1627>
This commit is contained in:
parent
0186930777
commit
998b4734bf
33 changed files with 36 additions and 52 deletions
|
@ -11,8 +11,8 @@ use gst::prelude::*;
|
|||
use gst::subclass::prelude::*;
|
||||
use gst_audio::subclass::prelude::*;
|
||||
|
||||
use std::cmp;
|
||||
use std::sync::Mutex;
|
||||
use std::{cmp, u64};
|
||||
|
||||
use byte_slice_cast::*;
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ use gst::subclass::prelude::*;
|
|||
|
||||
use std::mem;
|
||||
use std::sync::Mutex;
|
||||
use std::u64;
|
||||
|
||||
use byte_slice_cast::*;
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ use gst::subclass::prelude::*;
|
|||
use gst_audio::subclass::prelude::*;
|
||||
use gst_base::prelude::*;
|
||||
|
||||
use std::i32;
|
||||
use std::sync::atomic;
|
||||
use std::sync::Mutex;
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ fn basic_two_channels() {
|
|||
|
||||
#[test]
|
||||
fn silence() {
|
||||
run_test("wave=silence", None, 1000, 1024, 1, std::f64::NEG_INFINITY);
|
||||
run_test("wave=silence", None, 1000, 1024, 1, f64::NEG_INFINITY);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -228,7 +228,7 @@ fn below_threshold() {
|
|||
1000,
|
||||
1024,
|
||||
1,
|
||||
std::f64::NEG_INFINITY,
|
||||
f64::NEG_INFINITY,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ use gst_base::subclass::prelude::*;
|
|||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use std::sync::Mutex;
|
||||
use std::{f64, i32};
|
||||
|
||||
use byte_slice_cast::*;
|
||||
|
||||
|
|
|
@ -500,7 +500,7 @@ impl Decrypter {
|
|||
gst::debug!(CAT, obj: pad, "Stream Block index: {}", chunk_index);
|
||||
|
||||
let pull_offset = offset - (chunk_index * block_size as u64);
|
||||
assert!(pull_offset <= std::u32::MAX as u64);
|
||||
assert!(pull_offset <= u32::MAX as u64);
|
||||
let pull_offset = pull_offset as u32;
|
||||
|
||||
let pulled_buffer =
|
||||
|
|
|
@ -30,7 +30,6 @@ use once_cell::sync::Lazy;
|
|||
|
||||
use std::sync::Mutex;
|
||||
use std::time::Duration;
|
||||
use std::u32;
|
||||
|
||||
use crate::runtime::prelude::*;
|
||||
use crate::runtime::{Context, PadSrc, Task, TaskState};
|
||||
|
|
|
@ -26,7 +26,6 @@ use once_cell::sync::Lazy;
|
|||
use std::collections::VecDeque;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex as StdMutex;
|
||||
use std::u32;
|
||||
|
||||
static DATA_QUEUE_CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||
gst::DebugCategory::new(
|
||||
|
|
|
@ -30,7 +30,6 @@ use once_cell::sync::Lazy;
|
|||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
use std::u32;
|
||||
|
||||
use crate::runtime::prelude::*;
|
||||
use crate::runtime::{self, PadSink, PadSrc};
|
||||
|
|
|
@ -266,7 +266,7 @@ impl SinkHandler {
|
|||
inner.gap_packets.insert(GapPacket::new(buffer));
|
||||
|
||||
if gap_packets_length > 0 {
|
||||
let mut prev_gap_seq = std::u32::MAX;
|
||||
let mut prev_gap_seq = u32::MAX;
|
||||
let mut all_consecutive = true;
|
||||
|
||||
for gap_packet in inner.gap_packets.iter() {
|
||||
|
@ -279,7 +279,7 @@ impl SinkHandler {
|
|||
|
||||
all_consecutive = gap_packet.pt == pt;
|
||||
|
||||
if prev_gap_seq == std::u32::MAX {
|
||||
if prev_gap_seq == u32::MAX {
|
||||
prev_gap_seq = gap_packet.seq as u32;
|
||||
} else if gst_rtp::compare_seqnum(gap_packet.seq, prev_gap_seq as u16) != -1 {
|
||||
all_consecutive = false;
|
||||
|
|
|
@ -91,7 +91,7 @@ impl RTPJitterBufferItem {
|
|||
r#type: 0,
|
||||
dts: dts.into().into_glib(),
|
||||
pts: pts.into().into_glib(),
|
||||
seqnum: seqnum.map(|s| s as u32).unwrap_or(std::u32::MAX),
|
||||
seqnum: seqnum.map(|s| s as u32).unwrap_or(u32::MAX),
|
||||
count: 1,
|
||||
rtptime,
|
||||
},
|
||||
|
@ -138,7 +138,7 @@ impl RTPJitterBufferItem {
|
|||
pub fn seqnum(&self) -> Option<u16> {
|
||||
unsafe {
|
||||
let item = self.0.as_ref().expect("Invalid wrapper");
|
||||
if item.as_ref().seqnum == std::u32::MAX {
|
||||
if item.as_ref().seqnum == u32::MAX {
|
||||
None
|
||||
} else {
|
||||
Some(item.as_ref().seqnum as u16)
|
||||
|
@ -306,7 +306,7 @@ impl RTPJitterBuffer {
|
|||
let pts = from_glib(pts.assume_init());
|
||||
let seqnum = seqnum.assume_init();
|
||||
|
||||
let seqnum = if seqnum == std::u32::MAX {
|
||||
let seqnum = if seqnum == u32::MAX {
|
||||
None
|
||||
} else {
|
||||
Some(seqnum as u16)
|
||||
|
@ -339,7 +339,7 @@ impl RTPJitterBuffer {
|
|||
(None, None)
|
||||
} else {
|
||||
let seqnum = (*item).seqnum;
|
||||
let seqnum = if seqnum == std::u32::MAX {
|
||||
let seqnum = if seqnum == u32::MAX {
|
||||
None
|
||||
} else {
|
||||
Some(seqnum as u16)
|
||||
|
|
|
@ -31,7 +31,6 @@ use std::collections::{HashMap, VecDeque};
|
|||
use std::sync::{Arc, Weak};
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
use std::time::Duration;
|
||||
use std::{u32, u64};
|
||||
|
||||
use crate::runtime::prelude::*;
|
||||
use crate::runtime::{Context, PadSink, PadSinkWeak, PadSrc, PadSrcWeak, Task};
|
||||
|
|
|
@ -30,7 +30,6 @@ use once_cell::sync::Lazy;
|
|||
use std::collections::VecDeque;
|
||||
use std::sync::Mutex;
|
||||
use std::time::Duration;
|
||||
use std::{u32, u64};
|
||||
|
||||
use crate::runtime::prelude::*;
|
||||
use crate::runtime::{Context, PadSink, PadSrc, Task};
|
||||
|
|
|
@ -31,8 +31,6 @@ use std::io;
|
|||
use std::net::{IpAddr, SocketAddr, TcpStream};
|
||||
use std::sync::Mutex;
|
||||
use std::time::Duration;
|
||||
use std::u16;
|
||||
use std::u32;
|
||||
|
||||
use crate::runtime::prelude::*;
|
||||
use crate::runtime::task;
|
||||
|
|
|
@ -37,8 +37,6 @@ use std::collections::BTreeSet;
|
|||
use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
use std::u16;
|
||||
use std::u8;
|
||||
|
||||
const DEFAULT_HOST: Option<&str> = Some("127.0.0.1");
|
||||
const DEFAULT_PORT: i32 = 5004;
|
||||
|
|
|
@ -27,12 +27,10 @@ use gst_net::*;
|
|||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use std::i32;
|
||||
use std::io;
|
||||
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, UdpSocket};
|
||||
use std::sync::Mutex;
|
||||
use std::time::Duration;
|
||||
use std::u16;
|
||||
|
||||
use crate::runtime::prelude::*;
|
||||
use crate::runtime::{Async, Context, PadSrc, Task};
|
||||
|
|
|
@ -107,7 +107,7 @@ fn setup_video_sink(pipeline: &gst::Pipeline, path: &Path, name: &str) -> Result
|
|||
let enc = gst::ElementFactory::make("x264enc")
|
||||
.property("bframes", 0u32)
|
||||
.property("bitrate", VIDEO_BITRATE / 1000u32)
|
||||
.property("key-int-max", std::i32::MAX as u32)
|
||||
.property("key-int-max", i32::MAX as u32)
|
||||
.property_from_str("tune", "zerolatency")
|
||||
.build()?;
|
||||
let h264_capsfilter = gst::ElementFactory::make("capsfilter")
|
||||
|
|
|
@ -135,13 +135,13 @@ impl ElementImpl for NdiSink {
|
|||
gst_video::VideoFormat::Rgbx.to_str(),
|
||||
]),
|
||||
)
|
||||
.field("width", gst::IntRange::<i32>::new(1, std::i32::MAX))
|
||||
.field("height", gst::IntRange::<i32>::new(1, std::i32::MAX))
|
||||
.field("width", gst::IntRange::<i32>::new(1, i32::MAX))
|
||||
.field("height", gst::IntRange::<i32>::new(1, i32::MAX))
|
||||
.field(
|
||||
"framerate",
|
||||
gst::FractionRange::new(
|
||||
gst::Fraction::new(0, 1),
|
||||
gst::Fraction::new(std::i32::MAX, 1),
|
||||
gst::Fraction::new(i32::MAX, 1),
|
||||
),
|
||||
)
|
||||
.build(),
|
||||
|
|
|
@ -7,7 +7,6 @@ use gst_base::subclass::base_src::CreateSuccess;
|
|||
use gst_base::subclass::prelude::*;
|
||||
|
||||
use std::sync::Mutex;
|
||||
use std::u32;
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
|
|
|
@ -27,7 +27,9 @@ pub enum Buffer {
|
|||
},
|
||||
Metadata {
|
||||
frame: MetadataFrame,
|
||||
#[allow(unused)]
|
||||
receive_time_gst: gst::ClockTime,
|
||||
#[allow(unused)]
|
||||
receive_time_real: gst::ClockTime,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -226,8 +226,8 @@ pub enum NDIlib_frame_format_type_e {
|
|||
NDIlib_frame_format_type_field_1 = 3,
|
||||
}
|
||||
|
||||
pub const NDIlib_send_timecode_synthesize: i64 = ::std::i64::MAX;
|
||||
pub const NDIlib_recv_timestamp_undefined: i64 = ::std::i64::MAX;
|
||||
pub const NDIlib_send_timecode_synthesize: i64 = i64::MAX;
|
||||
pub const NDIlib_recv_timestamp_undefined: i64 = i64::MAX;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
|
|
|
@ -872,7 +872,7 @@ impl ElementImpl for RaptorqEnc {
|
|||
fn pad_templates() -> &'static [gst::PadTemplate] {
|
||||
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
||||
let caps = gst::Caps::builder("application/x-rtp")
|
||||
.field("clock-rate", gst::IntRange::new(0, std::i32::MAX))
|
||||
.field("clock-rate", gst::IntRange::new(0, i32::MAX))
|
||||
.build();
|
||||
|
||||
let srcpad_template = gst::PadTemplate::new(
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
use std::u64;
|
||||
|
||||
use futures::future;
|
||||
use futures::prelude::*;
|
||||
|
@ -539,6 +538,8 @@ impl ReqwestHttpSrc {
|
|||
.unwrap_or(false);
|
||||
let seekable = size.is_some() && accept_byte_ranges;
|
||||
|
||||
#[allow(clippy::manual_unwrap_or_default)]
|
||||
// https://github.com/rust-lang/rust-clippy/issues/12928
|
||||
let position = if let Some((range_start, _)) = headers
|
||||
.typed_get::<ContentRange>()
|
||||
.and_then(|range| range.bytes_range())
|
||||
|
|
|
@ -19,7 +19,6 @@ use byte_slice_cast::*;
|
|||
|
||||
use std::ops::Rem;
|
||||
use std::sync::Mutex;
|
||||
use std::u32;
|
||||
|
||||
use num_traits::cast::NumCast;
|
||||
use num_traits::float::Float;
|
||||
|
|
|
@ -262,21 +262,21 @@ impl ObjectImpl for FallbackSrc {
|
|||
glib::ParamSpecUInt64::builder("timeout")
|
||||
.nick("Timeout")
|
||||
.blurb("Timeout for switching to the fallback URI")
|
||||
.maximum(std::u64::MAX - 1)
|
||||
.maximum(u64::MAX - 1)
|
||||
.default_value(5 * *gst::ClockTime::SECOND)
|
||||
.mutable_ready()
|
||||
.build(),
|
||||
glib::ParamSpecUInt64::builder("restart-timeout")
|
||||
.nick("Timeout")
|
||||
.blurb("Timeout for restarting an active source")
|
||||
.maximum(std::u64::MAX - 1)
|
||||
.maximum(u64::MAX - 1)
|
||||
.default_value(5 * *gst::ClockTime::SECOND)
|
||||
.mutable_ready()
|
||||
.build(),
|
||||
glib::ParamSpecUInt64::builder("retry-timeout")
|
||||
.nick("Retry Timeout")
|
||||
.blurb("Timeout for stopping after repeated failure")
|
||||
.maximum(std::u64::MAX - 1)
|
||||
.maximum(u64::MAX - 1)
|
||||
.default_value(60 * *gst::ClockTime::SECOND)
|
||||
.mutable_ready()
|
||||
.build(),
|
||||
|
@ -296,14 +296,14 @@ impl ObjectImpl for FallbackSrc {
|
|||
.blurb("When the main source has a higher latency than the fallback source \
|
||||
this allows to configure a minimum latency that would be configured \
|
||||
if initially the fallback is enabled")
|
||||
.maximum(std::u64::MAX - 1)
|
||||
.maximum(u64::MAX - 1)
|
||||
.mutable_ready()
|
||||
.build(),
|
||||
glib::ParamSpecInt64::builder("buffer-duration")
|
||||
.nick("Buffer Duration")
|
||||
.blurb("Buffer duration when buffering streams (-1 default value)")
|
||||
.minimum(-1)
|
||||
.maximum(std::i64::MAX - 1)
|
||||
.maximum(i64::MAX - 1)
|
||||
.default_value(-1)
|
||||
.mutable_ready()
|
||||
.build(),
|
||||
|
|
|
@ -1329,21 +1329,21 @@ impl ObjectImpl for FallbackSwitch {
|
|||
glib::ParamSpecUInt64::builder(PROP_TIMEOUT)
|
||||
.nick("Input timeout")
|
||||
.blurb("Timeout on an input before switching to a lower priority input.")
|
||||
.maximum(std::u64::MAX - 1)
|
||||
.maximum(u64::MAX - 1)
|
||||
.default_value(Settings::default().timeout.nseconds())
|
||||
.mutable_playing()
|
||||
.build(),
|
||||
glib::ParamSpecUInt64::builder(PROP_LATENCY)
|
||||
.nick("Latency")
|
||||
.blurb("Additional latency in live mode to allow upstream to take longer to produce buffers for the current position (in nanoseconds)")
|
||||
.maximum(std::u64::MAX - 1)
|
||||
.maximum(u64::MAX - 1)
|
||||
.default_value(Settings::default().latency.nseconds())
|
||||
.mutable_ready()
|
||||
.build(),
|
||||
glib::ParamSpecUInt64::builder(PROP_MIN_UPSTREAM_LATENCY)
|
||||
.nick("Minimum Upstream Latency")
|
||||
.blurb("When sources with a higher latency are expected to be plugged in dynamically after the fallbackswitch has started playing, this allows overriding the minimum latency reported by the initial source(s). This is only taken into account when larger than the actually reported minimum latency. (nanoseconds)")
|
||||
.maximum(std::u64::MAX - 1)
|
||||
.maximum(u64::MAX - 1)
|
||||
.default_value(Settings::default().min_upstream_latency.nseconds())
|
||||
.mutable_ready()
|
||||
.build(),
|
||||
|
|
|
@ -20,7 +20,6 @@ use once_cell::sync::Lazy;
|
|||
use parking_lot::{Condvar, Mutex, MutexGuard};
|
||||
use std::cmp;
|
||||
use std::collections::HashMap;
|
||||
use std::f64;
|
||||
use std::iter;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ use crate::ccutils::{extract_cdp, ParseError, ParseErrorCode};
|
|||
use once_cell::sync::Lazy;
|
||||
|
||||
use std::sync::Mutex;
|
||||
use std::u64;
|
||||
|
||||
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||
gst::DebugCategory::new(
|
||||
|
|
|
@ -1144,8 +1144,8 @@ impl ElementImpl for MccParse {
|
|||
{
|
||||
let caps = caps.get_mut().unwrap();
|
||||
let framerate = gst::FractionRange::new(
|
||||
gst::Fraction::new(1, std::i32::MAX),
|
||||
gst::Fraction::new(std::i32::MAX, 1),
|
||||
gst::Fraction::new(1, i32::MAX),
|
||||
gst::Fraction::new(i32::MAX, 1),
|
||||
);
|
||||
|
||||
let s = gst::Structure::builder("closedcaption/x-cea-708")
|
||||
|
|
|
@ -1144,8 +1144,8 @@ impl ElementImpl for TtToCea608 {
|
|||
.unwrap();
|
||||
|
||||
let framerate = gst::FractionRange::new(
|
||||
gst::Fraction::new(1, std::i32::MAX),
|
||||
gst::Fraction::new(std::i32::MAX, 1),
|
||||
gst::Fraction::new(1, i32::MAX),
|
||||
gst::Fraction::new(i32::MAX, 1),
|
||||
);
|
||||
|
||||
let caps = gst::Caps::builder("closedcaption/x-cea-608")
|
||||
|
|
|
@ -16,7 +16,6 @@ use gst_video::subclass::prelude::*;
|
|||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use std::i32;
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
|
||||
const DEFAULT_N_THREADS: u32 = 0;
|
||||
|
@ -513,7 +512,7 @@ impl ObjectImpl for Dav1dDec {
|
|||
.nick("Maximum frame delay")
|
||||
.blurb("Maximum delay in frames for the decoder (set to 1 for low latency, 0 to be equal to the number of logical cores. -1 to choose between these two based on pipeline liveness)")
|
||||
.minimum(-1)
|
||||
.maximum(std::u32::MAX.into())
|
||||
.maximum(u32::MAX.into())
|
||||
.default_value(DEFAULT_MAX_FRAME_DELAY)
|
||||
.mutable_ready()
|
||||
.build(),
|
||||
|
|
|
@ -150,7 +150,7 @@ impl ObjectImpl for GifEnc {
|
|||
.nick("Repeat")
|
||||
.blurb("Repeat (-1 to loop forever, 0 .. n finite repetitions)")
|
||||
.minimum(-1)
|
||||
.maximum(std::u16::MAX as i32)
|
||||
.maximum(u16::MAX as i32)
|
||||
.default_value(DEFAULT_REPEAT)
|
||||
.mutable_ready()
|
||||
.build(),
|
||||
|
|
|
@ -292,7 +292,7 @@ impl ObjectImpl for Rav1Enc {
|
|||
glib::ParamSpecUInt::builder("min-quantizer")
|
||||
.nick("Min Quantizer")
|
||||
.blurb("Min Quantizer")
|
||||
.maximum(std::u8::MAX as u32)
|
||||
.maximum(u8::MAX as u32)
|
||||
.default_value(DEFAULT_MIN_QUANTIZER as u32)
|
||||
.mutable_ready()
|
||||
.build(),
|
||||
|
|
Loading…
Reference in a new issue