-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a loop to drain buffered frames in the decoder #2002
Add a loop to drain buffered frames in the decoder #2002
Conversation
8b8f40d
to
ed3e115
Compare
if (res < 0) { | ||
if (res != DAV1D_ERR(EAGAIN)) { | ||
if (gotPicture) { | ||
dav1d_picture_unref(&nextFrame); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code snippet in the documentation of dav1d_get_picture()
is a bit vague so I quickly checked its implementation. It should be fine not to call dav1d_picture_unref(&bufferedFrame);
here. It is also unlikely that the dav1d API changes in a way it becomes necessary. On the other hand, calling dav1d_picture_unref(&bufferedFrame);
here would not hurt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for looking into this. It is a common API design that a function outputs nothing on failure. This is why I don't call dav1d_picture_unref(&bufferedFrame)
if res
is negative. Because of your comment, I checked the documentation. I think we can conclude from the following that a frame is output only when res
is 0:
* @param out Output frame. The caller assumes ownership of the returned
* reference.
*
* @return
* 0: Success, and a frame is returned.
* DAV1D_ERR(EAGAIN): Not enough data to output a frame. dav1d_send_data()
* should be called with new input.
* Other negative DAV1D_ERR codes: Error during decoding or because of invalid
* passed-in arguments.
I confirm this fixes the original bug. |
If we use a single decoder instance to decode all tiles in an image grid, it is important to endure there are no buffered frames in the decoder before decoding the next tile with the decoder. BUG=oss-fuzz:66313
ed3e115
to
c2ae4ca
Compare
If we use a single decoder instance to decode all tiles in an image grid, it is important to endure there are no buffered frames in the decoder before decoding the next tile with the decoder.
BUG=oss-fuzz:66313