refactor: carry moq-video decode timestamps as moq_net::Timestamp#2146
Merged
Conversation
There was a problem hiding this comment.
Sorry @kixelated, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
384a1d3 to
c477852
Compare
Contributor
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
c477852 to
5833d9e
Compare
The decode path carried presentation timestamps as a bare `u64` of microseconds, the one spot in the media pipeline not already using `moq_net::Timestamp` (the container frame is `timestamp: Timestamp` and `encode::Producer::publish` takes one too). Thread `Timestamp` through decode instead: `decode::Frame.timestamp`, `Decoder::decode`, the `pub(crate)` `Backend::decode` / `Decoded`, and all four backends (openh264 / videotoolbox / mediafoundation echo the input timestamp, nvdec threads it through the cuvid parser as before). This makes decode symmetric with encode and the container, and deletes three lossy `as_micros()` / `from_micros()` conversions: one in `decode::Consumer::read` and two in `moq-transcode`'s rung serving. libmoq's C ABI stays `moq_video_frame.timestamp_us: u64`; the adapter converts via `Timestamp::as_micros()`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
5833d9e to
d31e830
Compare
kixelated
added a commit
that referenced
this pull request
Jul 11, 2026
…refactor Rebase fallout from #2146: decode::Frame::resize preserves `timestamp` (the field `timestamp_us` no longer exists), and the shared feed passes container timestamps through as-is instead of converting to microseconds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
The
moq-videodecode path carried presentation timestamps as a bareu64of microseconds, the one spot in the media pipeline not already usingmoq_net::Timestamp— the container frame iscontainer::Frame.timestamp: Timestampandencode::Producer::publishtakes aTimestamptoo. This threadsTimestampthrough decode so it is symmetric with encode and the container.What changes
u64microseconds →moq_net::Timestampacross the decode surface:decode::Frame.timestamp,decode::Decoder::decode, and thepub(crate)Backend::decode/Decoded.Timestamp::as_micros()in,Timestamp::from_micros()out).Deletes three lossy conversions that only existed to bridge the
u64gap:decode::Consumer::readnow passesmux_frame.timestampstraight through (wasas_micros().try_into().map_err(TimeOverflow)).moq-transcode's rung serving drops anas_micros()on the way in and afrom_micros()on the way out; the decode→encode timestamps now flow asTimestampend to end.libmoq's C ABI is unchanged (moq_video_frame.timestamp_us: u64); the adapter converts viaframe.timestamp.as_micros().Public API change (moq-video)
decode::Frame.timestamp_us: u64→decode::Frame.timestamp: moq_net::Timestampdecode::Decoder::decode(payload, timestamp_us: u64, keyframe)→decode(payload, timestamp: moq_net::Timestamp, keyframe)Breaking reshapes of
pubitems, but moq-video/moq-transcode are unreleased (dev-only,0.0.x) with no published contract, so this lands ondev. No wire-protocol or C-ABI change.Test plan
cargo build/test -p moq-video; decode round-trip tests pass (VideoToolbox H.264 + H.265, openh264), now also asserting the timestamp round-trips through the codec and returns strictly increasing.moq-transcodebuilds;clippyclean (moq-video--all-targets, moq-transcode--lib);rustdoc -D warningsclean;cargo fmtapplied.cargo zigbuild --target x86_64-pc-windows-gnu.libmoq— both are un-buildable on macOS on this branch independent of this change (a pre-existing dev feature/target quirk), so CI is the check for them.🤖 Generated with Claude Code
(Written by Claude Opus 4.8)