Fix various new clippy 1.79 warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1620>
This commit is contained in:
Sebastian Dröge 2024-06-14 08:20:14 +03:00
parent cd47bf2f04
commit 69c3c2ae46
41 changed files with 85 additions and 104 deletions

View file

@ -11,8 +11,8 @@ use gst::prelude::*;
use gst::subclass::prelude::*; use gst::subclass::prelude::*;
use gst_audio::subclass::prelude::*; use gst_audio::subclass::prelude::*;
use std::cmp;
use std::sync::Mutex; use std::sync::Mutex;
use std::{cmp, u64};
use byte_slice_cast::*; use byte_slice_cast::*;

View file

@ -18,7 +18,6 @@ use gst::subclass::prelude::*;
use std::mem; use std::mem;
use std::sync::Mutex; use std::sync::Mutex;
use std::u64;
use byte_slice_cast::*; use byte_slice_cast::*;

View file

@ -12,7 +12,6 @@ use gst::subclass::prelude::*;
use gst_audio::subclass::prelude::*; use gst_audio::subclass::prelude::*;
use gst_base::prelude::*; use gst_base::prelude::*;
use std::i32;
use std::sync::atomic; use std::sync::atomic;
use std::sync::Mutex; use std::sync::Mutex;

View file

@ -198,7 +198,7 @@ fn basic_two_channels() {
#[test] #[test]
fn silence() { 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] #[test]
@ -228,7 +228,7 @@ fn below_threshold() {
1000, 1000,
1024, 1024,
1, 1,
std::f64::NEG_INFINITY, f64::NEG_INFINITY,
); );
} }

View file

@ -17,7 +17,6 @@ use gst_base::subclass::prelude::*;
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Mutex; use std::sync::Mutex;
use std::{f64, i32};
use byte_slice_cast::*; use byte_slice_cast::*;

View file

