-
Notifications
You must be signed in to change notification settings - Fork 105
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
Fix AV1/VP9 (and send/receive API use in general) #428
Conversation
Looks reasonable, will try on some random av1 files later |
int Ret = avcodec_send_packet(CodecContext, Packet); | ||
if (Ret == AVERROR(EAGAIN)) { | ||
// Send queue is full, so stash packet to resend on the next call. | ||
DelayCounter--; |
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.
If we can delay more than once, shouldn't the stashed packet be a stash queue?
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.
No, since we don't read another packet until the stashed one is successfully sent.
Anything I can do to help move this along? I'm looking at getting a new Aegisub stable out but I'd like to have proper VP9/AV1 support, and don't want to build against a fork. |
Mostly it is a function of my time (of which I have little at the moment...) - the current PR seems to have issues, which I need to debug. |
How about using libvpx to decode vp9? It seems more multi-thread capable than native one (but maybe slightly slower in single-thread) and with support of alpha channel in addition. It seems not suffer form #352. Let me list in detail:
All above are built with msys2 mingw-w64 (as used by media-autobuild_suite), decoded data from all "good" results are exactly the same |
I encountered this error opening files with video+audio with several combination of codecs after this PR. But not all file of problematic combination will cause error, for example vp9+opus produced by ffmpeg fails but some files downloaded from YouTube don't. |
@L4cache I am revisiting this PR currently, can you provide an example file? |
https://transfer.sh/85oyj7LBrm/sample.zip I forgot to mention, the way I apply this pr is https://github.com/L4cache/ffms2/tree/test-3 |
@L4cache Thanks, I was able to reproduce the issue using your sample. I will look into it. |
This has been possible since FFmpeg/FFmpeg@1b05d27. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
If we get AVERROR(EAGAIN) while trying to send a packet, we are supposed to try resending it after receiving some more. Same for receiving, but the other way around. Very pleasant API to use. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
@L4cache I found the bug. I have updated the PR. |
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Merged, let the testing begin! Note thay CI failed for unrelated reasons. Tests pass locally, aside from HDR metadata which is being fixed upstream in FFmpeg right now. |
This PR does two things:
AVERROR(EAGAIN)
fromavcodec_send_packet
by stashing the packet to send again on the next call, and fromavcodec_receive_frame
by increasing the delay counter.Since this makes changes to the core decode loop(s), it needs some good testing before merging. Particularily to confiirm AV1 and VP9 are, in fact, fixed (seeking, and linear).
Should (probably) fix #319, and makes #323 obsolete, I think. May or may not fix #352.
CC: @tdaede @jamrial @wangqr