Skip to content
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

Error handling #157

Open
swagggpickle opened this issue Nov 9, 2022 · 3 comments
Open

Error handling #157

swagggpickle opened this issue Nov 9, 2022 · 3 comments

Comments

@swagggpickle
Copy link

Hello,
I just started to use this package and I stumbled across some interesting behavior, I noticed that whenever a syscall.EAGAIN is received no error is returned and potentially a nil value is also returned. Example 1 Example 2

Typically in Go you would propagate an error like this to allow the application layer to be able to change behavior.

Is there a particular reason for not propagating the error?

@3d0c
Copy link
Owner

3d0c commented Nov 11, 2022

Here is a comment from decode.h of libavcodec

/**
 * Called by decoders to get the next packet for decoding.
 *
 * @param pkt An empty packet to be filled with data.
 * @return 0 if a new reference has been successfully written to pkt
 *         AVERROR(EAGAIN) if no data is currently available
 *         AVERROR_EOF if and end of stream has been reached, so no more data
 *                     will be available
 */

This is why.

@swagggpickle
Copy link
Author

Yes I understand the comment. The issue I am having is these two errors are being masked/not returned or propagated. If the error EAGAIN, error i am receiving, is received my application code should retry again but since I never received the error I have no way of making a smart application level decision. I would happily make a PR to allow for these values to be propagated if you agree they should be.

@3d0c
Copy link
Owner

3d0c commented Nov 12, 2022

Feel free to contribute, would be great to have another one Decode function, let's name it Decode2 for backward compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants