dav1ddec: Don't consider decoding errors as fatal

Instead use the `gst_video::video_decoder_error!` macro for allowing a
certain number of consecutive errors before actually failing.
This commit is contained in:
Sebastian Dröge 2022-02-02 13:39:54 +02:00 committed by Sebastian Dröge
parent c35d1cdc0c
commit 6e28a17280

View file

@ -147,12 +147,19 @@ impl Dav1dDec {
let input_data = input_buffer let input_data = input_buffer
.map_readable() .map_readable()
.map_err(|_| gst::FlowError::Error)?; .map_err(|_| gst::FlowError::Error)?;
let pictures = decoder let pictures = match decoder.decode(input_data, frame_number, timestamp, duration, || {}) {
.decode(input_data, frame_number, timestamp, duration, || {}) Ok(pictures) => pictures,
.map_err(|e| { Err(err) => {
gst_error!(CAT, "Decoding failed (error code: {})", e); gst_error!(CAT, "Decoding failed (error code: {})", err);
gst::FlowError::Error return gst_video::video_decoder_error!(
})?; element,
1,
gst::StreamError::Decode,
["Decoding failed (error code {})", err]
)
.map(|_| vec![]);
}
};
let mut decoded_pictures = vec![]; let mut decoded_pictures = vec![];
for pic in pictures { for pic in pictures {