dav1d: Don't treat any kind of bitstream error immediately as fatal

Instead use the videodecoder error handling to allow up to max-errors
consecutive decoding errors, i.e. infinite by default in 1.22 and newer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1057>
This commit is contained in:
Sebastian Dröge 2023-01-23 10:46:38 +02:00
parent 2c386fb792
commit e0e63dd4da

View file

@ -208,10 +208,20 @@ impl Dav1dDec {
gst::trace!(CAT, imp: self, "Decoder returned OK"); gst::trace!(CAT, imp: self, "Decoder returned OK");
Ok(std::ops::ControlFlow::Break(())) Ok(std::ops::ControlFlow::Break(()))
} }
Err(err) if err.is_again() => { Err(dav1d::Error::Again) => {
gst::trace!(CAT, imp: self, "Decoder returned EAGAIN"); gst::trace!(CAT, imp: self, "Decoder returned EAGAIN");
Ok(std::ops::ControlFlow::Continue(())) Ok(std::ops::ControlFlow::Continue(()))
} }
Err(dav1d::Error::InvalidArgument) => {
gst::trace!(CAT, imp: self, "Decoder returned EINVAL");
gst_video::video_decoder_error!(
&*self.obj(),
1,
gst::LibraryError::Encode,
["Bitstream error"]
)?;
Ok(std::ops::ControlFlow::Continue(()))
}
Err(err) => { Err(err) => {
gst::error!(CAT, "Sending data failed (error code: {})", err); gst::error!(CAT, "Sending data failed (error code: {})", err);
self.obj().release_frame(frame); self.obj().release_frame(frame);