refactor: clear too_many_arguments and large_enum_variant warnings

Oracle P2 batch 2 (refactor items). Drops both remaining design-shape
clippy warnings to zero without behavior change.

  - avhw.rs build_filter_graph: drop unused _enc_width/_enc_height params
    (Oracle caught them during P2 review — passed by EncState::new but
    never read inside the function; the filter graph uses width/height
    only). Signature: 8 args -> 6 args (under clippy's 7 threshold).

  - state.rs InFlightSurface::CopyQueued: Box the drm_map field.
    AVDRMFrameDescriptor is ~592 bytes (4 objects + 4 layers); the enum
    size was being dominated by this variant, ballooning every
    InFlightSurface value to 592 bytes even for the None/AllocQueued
    variants. Box<AVDRMFrameDescriptor> shrinks the enum to ~32 bytes
    regardless of variant. The drm_map field is currently destructured
    under _drm_map (unused), so the boxing has no consumer-side impact.

  - state_portal.rs webrtc_thread_loop: 10 args -> 4 args via two new
    structs:
      * WebRtcThreadConfig { fps, enc_width, enc_height, max_bitrate }
        — immutable for the thread's lifetime; a tier change spawns a
        new thread rather than mutating.
      * WebRtcThreadChannels { webrtc_rx, sent_gap_tx, bitrate_tx,
        resolution_tx } — channel endpoints owned exclusively by the
        sender thread after spawn.
    wrtc (WebRtcState) and paused (Arc<AtomicBool>) stay as separate
    args because they have different ownership semantics (moved-in
    state vs shared atomic). Documented as doc comments on the new
    types so the next reader understands the bundle rationale.

All 79 unit tests + 3 integration tests pass. clippy: 0 errors.
Per-file warning counts: state_portal.rs down from 3 to 0; state.rs
down from 8 to 4 (remaining are unrelated dead-code on OutputInfo /
starting_timestamp).
This commit is contained in:
dailz
2026-06-28 14:35:35 +08:00
parent ed39d3d873
commit 86a8b61b07
3 changed files with 51 additions and 22 deletions
+5 -2
View File
@@ -193,7 +193,10 @@ pub enum InFlightSurface<S: CaptureSource> {
AllocQueued,
CopyQueued {
surface: ff::frame::Video,
drm_map: ff::ffi::AVDRMFrameDescriptor,
// Boxed: AVDRMFrameDescriptor is ~592 bytes (4 objects + 4 layers),
// which would balloon every InFlightSurface variant via enum alignment.
// The box shrinks the enum to ~32 bytes regardless of variant.
drm_map: Box<ff::ffi::AVDRMFrameDescriptor>,
frame: S::Frame,
buffer: WlBuffer,
},
@@ -568,7 +571,7 @@ impl<S: CaptureSource> State<S> {
);
self.in_flight_surface = InFlightSurface::CopyQueued {
surface,
drm_map: desc,
drm_map: Box::new(desc),
frame,
buffer: wl_buffer,
};