mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 21:11:00 +00:00
dav1ddec: Make sure to call get_picture()
twice in a row when draining
The first time might return `EAGAIN` if there are pending frames but there is no decoded frame available yet. The second time it will actually wait for frames to become available and only start returning `EAGAIN` again once no more frames are left. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1080>
This commit is contained in:
parent
0ed74d0aa4
commit
44405e0cd7
1 changed files with 15 additions and 3 deletions
|
@ -430,11 +430,23 @@ impl Dav1dDec {
|
|||
mut state_guard: MutexGuard<'s, Option<State>>,
|
||||
drain: bool,
|
||||
) -> Result<MutexGuard<Option<State>>, gst::FlowError> {
|
||||
while let Some(pic) = self.pending_picture(&mut state_guard)? {
|
||||
state_guard = self.handle_picture(state_guard, &pic)?;
|
||||
if !drain {
|
||||
// dav1d wants to have get_picture() called a second time after it return EAGAIN to
|
||||
// actually drain all pending pictures.
|
||||
let mut call_twice = drain;
|
||||
|
||||
loop {
|
||||
while let Some(pic) = self.pending_picture(&mut state_guard)? {
|
||||
state_guard = self.handle_picture(state_guard, &pic)?;
|
||||
call_twice = false;
|
||||
if !drain {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if !call_twice {
|
||||
break;
|
||||
}
|
||||
call_twice = false;
|
||||
}
|
||||
|
||||
Ok(state_guard)
|
||||
|
|
Loading…
Reference in a new issue