Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2023-01-22 01:32:52 +0300
committerSebastian Dröge <sebastian@centricular.com>2023-01-22 01:59:54 +0300
commit407a367529f49da112f52e7c654d765bdaee8e22 (patch)
tree0f9f1feae94a40a86140a4516d6d19fd054cbacb /video/dav1d
parent88a437ac3219b516d8d68978d1efcd34e046ef96 (diff)
dav1d: Get rid of some unnecessary `unwrap()`s
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1056>
Diffstat (limited to 'video/dav1d')
-rw-r--r--video/dav1d/src/dav1ddec/imp.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/video/dav1d/src/dav1ddec/imp.rs b/video/dav1d/src/dav1ddec/imp.rs
index 1a057638f..9bd942228 100644
--- a/video/dav1d/src/dav1ddec/imp.rs
+++ b/video/dav1d/src/dav1ddec/imp.rs
@@ -164,7 +164,7 @@ impl Dav1dDec {
let out_state = instance.output_state().unwrap();
state_guard = self.state.lock().unwrap();
- let state = state_guard.as_mut().unwrap();
+ let state = state_guard.as_mut().ok_or(gst::FlowError::Flushing)?;
state.output_info = Some(out_state.info());
Ok(state_guard)
@@ -189,7 +189,7 @@ impl Dav1dDec {
frame.system_frame_number()
);
- let state = state_guard.as_mut().unwrap();
+ let state = state_guard.as_mut().ok_or(gst::FlowError::Flushing)?;
let timestamp = frame.dts().map(|ts| *ts as i64);
let duration = frame.duration().map(|d| *d as i64);
@@ -232,7 +232,7 @@ impl Dav1dDec {
) -> Result<std::ops::ControlFlow<(), ()>, gst::FlowError> {
gst::trace!(CAT, imp: self, "Sending pending data to decoder");
- let state = state_guard.as_mut().unwrap();
+ let state = state_guard.as_mut().ok_or(gst::FlowError::Flushing)?;
match state.decoder.send_pending_data() {
Ok(()) => {
@@ -266,7 +266,7 @@ impl Dav1dDec {
let mut strides = vec![];
let mut acc_offset: usize = 0;
- let state = state_guard.as_mut().unwrap();
+ let state = state_guard.as_mut().ok_or(gst::FlowError::Flushing)?;
let video_meta_supported = state.video_meta_supported;
let info = output_state.info();
@@ -385,7 +385,7 @@ impl Dav1dDec {
) -> Result<Option<dav1d::Picture>, gst::FlowError> {
gst::trace!(CAT, imp: self, "Retrieving pending picture");
- let state = state_guard.as_mut().unwrap();
+ let state = state_guard.as_mut().ok_or(gst::FlowError::Flushing)?;
match state.decoder.get_picture() {
Ok(pic) => {
@@ -728,8 +728,7 @@ impl VideoDecoderImpl for Dav1dDec {
{
let mut state_guard = self.state.lock().unwrap();
- if state_guard.is_some() {
- let state = state_guard.as_mut().unwrap();
+ if let Some(state) = &mut *state_guard {
self.flush_decoder(state);
}
}
@@ -769,10 +768,11 @@ impl VideoDecoderImpl for Dav1dDec {
) -> Result<(), gst::LoggableError> {
{
let mut state_guard = self.state.lock().unwrap();
- let state = state_guard.as_mut().unwrap();
- state.video_meta_supported = query
- .find_allocation_meta::<gst_video::VideoMeta>()
- .is_some();
+ if let Some(state) = &mut *state_guard {
+ state.video_meta_supported = query
+ .find_allocation_meta::<gst_video::VideoMeta>()
+ .is_some();
+ }
}
self.parent_decide_allocation(query)