@ -500,7 +500,7 @@ impl Decrypter {
gst::debug!(CAT, obj: pad, "Stream Block index: {}", chunk_index); gst::debug!(CAT, obj: pad, "Stream Block index: {}", chunk_index);
let pull_offset = offset - (chunk_index * block_size as u64); 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 pull_offset = pull_offset as u32;
let pulled_buffer = let pulled_buffer =

View file

@ -30,7 +30,6 @@ use once_cell::sync::Lazy;
use std::sync::Mutex; use std::sync::Mutex;
use std::time::Duration; use std::time::Duration;
use std::u32;
use crate::runtime::prelude::*; use crate::runtime::prelude::*;
use crate::runtime::{Context, PadSrc, Task, TaskState}; use crate::runtime::{Context, PadSrc, Task, TaskState};

View file

@ -26,7 +26,6 @@ use once_cell::sync::Lazy;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::sync::Arc; use std::sync::Arc;
use std::sync::Mutex as StdMutex; use std::sync::Mutex as StdMutex;
use std::u32;
static DATA_QUEUE_CAT: Lazy<gst::DebugCategory> = Lazy::new(|| { static DATA_QUEUE_CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new( gst::DebugCategory::new(

View file

@ -30,7 +30,6 @@ use once_cell::sync::Lazy;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::time::Duration; use std::time::Duration;
use std::u32;
use crate::runtime::prelude::*; use crate::runtime::prelude::*;
use crate::runtime::{self, PadSink, PadSrc}; use crate::runtime::{self, PadSink, PadSrc};

View file

@ -266,7 +266,7 @@ impl SinkHandler {
inner.gap_packets.insert(GapPacket::new(buffer)); inner.gap_packets.insert(GapPacket::new(buffer));
if gap_packets_length > 0 { 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; let mut all_consecutive = true;
for gap_packet in inner.gap_packets.iter() { for gap_packet in inner.gap_packets.iter() {
@ -279,7 +279,7 @@ impl SinkHandler {
all_consecutive = gap_packet.pt == pt; 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; prev_gap_seq = gap_packet.seq as u32;
} else if gst_rtp::compare_seqnum(gap_packet.seq, prev_gap_seq as u16) != -1 { } else if gst_rtp::compare_seqnum(gap_packet.seq, prev_gap_seq as u16) != -1 {
all_consecutive = false; all_consecutive = false;

View file

@ -91,7 +91,7 @@ impl RTPJitterBufferItem {
r#type: 0, r#type: 0,
dts: dts.into().into_glib(), dts: dts.into().into_glib(),
pts: pts.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, count: 1,
rtptime, rtptime,
}, },
@ -138,7 +138,7 @@ impl RTPJitterBufferItem {
pub fn seqnum(&self) -> Option<u16> { pub fn seqnum(&self) -> Option<u16> {
unsafe { unsafe {
let item = self.0.as_ref().expect("Invalid wrapper"); 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 None
} else { } else {
Some(item.as_ref().seqnum as u16) Some(item.as_ref().seqnum as u16)
@ -306,7 +306,7 @@ impl RTPJitterBuffer {
let pts = from_glib(pts.assume_init()); let pts = from_glib(pts.assume_init());
let seqnum = seqnum.assume_init(); let seqnum = seqnum.assume_init();
let seqnum = if seqnum == std::u32::MAX { let seqnum = if seqnum == u32::MAX {
None None
} else { } else {
Some(seqnum as u16) Some(seqnum as u16)
@ -339,7 +339,7 @@ impl RTPJitterBuffer {
(None, None) (None, None)
} else { } else {
let seqnum = (*item).seqnum; let seqnum = (*item).seqnum;
let seqnum = if seqnum == std::u32::MAX { let seqnum = if seqnum == u32::MAX {
None None
} else { } else {
Some(seqnum as u16) Some(seqnum as u16)

View file

@ -31,7 +31,6 @@ use std::collections::{HashMap, VecDeque};
use std::sync::{Arc, Weak}; use std::sync::{Arc, Weak};
use std::sync::{Mutex, MutexGuard}; use std::sync::{Mutex, MutexGuard};
use std::time::Duration; use std::time::Duration;
use std::{u32, u64};
use crate::runtime::prelude::*; use crate::runtime::prelude::*;
use crate::runtime::{Context, PadSink, PadSinkWeak, PadSrc, PadSrcWeak, Task}; use crate::runtime::{Context, PadSink, PadSinkWeak, PadSrc, PadSrcWeak, Task};

View file

@ -30,7 +30,6 @@ use once_cell::sync::Lazy;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::sync::Mutex; use std::sync::Mutex;
use std::time::Duration; use std::time::Duration;
use std::{u32, u64};
use crate::runtime::prelude::*; use crate::runtime::prelude::*;
use crate::runtime::{Context, PadSink, PadSrc, Task}; use crate::runtime::{Context, PadSink, PadSrc, Task};

View file

@ -31,8 +31,6 @@ use std::io;
use std::net::{IpAddr, SocketAddr, TcpStream}; use std::net::{IpAddr, SocketAddr, TcpStream};
use std::sync::Mutex; use std::sync::Mutex;
use std::time::Duration; use std::time::Duration;
use std::u16;
use std::u32;
use crate::runtime::prelude::*; use crate::runtime::prelude::*;
use crate::runtime::task; use crate::runtime::task;

View file

@ -37,8 +37,6 @@ use std::collections::BTreeSet;
use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket}; use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::time::Duration; use std::time::Duration;
use std::u16;
use std::u8;
const DEFAULT_HOST: Option<&str> = Some("127.0.0.1"); const DEFAULT_HOST: Option<&str> = Some("127.0.0.1");
const DEFAULT_PORT: i32 = 5004; const DEFAULT_PORT: i32 = 5004;

View file

@ -27,12 +27,10 @@ use gst_net::*;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::i32;
use std::io; use std::io;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, UdpSocket}; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, UdpSocket};
use std::sync::Mutex; use std::sync::Mutex;
use std::time::Duration; use std::time::Duration;
use std::u16;
use crate::runtime::prelude::*; use crate::runtime::prelude::*;
use crate::runtime::{task, Async, Context, PadSrc, Task, TaskState}; use crate::runtime::{task, Async, Context, PadSrc, Task, TaskState};

View file

@ -107,7 +107,7 @@ fn setup_video_sink(pipeline: &gst::Pipeline, path: &Path, name: &str) -> Result
let enc = gst::ElementFactory::make("x264enc") let enc = gst::ElementFactory::make("x264enc")
.property("bframes", 0u32) .property("bframes", 0u32)
.property("bitrate", VIDEO_BITRATE / 1000u32) .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") .property_from_str("tune", "zerolatency")
.build()?; .build()?;
let h264_capsfilter = gst::ElementFactory::make("capsfilter") let h264_capsfilter = gst::ElementFactory::make("capsfilter")

View file

@ -135,13 +135,13 @@ impl ElementImpl for NdiSink {
gst_video::VideoFormat::Rgbx.to_str(), gst_video::VideoFormat::Rgbx.to_str(),
]), ]),
) )
.field("width", gst::IntRange::<i32>::new(1, std::i32::MAX)) .field("width", gst::IntRange::<i32>::new(1, i32::MAX))
.field("height", gst::IntRange::<i32>::new(1, std::i32::MAX)) .field("height", gst::IntRange::<i32>::new(1, i32::MAX))
.field( .field(
"framerate", "framerate",
gst::FractionRange::new( gst::FractionRange::new(
gst::Fraction::new(0, 1), gst::Fraction::new(0, 1),
gst::Fraction::new(std::i32::MAX, 1), gst::Fraction::new(i32::MAX, 1),
), ),
) )
.build(), .build(),

View file

@ -7,7 +7,6 @@ use gst_base::subclass::base_src::CreateSuccess;
use gst_base::subclass::prelude::*; use gst_base::subclass::prelude::*;
use std::sync::Mutex; use std::sync::Mutex;
use std::u32;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;

View file

@ -27,7 +27,9 @@ pub enum Buffer {
}, },
Metadata { Metadata {
frame: MetadataFrame, frame: MetadataFrame,
#[allow(unused)]
receive_time_gst: gst::ClockTime, receive_time_gst: gst::ClockTime,
#[allow(unused)]
receive_time_real: gst::ClockTime, receive_time_real: gst::ClockTime,
}, },
} }

View file

@ -226,8 +226,8 @@ pub enum NDIlib_frame_format_type_e {
NDIlib_frame_format_type_field_1 = 3, NDIlib_frame_format_type_field_1 = 3,
} }
pub const NDIlib_send_timecode_synthesize: i64 = ::std::i64::MAX; pub const NDIlib_send_timecode_synthesize: i64 = i64::MAX;
pub const NDIlib_recv_timestamp_undefined: i64 = ::std::i64::MAX; pub const NDIlib_recv_timestamp_undefined: i64 = i64::MAX;
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]

View file

@ -872,7 +872,7 @@ impl ElementImpl for RaptorqEnc {
fn pad_templates() -> &'static [gst::PadTemplate] { fn pad_templates() -> &'static [gst::PadTemplate] {
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| { static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
let caps = gst::Caps::builder("application/x-rtp") 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(); .build();
let srcpad_template = gst::PadTemplate::new( let srcpad_template = gst::PadTemplate::new(

View file

@ -9,7 +9,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0 // SPDX-License-Identifier: MIT OR Apache-2.0
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::time::Duration; use std::time::Duration;
use std::u64;
use futures::future; use futures::future;
use futures::prelude::*; use futures::prelude::*;
@ -539,6 +538,8 @@ impl ReqwestHttpSrc {
.unwrap_or(false); .unwrap_or(false);
let seekable = size.is_some() && accept_byte_ranges; 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 let position = if let Some((range_start, _)) = headers
.typed_get::<ContentRange>() .typed_get::<ContentRange>()
.and_then(|range| range.bytes_range()) .and_then(|range| range.bytes_range())

View file

@ -153,7 +153,7 @@ impl JitterBuffer {
}); });
// Maintain (and trim) our seqnum list for duplicate detection // Maintain (and trim) our seqnum list for duplicate detection
while self.seqnums.len() >= std::u16::MAX as usize { while self.seqnums.len() >= u16::MAX as usize {
debug!("Trimming"); debug!("Trimming");
self.seqnums.pop_first(); self.seqnums.pop_first();
} }
@ -436,8 +436,8 @@ mod tests {
let packet = RtpPacket::parse(&rtp_data).unwrap(); let packet = RtpPacket::parse(&rtp_data).unwrap();
assert_eq!(jb.queue_packet(&packet, 0, now), QueueResult::Duplicate); assert_eq!(jb.queue_packet(&packet, 0, now), QueueResult::Duplicate);
// We do accept future sequence numbers up to a distance of at least std::i16::MAX // We do accept future sequence numbers up to a distance of at least i16::MAX
let rtp_data = generate_rtp_packet(0x12345678, std::i16::MAX as u16 + 1, 0, 4); let rtp_data = generate_rtp_packet(0x12345678, i16::MAX as u16 + 1, 0, 4);
let packet = RtpPacket::parse(&rtp_data).unwrap(); let packet = RtpPacket::parse(&rtp_data).unwrap();
let QueueResult::Queued(id) = jb.queue_packet(&packet, 0, now) else { let QueueResult::Queued(id) = jb.queue_packet(&packet, 0, now) else {
unreachable!() unreachable!()

View file

@ -129,6 +129,7 @@ impl Source {
#[derive(Debug)] #[derive(Debug)]
pub struct ReceivedRb { pub struct ReceivedRb {
pub rb: Rb, pub rb: Rb,
#[allow(unused)]
pub receive_time: Instant, pub receive_time: Instant,
pub receive_ntp_time: NtpTime, pub receive_ntp_time: NtpTime,
} }

View file

@ -323,7 +323,7 @@ impl Context {
.entry(cname.clone()) .entry(cname.clone())
.or_insert_with(|| { .or_insert_with(|| {
let mut cname_largest_delay = CnameLargestDelay { let mut cname_largest_delay = CnameLargestDelay {
largest_delay: std::i64::MIN, largest_delay: i64::MIN,
all_sync: true, all_sync: true,
}; };

View file

@ -325,7 +325,7 @@ impl ExtendedTimestamp {
if ext < last_ext { if ext < last_ext {
let diff = last_ext - ext; let diff = last_ext - ext;
if diff > std::i32::MAX as u64 { if diff > i32::MAX as u64 {
// timestamp went backwards more than allowed, we wrap around and get // timestamp went backwards more than allowed, we wrap around and get
// updated extended timestamp. // updated extended timestamp.
ext += 1u64 << 32; ext += 1u64 << 32;
@ -333,7 +333,7 @@ impl ExtendedTimestamp {
} else { } else {
let diff = ext - last_ext; let diff = ext - last_ext;
if diff > std::i32::MAX as u64 { if diff > i32::MAX as u64 {
if ext < 1u64 << 32 { if ext < 1u64 << 32 {
// We can't ever get to such a case as our counter is opaque // We can't ever get to such a case as our counter is opaque
unreachable!() unreachable!()
@ -374,7 +374,7 @@ impl ExtendedSeqnum {
if ext < last_ext { if ext < last_ext {
let diff = last_ext - ext; let diff = last_ext - ext;
if diff > std::i16::MAX as u64 { if diff > i16::MAX as u64 {
// timestamp went backwards more than allowed, we wrap around and get // timestamp went backwards more than allowed, we wrap around and get
// updated extended timestamp. // updated extended timestamp.
ext += 1u64 << 16; ext += 1u64 << 16;
@ -382,7 +382,7 @@ impl ExtendedSeqnum {
} else { } else {
let diff = ext - last_ext; let diff = ext - last_ext;
if diff > std::i16::MAX as u64 { if diff > i16::MAX as u64 {
if ext < 1u64 << 16 { if ext < 1u64 << 16 {
// We can't ever get to such a case as our counter is opaque // We can't ever get to such a case as our counter is opaque
unreachable!() unreachable!()
@ -644,8 +644,8 @@ mod tests {
assert_eq!(ext_ts.next(10), (1 << 32) + 10); assert_eq!(ext_ts.next(10), (1 << 32) + 10);
assert_eq!(ext_ts.next(10), (1 << 32) + 10); assert_eq!(ext_ts.next(10), (1 << 32) + 10);
assert_eq!( assert_eq!(
ext_ts.next(1 + std::i32::MAX as u32), ext_ts.next(1 + i32::MAX as u32),
(1 << 32) + 1 + std::i32::MAX as u64 (1 << 32) + 1 + i32::MAX as u64
); );
// Even big bumps under G_MAXINT32 don't result in wrap-around // Even big bumps under G_MAXINT32 don't result in wrap-around
@ -659,14 +659,11 @@ mod tests {
fn extended_timestamp_wraparound() { fn extended_timestamp_wraparound() {
let mut ext_ts = ExtendedTimestamp::default(); let mut ext_ts = ExtendedTimestamp::default();
assert_eq!( assert_eq!(
ext_ts.next(std::u32::MAX - 90000 + 1), ext_ts.next(u32::MAX - 90000 + 1),
(1 << 32) + std::u32::MAX as u64 - 90000 + 1 (1 << 32) + u32::MAX as u64 - 90000 + 1
);
assert_eq!(ext_ts.next(0), (1 << 32) + std::u32::MAX as u64 + 1);
assert_eq!(
ext_ts.next(90000),
(1 << 32) + std::u32::MAX as u64 + 1 + 90000
); );
assert_eq!(ext_ts.next(0), (1 << 32) + u32::MAX as u64 + 1);
assert_eq!(ext_ts.next(90000), (1 << 32) + u32::MAX as u64 + 1 + 90000);
} }
#[test] #[test]
@ -674,20 +671,17 @@ mod tests {
let mut ext_ts = ExtendedTimestamp::default(); let mut ext_ts = ExtendedTimestamp::default();
assert_eq!( assert_eq!(
ext_ts.next(std::u32::MAX - 90000 + 1), ext_ts.next(u32::MAX - 90000 + 1),
(1 << 32) + std::u32::MAX as u64 - 90000 + 1 (1 << 32) + u32::MAX as u64 - 90000 + 1
); );
assert_eq!(ext_ts.next(0), (1 << 32) + std::u32::MAX as u64 + 1); assert_eq!(ext_ts.next(0), (1 << 32) + u32::MAX as u64 + 1);
// Unwrapping around // Unwrapping around
assert_eq!( assert_eq!(
ext_ts.next(std::u32::MAX - 90000 + 1), ext_ts.next(u32::MAX - 90000 + 1),
(1 << 32) + std::u32::MAX as u64 - 90000 + 1 (1 << 32) + u32::MAX as u64 - 90000 + 1
);
assert_eq!(
ext_ts.next(90000),
(1 << 32) + std::u32::MAX as u64 + 1 + 90000
); );
assert_eq!(ext_ts.next(90000), (1 << 32) + u32::MAX as u64 + 1 + 90000);
} }
#[test] #[test]
@ -698,8 +692,8 @@ mod tests {
// Wraps backwards // Wraps backwards
assert_eq!( assert_eq!(
ext_ts.next(std::u32::MAX - 90000 + 1), ext_ts.next(u32::MAX - 90000 + 1),
std::u32::MAX as u64 - 90000 + 1 u32::MAX as u64 - 90000 + 1
); );
// Wraps again forwards // Wraps again forwards
@ -715,8 +709,8 @@ mod tests {
assert_eq!(ext_seq.next(10), (1 << 16) + 10); assert_eq!(ext_seq.next(10), (1 << 16) + 10);
assert_eq!(ext_seq.next(10), (1 << 16) + 10); assert_eq!(ext_seq.next(10), (1 << 16) + 10);
assert_eq!( assert_eq!(
ext_seq.next(1 + std::i16::MAX as u16), ext_seq.next(1 + i16::MAX as u16),
(1 << 16) + 1 + std::i16::MAX as u64 (1 << 16) + 1 + i16::MAX as u64
); );
// Even big bumps under MAXINT16 don't result in wrap-around // Even big bumps under MAXINT16 don't result in wrap-around
@ -730,14 +724,11 @@ mod tests {
fn extended_seqnum_wraparound() { fn extended_seqnum_wraparound() {
let mut ext_seq = ExtendedSeqnum::default(); let mut ext_seq = ExtendedSeqnum::default();
assert_eq!( assert_eq!(
ext_seq.next(std::u16::MAX - 9000 + 1), ext_seq.next(u16::MAX - 9000 + 1),
(1 << 16) + std::u16::MAX as u64 - 9000 + 1 (1 << 16) + u16::MAX as u64 - 9000 + 1
);
assert_eq!(ext_seq.next(0), (1 << 16) + std::u16::MAX as u64 + 1);
assert_eq!(
ext_seq.next(9000),
(1 << 16) + std::u16::MAX as u64 + 1 + 9000
); );
assert_eq!(ext_seq.next(0), (1 << 16) + u16::MAX as u64 + 1);
assert_eq!(ext_seq.next(9000), (1 << 16) + u16::MAX as u64 + 1 + 9000);
} }
#[test] #[test]
@ -745,20 +736,17 @@ mod tests {
let mut ext_seq = ExtendedSeqnum::default(); let mut ext_seq = ExtendedSeqnum::default();
assert_eq!( assert_eq!(
ext_seq.next(std::u16::MAX - 9000 + 1), ext_seq.next(u16::MAX - 9000 + 1),
(1 << 16) + std::u16::MAX as u64 - 9000 + 1 (1 << 16) + u16::MAX as u64 - 9000 + 1
); );
assert_eq!(ext_seq.next(0), (1 << 16) + std::u16::MAX as u64 + 1); assert_eq!(ext_seq.next(0), (1 << 16) + u16::MAX as u64 + 1);
// Unwrapping around // Unwrapping around
assert_eq!( assert_eq!(
ext_seq.next(std::u16::MAX - 9000 + 1), ext_seq.next(u16::MAX - 9000 + 1),
(1 << 16) + std::u16::MAX as u64 - 9000 + 1 (1 << 16) + u16::MAX as u64 - 9000 + 1
);
assert_eq!(
ext_seq.next(9000),
(1 << 16) + std::u16::MAX as u64 + 1 + 9000
); );
assert_eq!(ext_seq.next(9000), (1 << 16) + u16::MAX as u64 + 1 + 9000);
} }
#[test] #[test]
@ -769,8 +757,8 @@ mod tests {
// Wraps backwards // Wraps backwards
assert_eq!( assert_eq!(
ext_seq.next(std::u16::MAX - 9000 + 1), ext_seq.next(u16::MAX - 9000 + 1),
std::u16::MAX as u64 - 9000 + 1 u16::MAX as u64 - 9000 + 1
); );
// Wraps again forwards // Wraps again forwards

View file

@ -19,6 +19,7 @@ use smallvec::SmallVec;
use super::bool_decoder::BoolDecoder; use super::bool_decoder::BoolDecoder;
#[derive(Debug)] #[derive(Debug)]
#[allow(unused)]
pub struct UncompressedFrameHeader { pub struct UncompressedFrameHeader {
pub first_partition_size: u32, pub first_partition_size: u32,
pub is_keyframe: bool, pub is_keyframe: bool,
@ -83,6 +84,7 @@ impl FromByteStream for UncompressedFrameHeader {
} }
#[derive(Debug)] #[derive(Debug)]
#[allow(unused)]
pub struct FrameHeader { pub struct FrameHeader {
pub color_space: Option<u8>, pub color_space: Option<u8>,
pub clamping_type: Option<u8>, pub clamping_type: Option<u8>,
@ -176,6 +178,7 @@ impl<'a> FromBitStreamWith<'a> for FrameHeader {
} }
#[derive(Debug)] #[derive(Debug)]
#[allow(unused)]
pub struct UpdateSegmentation { pub struct UpdateSegmentation {
pub segment_feature_data: Option<SegmentFeatureData>, pub segment_feature_data: Option<SegmentFeatureData>,
pub mb_segmentation_map: Option<MbSegmentationMap>, pub mb_segmentation_map: Option<MbSegmentationMap>,
@ -217,6 +220,7 @@ impl FromBitStream for UpdateSegmentation {
} }
#[derive(Debug)] #[derive(Debug)]
#[allow(unused)]
pub struct SegmentFeatureData { pub struct SegmentFeatureData {
pub segment_feature_mode: u8, pub segment_feature_mode: u8,
pub quantizer_update: SmallVec<[Option<i8>; 4]>, pub quantizer_update: SmallVec<[Option<i8>; 4]>,
@ -262,6 +266,7 @@ impl FromBitStream for SegmentFeatureData {
} }
#[derive(Debug)] #[derive(Debug)]
#[allow(unused)]
pub struct MbSegmentationMap { pub struct MbSegmentationMap {
pub segment_probs: SmallVec<[Option<u8>; 3]>, pub segment_probs: SmallVec<[Option<u8>; 3]>,
} }
@ -291,6 +296,7 @@ impl FromBitStream for MbSegmentationMap {
} }
#[derive(Debug)] #[derive(Debug)]
#[allow(unused)]
pub struct MbLfAdjustments { pub struct MbLfAdjustments {
pub ref_frame_delta_update: SmallVec<[Option<i8>; 4]>, pub ref_frame_delta_update: SmallVec<[Option<i8>; 4]>,
pub mb_mode_delta_update: SmallVec<[Option<i8>; 4]>, pub mb_mode_delta_update: SmallVec<[Option<i8>; 4]>,
@ -342,6 +348,7 @@ impl FromBitStream for MbLfAdjustments {
} }
#[derive(Debug)] #[derive(Debug)]
#[allow(unused)]
pub struct FrameInfo { pub struct FrameInfo {
pub uncompressed_frame_header: UncompressedFrameHeader, pub uncompressed_frame_header: UncompressedFrameHeader,
pub frame_header: FrameHeader, pub frame_header: FrameHeader,

View file

@ -11,6 +11,7 @@ use anyhow::{bail, Context as _};
use bitstream_io::{FromBitStream, FromBitStreamWith}; use bitstream_io::{FromBitStream, FromBitStreamWith};
#[derive(Debug)] #[derive(Debug)]
#[allow(unused)]
pub struct FrameHeader { pub struct FrameHeader {
pub profile: u8, pub profile: u8,
pub show_existing_frame: bool, pub show_existing_frame: bool,
@ -86,6 +87,7 @@ impl FromBitStream for FrameHeader {
} }
#[derive(Debug)] #[derive(Debug)]
#[allow(unused)]
pub struct KeyframeInfo { pub struct KeyframeInfo {
// sync code // sync code
// color config // color config
@ -162,6 +164,7 @@ impl KeyframeInfo {
} }
#[derive(Debug)] #[derive(Debug)]
#[allow(unused)]
pub struct ColorConfig { pub struct ColorConfig {
pub bit_depth: u8, pub bit_depth: u8,
pub color_space: u8, pub color_space: u8,

View file

@ -19,7 +19,6 @@ use byte_slice_cast::*;
use std::ops::Rem; use std::ops::Rem;
use std::sync::Mutex; use std::sync::Mutex;
use std::u32;
use num_traits::cast::NumCast; use num_traits::cast::NumCast;
use num_traits::float::Float; use num_traits::float::Float;

View file

@ -262,21 +262,21 @@ impl ObjectImpl for FallbackSrc {
glib::ParamSpecUInt64::builder("timeout") glib::ParamSpecUInt64::builder("timeout")
.nick("Timeout") .nick("Timeout")
.blurb("Timeout for switching to the fallback URI") .blurb("Timeout for switching to the fallback URI")
.maximum(std::u64::MAX - 1) .maximum(u64::MAX - 1)
.default_value(5 * *gst::ClockTime::SECOND) .default_value(5 * *gst::ClockTime::SECOND)
.mutable_ready() .mutable_ready()
.build(), .build(),
glib::ParamSpecUInt64::builder("restart-timeout") glib::ParamSpecUInt64::builder("restart-timeout")
.nick("Timeout") .nick("Timeout")
.blurb("Timeout for restarting an active source") .blurb("Timeout for restarting an active source")
.maximum(std::u64::MAX - 1) .maximum(u64::MAX - 1)
.default_value(5 * *gst::ClockTime::SECOND) .default_value(5 * *gst::ClockTime::SECOND)
.mutable_ready() .mutable_ready()
.build(), .build(),
glib::ParamSpecUInt64::builder("retry-timeout") glib::ParamSpecUInt64::builder("retry-timeout")
.nick("Retry Timeout") .nick("Retry Timeout")
.blurb("Timeout for stopping after repeated failure") .blurb("Timeout for stopping after repeated failure")
.maximum(std::u64::MAX - 1) .maximum(u64::MAX - 1)
.default_value(60 * *gst::ClockTime::SECOND) .default_value(60 * *gst::ClockTime::SECOND)
.mutable_ready() .mutable_ready()
.build(), .build(),
@ -296,14 +296,14 @@ impl ObjectImpl for FallbackSrc {
.blurb("When the main source has a higher latency than the fallback source \ .blurb("When the main source has a higher latency than the fallback source \
this allows to configure a minimum latency that would be configured \ this allows to configure a minimum latency that would be configured \
if initially the fallback is enabled") if initially the fallback is enabled")
.maximum(std::u64::MAX - 1) .maximum(u64::MAX - 1)
.mutable_ready() .mutable_ready()
.build(), .build(),
glib::ParamSpecInt64::builder("buffer-duration") glib::ParamSpecInt64::builder("buffer-duration")
.nick("Buffer Duration") .nick("Buffer Duration")
.blurb("Buffer duration when buffering streams (-1 default value)") .blurb("Buffer duration when buffering streams (-1 default value)")
.minimum(-1) .minimum(-1)
.maximum(std::i64::MAX - 1) .maximum(i64::MAX - 1)
.default_value(-1) .default_value(-1)
.mutable_ready() .mutable_ready()
.build(), .build(),

View file

@ -1329,21 +1329,21 @@ impl ObjectImpl for FallbackSwitch {
glib::ParamSpecUInt64::builder(PROP_TIMEOUT) glib::ParamSpecUInt64::builder(PROP_TIMEOUT)
.nick("Input timeout") .nick("Input timeout")
.blurb("Timeout on an input before switching to a lower priority input.") .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()) .default_value(Settings::default().timeout.nseconds())
.mutable_playing() .mutable_playing()
.build(), .build(),
glib::ParamSpecUInt64::builder(PROP_LATENCY) glib::ParamSpecUInt64::builder(PROP_LATENCY)
.nick("Latency") .nick("Latency")
.blurb("Additional latency in live mode to allow upstream to take longer to produce buffers for the current position (in nanoseconds)") .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()) .default_value(Settings::default().latency.nseconds())
.mutable_ready() .mutable_ready()
.build(), .build(),
glib::ParamSpecUInt64::builder(PROP_MIN_UPSTREAM_LATENCY) glib::ParamSpecUInt64::builder(PROP_MIN_UPSTREAM_LATENCY)
.nick("Minimum 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)") .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()) .default_value(Settings::default().min_upstream_latency.nseconds())
.mutable_ready() .mutable_ready()
.build(), .build(),

View file

@ -20,7 +20,6 @@ use once_cell::sync::Lazy;
use parking_lot::{Condvar, Mutex, MutexGuard}; use parking_lot::{Condvar, Mutex, MutexGuard};
use std::cmp; use std::cmp;
use std::collections::HashMap; use std::collections::HashMap;
use std::f64;
use std::iter; use std::iter;
use std::sync::Arc; use std::sync::Arc;

View file

@ -15,7 +15,6 @@ use crate::ccutils::{extract_cdp, ParseError, ParseErrorCode};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::sync::Mutex; use std::sync::Mutex;
use std::u64;
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| { static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new( gst::DebugCategory::new(

View file

@ -1147,8 +1147,8 @@ impl ElementImpl for MccParse {
{ {
let caps = caps.get_mut().unwrap(); let caps = caps.get_mut().unwrap();
let framerate = gst::FractionRange::new( let framerate = gst::FractionRange::new(
gst::Fraction::new(1, std::i32::MAX), gst::Fraction::new(1, i32::MAX),
gst::Fraction::new(std::i32::MAX, 1), gst::Fraction::new(i32::MAX, 1),
); );
let s = gst::Structure::builder("closedcaption/x-cea-708") let s = gst::Structure::builder("closedcaption/x-cea-708")

View file

@ -559,8 +559,8 @@ impl ElementImpl for TtToCea608 {
.unwrap(); .unwrap();
let framerate = gst::FractionRange::new( let framerate = gst::FractionRange::new(
gst::Fraction::new(1, std::i32::MAX), gst::Fraction::new(1, i32::MAX),
gst::Fraction::new(std::i32::MAX, 1), gst::Fraction::new(i32::MAX, 1),
); );
let caps = gst::Caps::builder("closedcaption/x-cea-608") let caps = gst::Caps::builder("closedcaption/x-cea-608")

View file

@ -625,8 +625,8 @@ impl ElementImpl for TtToCea708 {
.unwrap(); .unwrap();
let framerate = gst::FractionRange::new( let framerate = gst::FractionRange::new(
gst::Fraction::new(1, std::i32::MAX), gst::Fraction::new(1, i32::MAX),
gst::Fraction::new(std::i32::MAX, 1), gst::Fraction::new(i32::MAX, 1),
); );
let caps = gst::Caps::builder("closedcaption/x-cea-708") let caps = gst::Caps::builder("closedcaption/x-cea-708")

View file

@ -6,8 +6,6 @@
// //
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
use std::u8;
use gst::prelude::*; use gst::prelude::*;
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;

View file

@ -16,7 +16,6 @@ use gst_video::subclass::prelude::*;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::i32;
use std::sync::{Mutex, MutexGuard}; use std::sync::{Mutex, MutexGuard};
const DEFAULT_N_THREADS: u32 = 0; const DEFAULT_N_THREADS: u32 = 0;
@ -645,7 +644,7 @@ impl ObjectImpl for Dav1dDec {
.nick("Maximum frame delay") .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)") .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) .minimum(-1)
.maximum(std::u32::MAX.into()) .maximum(u32::MAX.into())
.default_value(DEFAULT_MAX_FRAME_DELAY) .default_value(DEFAULT_MAX_FRAME_DELAY)
.mutable_ready() .mutable_ready()
.build(), .build(),

View file

@ -150,7 +150,7 @@ impl ObjectImpl for GifEnc {
.nick("Repeat") .nick("Repeat")
.blurb("Repeat (-1 to loop forever, 0 .. n finite repetitions)") .blurb("Repeat (-1 to loop forever, 0 .. n finite repetitions)")
.minimum(-1) .minimum(-1)
.maximum(std::u16::MAX as i32) .maximum(u16::MAX as i32)
.default_value(DEFAULT_REPEAT) .default_value(DEFAULT_REPEAT)
.mutable_ready() .mutable_ready()
.build(), .build(),

View file

@ -292,7 +292,7 @@ impl ObjectImpl for Rav1Enc {
glib::ParamSpecUInt::builder("min-quantizer") glib::ParamSpecUInt::builder("min-quantizer")
.nick("Min Quantizer") .nick("Min Quantizer")
.blurb("Min Quantizer") .blurb("Min Quantizer")
.maximum(std::u8::MAX as u32) .maximum(u8::MAX as u32)
.default_value(DEFAULT_MIN_QUANTIZER as u32) .default_value(DEFAULT_MIN_QUANTIZER as u32)
.mutable_ready() .mutable_ready()
.build(), .build(),