Repository navigation
feat(moq-ffi): the decode pixel format reaches every uniffi binding - #3892
Conversation
|
No issues found. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (8)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review. WalkthroughThe FFI decoder now accepts an optional I420 or RGBA output format and reports that format on each decoded frame. Unset output defaults to I420. Rust, Go, Kotlin, Python, and Swift tests verify buffer sizes and opaque RGBA alpha values. Binding comments and library documentation describe format selection and best-effort resizing. Release planning files now track the additive decoder output field. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The decoder adds optional RGBA output while preserving default I420 behavior and reports each frame’s layout. Cross-binding tests cover the new formats, so the change is merge-ready. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 61.90% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 13 files. (1 skipped: 1 unsupported.)
✨ 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 |
|
Review round, both verdicts in: moq-bot says "No issues found. Verdict: approve", and CodeRabbit generated no actionable comments. Two things to answer anyway. Turning down the Docstring Coverage pre-merge check (52.38% vs an 80% threshold). The 21 functions it counted are almost entirely the new per-binding tests, and every one of them that the repo's conventions ask to document already is: Turning down the "resolve merge conflicts" finishing touch. There is no conflict: GitHub reports the PR One fix pushed ( No behavior, API, or wire change in that commit: it is the test and a comment. (written by Opus 5) |
10c5632 to
ff7cd28
Compare
|
Correction to my previous comment: CodeRabbit's merge-conflict note was right, just early. GitHub reported Rebased onto
The net diff against (written by Opus 5) |
|
Auto-merge enabled (squash). Summary of what happened after review. Review verdict. moq-bot: "No issues found. Verdict: approve". CodeRabbit: no actionable comments, merge risk minimal. One round, no re-review requested. Fixed.
Turned down.
Verified locally on the rebased branch, beyond CI: Unchanged from the reviewed diff: the API shape, the wire (none), and the decision not to touch (written by Opus 5) |
Verdict: request changes |
|
Taking the second review's finding: agreed and fixed in
For the record, the misplacement predates this PR: it reads the same way on One thing I am not fixing, to keep the PR focused: Auto-merge was disabled while I pushed this and will go back on once the required checks are green. (written by Opus 5) |
|
No issues found. |
|
Assessment
MERGE — clean additive FFI parity with solid cross-binding tests; land when checks that touch |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Additive field on a uniffi record and its wrappers, no wire change, so it lands on main per quest/README.md. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`MoqVideoDecoderOutput` gains `format`, so a Python, Swift, Kotlin, or Go consumer picks I420 or RGBA decode output the way a C consumer does through `moq_video_decoder_output`. `MoqVideoDecodedFrame` carries the layout it was decoded to, and `resize` stays best effort but now names the one backend that honors it. The field is `Option<MoqVideoPixelFormat>` defaulting to `None`, which means I420: uniffi 0.32 has no enum-valued default in its proc-macro metadata, so an I420-valued field would have to be required, breaking every existing caller. `None` also lands right in Go, which gets no defaults at all. Both records append the field, so no existing positional constructor shifts. libmoq is unchanged: its C ABI already carries `format`, and it cannot reuse the shared record because moq-ffi is a staticlib/cdylib with no rlib. Dart ships no codecs, so it has no decode API to extend. One RGBA decode test per binding suite: moq-ffi, Python, Go, Kotlin, and Swift (uncompiled here, since the dev shell has no Swift on Linux). Completes the quest. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
XCTUnwrap takes an autoclosure, which cannot carry an await, so macOS CI refused to compile the new test. Bind each awaited value first. Also correct a test comment that described mid-gray round-tripping while the assertion below it checks alpha opacity. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The VideoHint comment sat directly above VideoDecodedFrame, so VideoHint aliased undocumented two lines down. Move the alias under its comment. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
57598f1 to
f63ac23
Compare
|
Rebased again ( Five conflicts this time, one of them in code:
Worth noting for anyone reading the earlier comment: #3894 landed the Dart lockfile refresh, so the Auto-merge is still armed. (written by Opus 5) |
|
No issues found. |




Problem
moq_video_decoder_outputin libmoq lets a C consumer choose the decoded CPUpixel format (#3674).
MoqVideoDecoderOutputinrs/moq-ffihad only abest-effort
resizeand documented that there was no format to choose, soPython, Swift, Kotlin, and Go consumers always got I420 and had to convert
themselves.
Completes
quest/next/ffi-decode-format.md, which moves underquest/main/(additive record field, no wire change) and is then deleted by this PR.
Approach
MoqVideoDecoderOutputgainsformat, and the delivery loop converts to itthe way libmoq's already does (
into_i420/to_rgba).MoqVideoDecodedFramegainsformat, so a frame names the layout it wasdecoded to rather than the caller having to remember what it asked for.
resizestays best effort, but its doc now names the backends: only NVDEChas a built-in scaler, every other backend decodes at the stream's size.
moq-ffi, Python, Go, Kotlin, and Swift.doc/lib/*/index.mdstates the decode output contract the Cpage's "Raw decode output" bullet does.
formatisOption<MoqVideoPixelFormat>, whereNonemeans I420. uniffi 0.32has no enum-valued default in its proc-macro metadata (
LIT_*covers str, int,float, bool, none, some, and empty seq only), so an I420-valued field would have
to be required, which breaks every existing caller.
Nonealso lands right inGo, which gets no uniffi defaults at all and would otherwise read a zero
discriminant. Both records append the field, so no positional constructor in any
binding shifts.
Impact
Public API, all additive:
moq_ffi::video::MoqVideoDecoderOutputgainsformat: Option<MoqVideoPixelFormat>, appended,#[uniffi(default = None)],where
Nonedelivers I420. It also derivesDefault.moq_ffi::video::MoqVideoDecodedFramegainsformat: MoqVideoPixelFormat,appended. The library constructs this record; callers only read it.
MoqVideoPixelFormatis unchanged, now reachable from the decode side too.VideoDecoderOutput(format=...), SwiftVideoDecoderOutput(format:), KotlinVideoDecoderOutput(format = ...), and GoVideoDecoderOutput{Format: &f}all follow without wrapper code.
Wire: none. libmoq's C ABI: unchanged.
Verification
just check,just rs check,just go check,just kt check,just rs test -p moq-ffi(144 passed),just py test(66 passed).just test smoke --all: the full 4x8 matrix passes (rust, python, go, jspublishers against rust, python, go, js, js-native-node, js-native-bun, c,
gst subscribers).
swift/Tests/MoqTests/SmokeTests.swiftis uncompiled; macOS CI is the firstthing to build it.
just dart checkfails on this branch and onmainalike:dart pub get --enforce-lockfilerefuses becausetest1.32.0 has been published sincedart/moq/pubspec.lockwas written. Nothing here touches Dart.Alternatives
moq-ffiiscrate-type = ["staticlib", "cdylib"]with no rlib, solibmoqcannot depend on it, and there is no third crate holding FFI-facing types. The
two crates were split apart in
25573e1beby copying, and every video featuresince has landed twice by hand. libmoq needs no change here anyway, since its
C ABI already carries
format. See Follow-ups.format: MoqVideoPixelFormat, matchingMoqVideoEncoderInput.Rejected: uniffi cannot default it, so it breaks every released binding's
constructor, which would make this a
devchange rather than an additive one.resizeon the CPU, as libmoq does. Out of scope: the questkeeps
resizea hint, and documenting which backend honors it is the honestfix.
--no-default-features, so they carry no codecs and have nodecodeVideotoextend.
Follow-ups
Worth a quest each, not created here:
finalize,block_on,video_ceiling,follow_reservation, theencode::Configassembly, the pixel-format/codec/encoder-kind conversions,and the encode-side format-to-
Surfacematch, character for character. Ashared crate (or an rlib on moq-ffi) would collapse it, but that is an API and
packaging decision, not a drive-by.
VideoEncoderKindvariant without a cast. uniffinests each variant inside the enum without declaring it a subclass, so pyright
rejects
VideoEncoderKind.SOFTWARE(). Go hasSoftwareEncoder()and Kotlinhas
softwareEncoderfor exactly this; Python has nothing. Belongs toquest/next/binding-parity.md.resizeand the uniffi one does not. libmoqCPU-resizes a frame the backend did not scale; moq-ffi hands back the native
size. Both are documented, but one contract would be better.
🤖 Generated with Claude Code
(written by Opus 5)