Repository navigation
fix(android): put out a GOP that goes back in time after the one before it - #6
Merged
Merged
Conversation
…re it A key frame earlier than a chunk before it, without a flush, now drains the codec (end of stream, every picture delivered, codec flush) before it is queued, as iOS does. The emulator's c2.goldfish.h264.decoder otherwise held the previous GOP's last frames until the end of the stream and put out the earlier GOP in decoding order; the pictures matched their timestamps, only the order was wrong. A frame's duration is no longer dropped along with every earlier timestamp's when it is delivered: those may be a GOP queued to go back in time. The test is strict on Android too, and checks each frame's picture (a 16x16 luma grid through WebGPU) against the GOPs decoded on their own, and that every frame has a duration.
- VideoDecoder: write a chunk's duration on the input thread, after any drain for a GOP that goes back in time, instead of on the JS thread. takeDuration() can then drop every entry up to the picture put out again, so durations of frames never put out no longer pile up until the next flush. - VideoDecoder: drop the `_queuedSinceFlush > 0` term of the back-in-time check; `_latestQueued` is INT64_MIN whenever nothing was queued. - test: in decodeRuns' output callback, return early without grids before checking the duration, instead of testing `ctx.grids` twice.
|
🎉 This PR is included in version 0.1.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
These two commits were reviewed in #5, but #5 was merged into
fix/ios-top-itemsafter that branch had already been merged into main (#4), so they never reached main. This PR brings them over unchanged.On Android, a key frame earlier than the chunks before it, decoded without a flush, came out in the wrong order. The emulator's
c2.goldfish.h264.decoderheld the later GOP's last frames until the end of the stream, and put out the earlier GOP in decoding order. The pictures matched their timestamps; only the order was wrong.Fix (
android/src/main/cpp/VideoDecoder.hpp)Test
"outputs a GOP that goes back in time after the one before it" is now strict on Android too, as it already is on iOS. It checks each frame's picture against the GOPs decoded on their own, using a 16x16 luma grid read through WebGPU. It also checks that every frame has a duration.
Refs #5