-
Notifications
You must be signed in to change notification settings - Fork 393
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 playback issues with some h264 videos on native & Safari #8850
base: main
Are you sure you want to change the base?
Conversation
Web viewer built successfully. If applicable, you should also test it:
Note: This comment is updated whenever you push a commit. |
b830460
to
c6670ba
Compare
// (potentially related to:) TODO(#7327, #7595): We don't necessarily have to enqueue full GOPs always. | ||
// In particularly beyond `requested_gop_idx` this can be overkill. |
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 is a pre-existing issue, it just wasn't referenced here before
// By resetting the current GOP/sample indices, the frame enqueued code below | ||
// is forced to reset the decoder. | ||
self.current_gop_idx = usize::MAX; | ||
self.current_sample_idx = usize::MAX; | ||
self.last_requested_gop_idx = usize::MAX; |
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 is a bit wonky imho - why not just self.reset
directly. A: This would lead to a double reset.
In the interest of keeping the changes here more minimal I'm not touching this piece
Related
ffmpeg-cli
& SafariWebCodec
decoder requires additional frames enqueued for some videos in order to produce frames + spurious errors #8848What
Works around the issue outlined in #8848
In a nutshell: For certain videos we would only ever receive frames that are 16 frames behind of what we enqueued, completely disregarding the fact that we always enqueue full GOPs (I repeatedly confirmed that this is the case with different tools). This affects only h264 on the ffmpeg-cli & WebCodec @ Safari decoders. The exact circumstances that make some videos require this and other not are unknown at this point.
This is "solved" here by making our frame enqueing process more flexible and allowing decoder implementations to specify a "minimum look ahead" number of frames.
Note that oftentimes we still enqueue much more frames regardless: We still want to enqueue the entire current & next GOP for smooth transitions. Typically two h264 GOPs encompass a lot more frames than requested here (citation needed). However, the tested problematic videos operate with GOPs that contain only two frames (single I & P frame) so there this actually makes a difference.
Testing: Beyond the actual video, I tested various samples form our internal library of "curious videos to test" to ensure that the adjusted enqueuing logic doesn't regress anything. (personally, I think it's actually much nicer independent of the workaround :))