mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 21:41:03 +00:00
threadshare: address clippy errors
This commit is contained in:
parent
202ff408e7
commit
9d7e304fc6
6 changed files with 44 additions and 35 deletions
|
@ -229,6 +229,11 @@ impl glib::subclass::boxed::BoxedType for IOContext {
|
|||
|
||||
glib_boxed_derive_traits!(IOContext);
|
||||
|
||||
type PendingFutures = Mutex<(
|
||||
u64,
|
||||
HashMap<u64, FuturesUnordered<Box<dyn Future<Item = (), Error = ()> + Send + 'static>>>,
|
||||
)>;
|
||||
|
||||
struct IOContextInner {
|
||||
name: String,
|
||||
runtime_handle: Mutex<tokio_current_thread::Handle>,
|
||||
|
@ -236,10 +241,7 @@ struct IOContextInner {
|
|||
timers: Arc<Mutex<BinaryHeap<TimerEntry>>>,
|
||||
// Only used for dropping
|
||||
_shutdown: IOContextShutdown,
|
||||
pending_futures: Mutex<(
|
||||
u64,
|
||||
HashMap<u64, FuturesUnordered<Box<dyn Future<Item = (), Error = ()> + Send + 'static>>>,
|
||||
)>,
|
||||
pending_futures: PendingFutures,
|
||||
}
|
||||
|
||||
impl Drop for IOContextInner {
|
||||
|
|
|
@ -544,11 +544,10 @@ impl JitterBuffer {
|
|||
|
||||
state.last_in_seqnum = seq as u32;
|
||||
|
||||
let jb_item = match estimated_dts {
|
||||
true => {
|
||||
RTPJitterBufferItem::new(buffer, gst::CLOCK_TIME_NONE, pts, seq as u32, rtptime)
|
||||
}
|
||||
false => RTPJitterBufferItem::new(buffer, dts, pts, seq as u32, rtptime),
|
||||
let jb_item = if estimated_dts {
|
||||
RTPJitterBufferItem::new(buffer, gst::CLOCK_TIME_NONE, pts, seq as u32, rtptime)
|
||||
} else {
|
||||
RTPJitterBufferItem::new(buffer, dts, pts, seq as u32, rtptime)
|
||||
};
|
||||
|
||||
let (success, _, _) = state.jbuf.borrow().insert(jb_item);
|
||||
|
@ -606,17 +605,17 @@ impl JitterBuffer {
|
|||
);
|
||||
|
||||
if state.last_popped_seqnum != std::u32::MAX {
|
||||
let mut lost_seqnum = (state.last_popped_seqnum + 1 & 0xffff) as i64;
|
||||
let mut lost_seqnum = ((state.last_popped_seqnum + 1) & 0xffff) as i64;
|
||||
let gap = gst_rtp::compare_seqnum(lost_seqnum as u16, seqnum as u16) as i64;
|
||||
|
||||
if gap > 0 {
|
||||
let interval = pts.nseconds().unwrap() as i64
|
||||
- state.last_popped_pts.nseconds().unwrap() as i64;
|
||||
let mut spacing: i64 = 0;
|
||||
|
||||
if interval >= 0 {
|
||||
spacing = interval / (gap as i64 + 1);
|
||||
}
|
||||
let spacing = if interval >= 0 {
|
||||
interval / (gap as i64 + 1)
|
||||
} else {
|
||||
0
|
||||
};
|
||||
|
||||
*discont = true;
|
||||
|
||||
|
@ -653,11 +652,7 @@ impl JitterBuffer {
|
|||
|
||||
while lost_seqnum != seqnum as i64 {
|
||||
let timestamp = state.last_popped_pts + gst::ClockTime(Some(spacing as u64));
|
||||
let mut duration = 0;
|
||||
|
||||
if state.equidistant > 0 {
|
||||
duration = spacing;
|
||||
}
|
||||
let duration = if state.equidistant > 0 { spacing } else { 0 };
|
||||
|
||||
state.last_popped_pts = timestamp;
|
||||
|
||||
|
@ -899,7 +894,7 @@ impl JitterBuffer {
|
|||
break;
|
||||
}
|
||||
|
||||
if let Err(_) = self.pop_and_push(state, element) {
|
||||
if self.pop_and_push(state, element).is_err() {
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
|
@ -983,10 +978,7 @@ impl JitterBuffer {
|
|||
QueryView::Drain(..) => {
|
||||
let mut state = self.state.lock().unwrap();
|
||||
gst_info!(self.cat, obj: pad, "Draining");
|
||||
match self.enqueue_item(&mut state, pad, element, None) {
|
||||
Err(_) => false,
|
||||
Ok(_) => true,
|
||||
}
|
||||
self.enqueue_item(&mut state, pad, element, None).is_ok()
|
||||
}
|
||||
_ => self.src_pad.peer_query(query),
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
// Boston, MA 02110-1335, USA.
|
||||
|
||||
#![crate_type = "cdylib"]
|
||||
#![allow(clippy::cast_lossless)]
|
||||
|
||||
extern crate libc;
|
||||
|
||||
|
@ -275,14 +276,14 @@ impl RTPJitterBufferItem {
|
|||
r#type: 0,
|
||||
dts: dts.to_glib(),
|
||||
pts: pts.to_glib(),
|
||||
seqnum: seqnum,
|
||||
seqnum,
|
||||
count: 1,
|
||||
rtptime: rtptime,
|
||||
rtptime,
|
||||
})))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_buffer(&self) -> &mut gst::BufferRef {
|
||||
pub fn get_buffer(&mut self) -> &mut gst::BufferRef {
|
||||
unsafe {
|
||||
let item = self.0.as_ref().expect("Invalid wrapper");
|
||||
let buf = item.data as *mut gst_ffi::GstBuffer;
|
||||
|
@ -368,6 +369,12 @@ impl RTPPacketRateCtx {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for RTPPacketRateCtx {
|
||||
fn default() -> Self {
|
||||
RTPPacketRateCtx::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
||||
pub enum RTPJitterBufferMode {
|
||||
r#None,
|
||||
|
@ -502,3 +509,9 @@ impl RTPJitterBuffer {
|
|||
unsafe { ffi::rtp_jitter_buffer_reset_skew(self.to_glib_none().0) }
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for RTPJitterBuffer {
|
||||
fn default() -> Self {
|
||||
RTPJitterBuffer::new()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -480,9 +480,8 @@ impl ProxySink {
|
|||
}
|
||||
|
||||
let state = self.state.lock().unwrap();
|
||||
let queue = state.queue.as_ref().unwrap();
|
||||
let res = queue.0.lock().unwrap().last_res;
|
||||
res
|
||||
let inner_queue = state.queue.as_ref().unwrap().0.lock().unwrap();
|
||||
inner_queue.last_res
|
||||
}
|
||||
|
||||
fn sink_chain(
|
||||
|
@ -924,6 +923,8 @@ impl ProxySrc {
|
|||
use gst::EventView;
|
||||
|
||||
let mut new_event = None;
|
||||
#[allow(clippy::redundant_pattern_matching)]
|
||||
#[allow(clippy::single_match)]
|
||||
match event.view() {
|
||||
EventView::CustomDownstreamSticky(e) => {
|
||||
let s = e.get_structure().unwrap();
|
||||
|
|
|
@ -191,9 +191,9 @@ impl Queue {
|
|||
match pending_queue {
|
||||
None => queue.push(item),
|
||||
Some(PendingQueue {
|
||||
task: _,
|
||||
scheduled: false,
|
||||
ref mut items,
|
||||
..
|
||||
}) => {
|
||||
let mut failed_item = None;
|
||||
while let Some(item) = items.pop_front() {
|
||||
|
@ -225,7 +225,6 @@ impl Queue {
|
|||
gst_log!(self.cat, obj: element, "Scheduling pending queue now");
|
||||
|
||||
let State {
|
||||
queue: _,
|
||||
ref mut pending_queue,
|
||||
ref io_context_in,
|
||||
pending_future_id_in,
|
||||
|
@ -257,8 +256,8 @@ impl Queue {
|
|||
|
||||
let res = if let Some(PendingQueue {
|
||||
ref mut task,
|
||||
scheduled: _,
|
||||
ref mut items,
|
||||
..
|
||||
}) = *pending_queue
|
||||
{
|
||||
let mut failed_item = None;
|
||||
|
@ -525,6 +524,8 @@ impl Queue {
|
|||
use gst::QueryView;
|
||||
|
||||
gst_log!(self.cat, obj: pad, "Handling query {:?}", query);
|
||||
#[allow(clippy::redundant_pattern_matching)]
|
||||
#[allow(clippy::single_match)]
|
||||
match query.view_mut() {
|
||||
QueryView::Scheduling(ref mut q) => {
|
||||
let mut new_query = gst::Query::new_scheduling();
|
||||
|
|
|
@ -104,7 +104,7 @@ impl<T: SocketRead + 'static> Socket<T> {
|
|||
|
||||
assert_eq!(inner.state, SocketState::Unscheduled);
|
||||
inner.state = SocketState::Scheduled;
|
||||
if let Err(_) = inner.buffer_pool.set_active(true) {
|
||||
if inner.buffer_pool.set_active(true).is_err() {
|
||||
gst_error!(SOCKET_CAT, obj: &inner.element, "Failed to activate buffer pool");
|
||||
return Err(());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue