mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-28 22:41:02 +00:00
Fix various new clippy warnings due to MSRV bump
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1864>
This commit is contained in:
parent
d8a912a952
commit
ec8759ae44
15 changed files with 26 additions and 52 deletions
|
@ -461,7 +461,7 @@ impl Decrypter {
|
||||||
|
|
||||||
self.sinkpad
|
self.sinkpad
|
||||||
.pull_range(pull_offset, total_size)
|
.pull_range(pull_offset, total_size)
|
||||||
.map_err(|err| {
|
.inspect_err(|&err| {
|
||||||
match err {
|
match err {
|
||||||
gst::FlowError::Flushing => {
|
gst::FlowError::Flushing => {
|
||||||
gst::debug!(
|
gst::debug!(
|
||||||
|
@ -482,8 +482,6 @@ impl Decrypter {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
err
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,9 +192,8 @@ impl Encrypter {
|
||||||
drop(state_guard);
|
drop(state_guard);
|
||||||
|
|
||||||
for buffer in buffers {
|
for buffer in buffers {
|
||||||
self.srcpad.push(buffer).map_err(|err| {
|
self.srcpad.push(buffer).inspect_err(|&err| {
|
||||||
gst::error!(CAT, imp = self, "Failed to push buffer {:?}", err);
|
gst::error!(CAT, imp = self, "Failed to push buffer {:?}", err);
|
||||||
err
|
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,9 +194,8 @@ impl TaskImpl for SrcTask {
|
||||||
}
|
}
|
||||||
buffer
|
buffer
|
||||||
})
|
})
|
||||||
.map_err(|err| {
|
.inspect_err(|&err| {
|
||||||
gst::error!(CAT, obj = self.elem, "Failed to acquire buffer {err}");
|
gst::error!(CAT, obj = self.elem, "Failed to acquire buffer {err}");
|
||||||
err
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
debug_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Forwarding buffer");
|
debug_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Forwarding buffer");
|
||||||
|
|
|
@ -218,14 +218,12 @@ impl Scheduler {
|
||||||
tasks_checked = 0;
|
tasks_checked = 0;
|
||||||
while tasks_checked < Self::MAX_SUCCESSIVE_TASKS {
|
while tasks_checked < Self::MAX_SUCCESSIVE_TASKS {
|
||||||
if let Ok(runnable) = self.tasks.pop_runnable() {
|
if let Ok(runnable) = self.tasks.pop_runnable() {
|
||||||
panic::catch_unwind(|| runnable.run()).map_err(|err| {
|
panic::catch_unwind(|| runnable.run()).inspect_err(|_err| {
|
||||||
gst::error!(
|
gst::error!(
|
||||||
RUNTIME_CAT,
|
RUNTIME_CAT,
|
||||||
"A task has panicked within Context {}",
|
"A task has panicked within Context {}",
|
||||||
self.context_name
|
self.context_name
|
||||||
);
|
);
|
||||||
|
|
||||||
err
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
tasks_checked += 1;
|
tasks_checked += 1;
|
||||||
|
|
|
@ -224,14 +224,13 @@ impl PadSrcInner {
|
||||||
pub async fn push(&self, buffer: gst::Buffer) -> Result<FlowSuccess, FlowError> {
|
pub async fn push(&self, buffer: gst::Buffer) -> Result<FlowSuccess, FlowError> {
|
||||||
gst::log!(RUNTIME_CAT, obj = self.gst_pad, "Pushing {:?}", buffer);
|
gst::log!(RUNTIME_CAT, obj = self.gst_pad, "Pushing {:?}", buffer);
|
||||||
|
|
||||||
let success = self.gst_pad.push(buffer).map_err(|err| {
|
let success = self.gst_pad.push(buffer).inspect_err(|&err| {
|
||||||
gst::error!(
|
gst::error!(
|
||||||
RUNTIME_CAT,
|
RUNTIME_CAT,
|
||||||
obj = self.gst_pad,
|
obj = self.gst_pad,
|
||||||
"Failed to push Buffer to PadSrc: {:?}",
|
"Failed to push Buffer to PadSrc: {:?}",
|
||||||
err,
|
err,
|
||||||
);
|
);
|
||||||
err
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
gst::log!(
|
gst::log!(
|
||||||
|
@ -247,14 +246,13 @@ impl PadSrcInner {
|
||||||
pub async fn push_list(&self, list: gst::BufferList) -> Result<FlowSuccess, FlowError> {
|
pub async fn push_list(&self, list: gst::BufferList) -> Result<FlowSuccess, FlowError> {
|
||||||
gst::log!(RUNTIME_CAT, obj = self.gst_pad, "Pushing {:?}", list);
|
gst::log!(RUNTIME_CAT, obj = self.gst_pad, "Pushing {:?}", list);
|
||||||
|
|
||||||
let success = self.gst_pad.push_list(list).map_err(|err| {
|
let success = self.gst_pad.push_list(list).inspect_err(|&err| {
|
||||||
gst::error!(
|
gst::error!(
|
||||||
RUNTIME_CAT,
|
RUNTIME_CAT,
|
||||||
obj = self.gst_pad,
|
obj = self.gst_pad,
|
||||||
"Failed to push BufferList to PadSrc: {:?}",
|
"Failed to push BufferList to PadSrc: {:?}",
|
||||||
err,
|
err,
|
||||||
);
|
);
|
||||||
err
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
gst::log!(
|
gst::log!(
|
||||||
|
|
|
@ -1139,16 +1139,14 @@ impl<Item: Send + 'static> StateMachine<Item> {
|
||||||
self.pending_triggering_evt = Some(triggering_evt);
|
self.pending_triggering_evt = Some(triggering_evt);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
try_next_res = try_next_fut => try_next_res.map_err(|err| {
|
try_next_res = try_next_fut => try_next_res.inspect_err(|&err| {
|
||||||
gst::debug!(RUNTIME_CAT, "TaskImpl::try_next returned {:?}", err);
|
gst::debug!(RUNTIME_CAT, "TaskImpl::try_next returned {:?}", err);
|
||||||
err
|
|
||||||
})?,
|
})?,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.task_impl.handle_item(item).await.map_err(|err| {
|
self.task_impl.handle_item(item).await.inspect_err(|&err| {
|
||||||
gst::debug!(RUNTIME_CAT, "TaskImpl::handle_item returned {:?}", err);
|
gst::debug!(RUNTIME_CAT, "TaskImpl::handle_item returned {:?}", err);
|
||||||
err
|
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,15 +438,13 @@ impl HlsBaseSink {
|
||||||
context.old_segment_locations.push(location.to_string());
|
context.old_segment_locations.push(location.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
self.write_playlist(context).map(|res| {
|
self.write_playlist(context).inspect(|_res| {
|
||||||
let s = gst::Structure::builder("hls-segment-added")
|
let s = gst::Structure::builder("hls-segment-added")
|
||||||
.field("location", location)
|
.field("location", location)
|
||||||
.field("running-time", running_time.unwrap())
|
.field("running-time", running_time.unwrap())
|
||||||
.field("duration", duration)
|
.field("duration", duration)
|
||||||
.build();
|
.build();
|
||||||
self.post_message(gst::message::Element::builder(s).src(&*self.obj()).build());
|
self.post_message(gst::message::Element::builder(s).src(&*self.obj()).build());
|
||||||
|
|
||||||
res
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1085,9 +1085,8 @@ impl RtspSrc {
|
||||||
return Err(RtspError::InvalidMessage("Can't PLAY, no SETUP").into());
|
return Err(RtspError::InvalidMessage("Can't PLAY, no SETUP").into());
|
||||||
};
|
};
|
||||||
self.post_start("request", "PLAY request sent");
|
self.post_start("request", "PLAY request sent");
|
||||||
let cseq = state.play(s).await.map_err(|err| {
|
let cseq = state.play(s).await.inspect_err(|_err| {
|
||||||
self.post_cancelled("request", "PLAY request cancelled");
|
self.post_cancelled("request", "PLAY request cancelled");
|
||||||
err
|
|
||||||
})?;
|
})?;
|
||||||
expected_response = Some((Method::Play, cseq));
|
expected_response = Some((Method::Play, cseq));
|
||||||
},
|
},
|
||||||
|
|
|
@ -274,11 +274,10 @@ impl JsonGstParse {
|
||||||
self.srcpad.push_event(event);
|
self.srcpad.push_event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.srcpad.push(buffer).map_err(|err| {
|
self.srcpad.push(buffer).inspect_err(|&err| {
|
||||||
if err != gst::FlowError::Flushing {
|
if err != gst::FlowError::Flushing {
|
||||||
gst::error!(CAT, imp = self, "Pushing buffer returned {:?}", err);
|
gst::error!(CAT, imp = self, "Pushing buffer returned {:?}", err);
|
||||||
}
|
}
|
||||||
err
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if send_eos {
|
if send_eos {
|
||||||
|
|
|
@ -768,15 +768,13 @@ impl ElementImpl for FallbackSrc {
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
self.parent_change_state(transition).map_err(|err| {
|
self.parent_change_state(transition).inspect_err(|_err| {
|
||||||
gst::error!(
|
gst::error!(
|
||||||
CAT,
|
CAT,
|
||||||
imp = self,
|
imp = self,
|
||||||
"Parent state change transition {:?} failed",
|
"Parent state change transition {:?} failed",
|
||||||
transition
|
transition
|
||||||
);
|
);
|
||||||
|
|
||||||
err
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// Change the source state manually here to be able to catch errors. State changes always
|
// Change the source state manually here to be able to catch errors. State changes always
|
||||||
|
|
|
@ -531,11 +531,10 @@ impl MccParse {
|
||||||
self.srcpad.push_event(event);
|
self.srcpad.push_event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.srcpad.push(buffer).map_err(|err| {
|
self.srcpad.push(buffer).inspect_err(|&err| {
|
||||||
if err != gst::FlowError::Flushing && err != gst::FlowError::Eos {
|
if err != gst::FlowError::Flushing && err != gst::FlowError::Eos {
|
||||||
gst::error!(CAT, imp = self, "Pushing buffer returned {:?}", err);
|
gst::error!(CAT, imp = self, "Pushing buffer returned {:?}", err);
|
||||||
}
|
}
|
||||||
err
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if send_eos {
|
if send_eos {
|
||||||
|
|
|
@ -291,18 +291,16 @@ impl MccParser {
|
||||||
|
|
||||||
match self.state {
|
match self.state {
|
||||||
State::Header => header(&mut line)
|
State::Header => header(&mut line)
|
||||||
.map(|v| {
|
.inspect(|_v| {
|
||||||
self.state = State::EmptyAfterHeader;
|
self.state = State::EmptyAfterHeader;
|
||||||
v
|
|
||||||
})
|
})
|
||||||
.map_err(|err| match err {
|
.map_err(|err| match err {
|
||||||
winnow::error::ErrMode::Incomplete(_) => unreachable!(),
|
winnow::error::ErrMode::Incomplete(_) => unreachable!(),
|
||||||
winnow::error::ErrMode::Backtrack(e) | winnow::error::ErrMode::Cut(e) => e,
|
winnow::error::ErrMode::Backtrack(e) | winnow::error::ErrMode::Cut(e) => e,
|
||||||
}),
|
}),
|
||||||
State::EmptyAfterHeader => empty_line(&mut line)
|
State::EmptyAfterHeader => empty_line(&mut line)
|
||||||
.map(|v| {
|
.inspect(|_v| {
|
||||||
self.state = State::Comments;
|
self.state = State::Comments;
|
||||||
v
|
|
||||||
})
|
})
|
||||||
.map_err(|err| match err {
|
.map_err(|err| match err {
|
||||||
winnow::error::ErrMode::Incomplete(_) => unreachable!(),
|
winnow::error::ErrMode::Incomplete(_) => unreachable!(),
|
||||||
|
@ -310,12 +308,10 @@ impl MccParser {
|
||||||
}),
|
}),
|
||||||
State::Comments => alt((empty_line, comment))
|
State::Comments => alt((empty_line, comment))
|
||||||
.parse_next(&mut line)
|
.parse_next(&mut line)
|
||||||
.map(|v| {
|
.inspect(|v| {
|
||||||
if v == MccLine::Empty {
|
if *v == MccLine::Empty {
|
||||||
self.state = State::Metadata;
|
self.state = State::Metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
v
|
|
||||||
})
|
})
|
||||||
.map_err(|err| match err {
|
.map_err(|err| match err {
|
||||||
winnow::error::ErrMode::Incomplete(_) => unreachable!(),
|
winnow::error::ErrMode::Incomplete(_) => unreachable!(),
|
||||||
|
@ -323,12 +319,10 @@ impl MccParser {
|
||||||
}),
|
}),
|
||||||
State::Metadata => alt((empty_line, uuid, time_code_rate, metadata))
|
State::Metadata => alt((empty_line, uuid, time_code_rate, metadata))
|
||||||
.parse_next(&mut line)
|
.parse_next(&mut line)
|
||||||
.map(|v| {
|
.inspect(|v| {
|
||||||
if v == MccLine::Empty {
|
if *v == MccLine::Empty {
|
||||||
self.state = State::Captions;
|
self.state = State::Captions;
|
||||||
}
|
}
|
||||||
|
|
||||||
v
|
|
||||||
})
|
})
|
||||||
.map_err(|err| match err {
|
.map_err(|err| match err {
|
||||||
winnow::error::ErrMode::Incomplete(_) => unreachable!(),
|
winnow::error::ErrMode::Incomplete(_) => unreachable!(),
|
||||||
|
|
|
@ -444,11 +444,10 @@ impl SccParse {
|
||||||
self.srcpad.push_event(event);
|
self.srcpad.push_event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.srcpad.push_list(buffers).map_err(|err| {
|
self.srcpad.push_list(buffers).inspect_err(|&err| {
|
||||||
if err != gst::FlowError::Flushing && err != gst::FlowError::Eos {
|
if err != gst::FlowError::Flushing && err != gst::FlowError::Eos {
|
||||||
gst::error!(CAT, imp = self, "Pushing buffer returned {:?}", err);
|
gst::error!(CAT, imp = self, "Pushing buffer returned {:?}", err);
|
||||||
}
|
}
|
||||||
err
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if send_eos {
|
if send_eos {
|
||||||
|
|
|
@ -137,18 +137,16 @@ impl SccParser {
|
||||||
|
|
||||||
match self.state {
|
match self.state {
|
||||||
State::Header => header(&mut line)
|
State::Header => header(&mut line)
|
||||||
.map(|v| {
|
.inspect(|_v| {
|
||||||
self.state = State::Empty;
|
self.state = State::Empty;
|
||||||
v
|
|
||||||
})
|
})
|
||||||
.map_err(|err| match err {
|
.map_err(|err| match err {
|
||||||
winnow::error::ErrMode::Incomplete(_) => unreachable!(),
|
winnow::error::ErrMode::Incomplete(_) => unreachable!(),
|
||||||
winnow::error::ErrMode::Backtrack(e) | winnow::error::ErrMode::Cut(e) => e,
|
winnow::error::ErrMode::Backtrack(e) | winnow::error::ErrMode::Cut(e) => e,
|
||||||
}),
|
}),
|
||||||
State::Empty => empty_line(&mut line)
|
State::Empty => empty_line(&mut line)
|
||||||
.map(|v| {
|
.inspect(|_v| {
|
||||||
self.state = State::CaptionOrEmpty;
|
self.state = State::CaptionOrEmpty;
|
||||||
v
|
|
||||||
})
|
})
|
||||||
.map_err(|err| match err {
|
.map_err(|err| match err {
|
||||||
winnow::error::ErrMode::Incomplete(_) => unreachable!(),
|
winnow::error::ErrMode::Incomplete(_) => unreachable!(),
|
||||||
|
|
|
@ -675,11 +675,11 @@ impl VideoSinkImpl for PaintableSink {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let frame =
|
let frame = Frame::new(buffer, info, orientation, wrapped_context.as_ref()).inspect_err(
|
||||||
Frame::new(buffer, info, orientation, wrapped_context.as_ref()).map_err(|err| {
|
|_err| {
|
||||||
gst::error!(CAT, imp = self, "Failed to map video frame");
|
gst::error!(CAT, imp = self, "Failed to map video frame");
|
||||||
err
|
},
|
||||||
})?;
|
)?;
|
||||||
self.pending_frame.lock().unwrap().replace(frame);
|
self.pending_frame.lock().unwrap().replace(frame);
|
||||||
|
|
||||||
let sender = self.sender.lock().unwrap();
|
let sender = self.sender.lock().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue