video: Add support for NV12 pixel format - #24335
Open
X1nto wants to merge 2 commits into
Open
Conversation
VideoFrames handed to the output callback hold on to the decoder's output buffer, which is only returned to the pool once the frame is closed. Stalled frames, if not closed, block subsequent frames from processing, causing videos to freeze. Closing the VideoFrame frees up the pool and lets the decoder properly skip frames that take too much time to decode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Previously, the NV12 pixel format was unsupported, logging
Unsupported pixel format: Nv12to the console. This adds support for decoding videos with NV12 pixel format in webcodecs.This PR also fixes video freezes. I'm not entirely sure if I should include this fix here, but without it I couldn't even test my changes properly. Looking into the console I found ruffle was spamming these:
decoding video frame XXX failed: No output frame produced by the decoder. As far as I noticed, when one frame failed to decode in time, instead of skipping over that frame, the decoder waited until it finished decoding and only then continued decoding subsequent frames. This caused the frames to accumulate and stall, causing videos to freeze.Testing
I couldn't find a way to write tests for this, as there are no reference tests for other pixel formats. One of the suggestions was to create an HTML wrapping Flash and let Ruffle polyfill it, but tests require GPU acceleration to be disabled and NV12 doesn't work without GPU acceleration.
Here's an NV12 encoded video, extracted from one of the games I was testing, which inspired me to make this PR: pitkEqim.flv.
I'm not familiar with ActionScript, but I can probably whip up a test script that loads the video attached above to help test this. Please let me know.
Checklist