mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-09 10:45:27 +00:00
dav1d: Get rid of some unnecessary unwrap()
s
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1055>
This commit is contained in:
parent
f62d07633d
commit
037294b077
1 changed files with 11 additions and 11 deletions
|
@ -164,7 +164,7 @@ impl Dav1dDec {
|
||||||
let out_state = instance.output_state().unwrap();
|
let out_state = instance.output_state().unwrap();
|
||||||
|
|
||||||
state_guard = self.state.lock().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());
|
state.output_info = Some(out_state.info());
|
||||||
|
|
||||||
Ok(state_guard)
|
Ok(state_guard)
|
||||||
|
@ -189,7 +189,7 @@ impl Dav1dDec {
|
||||||
frame.system_frame_number()
|
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 timestamp = frame.dts().map(|ts| *ts as i64);
|
||||||
let duration = frame.duration().map(|d| *d as i64);
|
let duration = frame.duration().map(|d| *d as i64);
|
||||||
|
@ -232,7 +232,7 @@ impl Dav1dDec {
|
||||||
) -> Result<std::ops::ControlFlow<(), ()>, gst::FlowError> {
|
) -> Result<std::ops::ControlFlow<(), ()>, gst::FlowError> {
|
||||||
gst::trace!(CAT, imp: self, "Sending pending data to decoder");
|
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() {
|
match state.decoder.send_pending_data() {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
|
@ -266,7 +266,7 @@ impl Dav1dDec {
|
||||||
let mut strides = vec![];
|
let mut strides = vec![];
|
||||||
let mut acc_offset: usize = 0;
|
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 video_meta_supported = state.video_meta_supported;
|
||||||
|
|
||||||
let info = output_state.info();
|
let info = output_state.info();
|
||||||
|
@ -385,7 +385,7 @@ impl Dav1dDec {
|
||||||
) -> Result<Option<dav1d::Picture>, gst::FlowError> {
|
) -> Result<Option<dav1d::Picture>, gst::FlowError> {
|
||||||
gst::trace!(CAT, imp: self, "Retrieving pending picture");
|
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() {
|
match state.decoder.get_picture() {
|
||||||
Ok(pic) => {
|
Ok(pic) => {
|
||||||
|
@ -728,8 +728,7 @@ impl VideoDecoderImpl for Dav1dDec {
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut state_guard = self.state.lock().unwrap();
|
let mut state_guard = self.state.lock().unwrap();
|
||||||
if state_guard.is_some() {
|
if let Some(state) = &mut *state_guard {
|
||||||
let state = state_guard.as_mut().unwrap();
|
|
||||||
self.flush_decoder(state);
|
self.flush_decoder(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -769,10 +768,11 @@ impl VideoDecoderImpl for Dav1dDec {
|
||||||
) -> Result<(), gst::LoggableError> {
|
) -> Result<(), gst::LoggableError> {
|
||||||
{
|
{
|
||||||
let mut state_guard = self.state.lock().unwrap();
|
let mut state_guard = self.state.lock().unwrap();
|
||||||
let state = state_guard.as_mut().unwrap();
|
if let Some(state) = &mut *state_guard {
|
||||||
state.video_meta_supported = query
|
state.video_meta_supported = query
|
||||||
.find_allocation_meta::<gst_video::VideoMeta>()
|
.find_allocation_meta::<gst_video::VideoMeta>()
|
||||||
.is_some();
|
.is_some();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.parent_decide_allocation(query)
|
self.parent_decide_allocation(query)
|
||||||
|
|
Loading…
Reference in a new issue