From 53dc5f86998ee150a233027d82f7ea698e1767db Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 4 Sep 2026 18:51:21 -0700 Subject: [PATCH 1/2] fix(moq-video): compile the V4L2 encoder against the Rate bitrate `resolved_bitrate()` returns `moq_net::bandwidth::Rate` on dev, but the V4L2 encoder was written on main against the older `u64` and merged in by 175b477a0 without being recompiled. Every other backend already calls `.as_bps()`; v4l2 passed the `Rate` straight to `set_bitrate` and called `div_ceil` on it, and its `the_level_clears_the_bitrate` test assigned a bare integer to `Config::bitrate`. `moq-video` therefore does not compile on dev, which fails `just check` for any branch whose changed-file scope selects it. That is why a moq-net change such as #3419 goes red while a moq-sock or moq-relay one does not. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01DLtoPv9B3779kGxLFTUGHR --- rs/moq-video/src/encode/backend/v4l2.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rs/moq-video/src/encode/backend/v4l2.rs b/rs/moq-video/src/encode/backend/v4l2.rs index 13326068d8c..a63b85106b9 100644 --- a/rs/moq-video/src/encode/backend/v4l2.rs +++ b/rs/moq-video/src/encode/backend/v4l2.rs @@ -145,7 +145,7 @@ impl V4l2 { )?; device.set_control(V4L2_CID_MPEG_VIDEO_H264_LEVEL, h264_level(config)?)?; device.set_control(V4L2_CID_MPEG_VIDEO_GOP_SIZE, config.gop as i32)?; - set_bitrate(&device, config.resolved_bitrate())?; + set_bitrate(&device, config.resolved_bitrate().as_bps())?; // Constant rate is what a live uplink wants: the congestion controller // already owns the rate, and a variable-rate encoder would spend it on the // wrong frames. @@ -829,7 +829,7 @@ fn h264_level(config: &Config) -> Result { let size = config.size(); let per_frame = size.width.div_ceil(16) * size.height.div_ceil(16); let per_second = per_frame as u64 * config.framerate as u64; - let kbps = config.resolved_bitrate().div_ceil(1_000); + let kbps = config.resolved_bitrate().as_bps().div_ceil(1_000); LEVELS .iter() .find(|level| { @@ -916,9 +916,9 @@ mod tests { #[test] fn the_level_clears_the_bitrate() { let mut config = config(1280, 720, 30); - config.bitrate = Some(14_000_000); + config.bitrate = Some(moq_net::bandwidth::Rate::from_bps(14_000_000)); assert_eq!(h264_level(&config).unwrap(), 9); // 3.1 - config.bitrate = Some(14_000_001); + config.bitrate = Some(moq_net::bandwidth::Rate::from_bps(14_000_001)); assert_eq!(h264_level(&config).unwrap(), 10); // 3.2 } From 07f051bc53c17927614a6ae621ef05787ba84c13 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 4 Sep 2026 19:22:24 -0700 Subject: [PATCH 2/2] fix(moq-video): compile out into_parts instead of silencing it `DmaBufExport::inner` carries `expect(dead_code)` without `render`, but `into_parts` was only lint-suppressed, not compiled out. The function therefore still existed and still read `inner`, which kept the field live and made the field's own expectation unfulfilled. `-D warnings` promotes `unfulfilled_lint_expectations` to an error, so moq-video failed to compile for any crate selecting dmabuf without render, moq-ffi and libmoq included. `render/dmabuf.rs` is the only caller, so gate the function on `render`. The field is then genuinely dead without it and its expectation holds. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01DLtoPv9B3779kGxLFTUGHR --- rs/moq-video/src/frame.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rs/moq-video/src/frame.rs b/rs/moq-video/src/frame.rs index 3f84e94666e..4771f79ff60 100644 --- a/rs/moq-video/src/frame.rs +++ b/rs/moq-video/src/frame.rs @@ -216,7 +216,7 @@ impl DmaBufExport { /// Split the descriptor from the lease that keeps the producer's buffer alive, /// for a consumer that has to own the two separately. Only the renderer does. - #[cfg_attr(not(feature = "render"), expect(dead_code))] + #[cfg(feature = "render")] pub(crate) fn into_parts(self) -> (OwnedFd, Arc) { (self.fd, self.inner) }