-
Notifications
You must be signed in to change notification settings - Fork 85
Support for VP9 decoding with Apple's VideoToolbox #1830
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
Conversation
| unsigned char* fPlanes[4]; | ||
| Format fFormat; | ||
| void* fContext; | ||
| }; |
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.
Tried to be sensitive here in since I know this code is already earmarked for a refactor. Basic abstraction to keep plMoviePlayer away for decoder specifics.
| // that would prepend the track in an MP4 container | ||
|
|
||
| // The full box container as specified by | ||
| // ISO/IEC 14496-12 |
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.
This ISO doc is paywall so I can't link to it. However WebKit implements the atom that needs to be passed to the decoder in the same way with the same structure. The WebM documentation is public and assumes you know what a "full box" is.
|
Two things: I am extremely rarely hitting this during the intro movie:
This is odd because this is the layer between libwebm and libvpx - which I didn't touch. The Mac Pro I'm testing this on doesn't activate the VideoToolbox path either (hardware isn't compatible.) I'm checking into it. Address Sanitizer is not finding any memory corruption issues. |
|
The crash may be unrelated - it seems to happen when I spam input just as the movie is starting. Clicking on the window just right before the intro movie plays seems to do it. I'll continue investigating before asking this PR to be merged just in case... |
|
A while ago I encountered a different crash when spamming Esc to skip the intro (fixed in #1718). That was in a completely different part of the code than your assertion failure, so I assume the two aren't related, but perhaps |
|
It's not clear to me. I can see the decoder provides a compressed frame that is under 100 bytes which seems... small. Although maybe the first frame fits. Nothing in the path seems input triggered to me right now. It's the normal decode loop. Trying to see how input could influence things... |
|
I fixed the issue - it was introduced by this branch. The problem was here: If multiple frames were processed by the loop (because the computer was slow or I was spamming input making things slow) decode would fail because This has been fixed in the latest commit. |
Hoikas
left a comment
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.
Just two very minor things left, I think.
796e706 to
f0de5f6
Compare
|
I added a check to the VT path as well. That one is a bit different because I specifically request the output format. It might automatically transcode to the right format - but otherwise I added a check for a null output. Repeating the offer from chat to squash this down so no one has to bisect through all these changes. |
f0de5f6 to
45e6c5f
Compare
This PR adds VideoToolbox support alongside the exist libwebm support. It can optionally replace the libvpx decoder. This decoder is only available on Apple devices that feature hardware decoding support - Apple does not include a software decoder and this code will fallback to libvpx in that case. Apple has not provided hardware decoding drivers for all hardware that could support it - this functionality seems mostly limited to Apple Silicon devices.
For other platforms like iOS and visionOS where hardware decode support is guaranteed - this turns libvpx into an optional dependency. This is especially helpful for visionOS where there are no working builds of libvpx.