Skip to content

Desktop encode + discovery hardening - #22

Merged
rldyourmnd merged 3 commits into
mainfrom
feat/desktop-discovery-hardening
Sep 22, 2026
Merged

rldyourmnd merged 3 commits into
mainfrom
feat/desktop-discovery-hardening

Conversation

@rldyourmnd

Copy link
Copy Markdown
Contributor

Summary

  • rds-desktop: OpenH264 switched to ScreenContentRealTime (correct usage type for desktop content); adaptive-quantization/background-detection set off explicitly — upstream disables them with a warning under screen content anyway.
  • rds-desktop: BGRA→I420 now uses the encoder crate's own strided-source converter (BGRA8Source over RawFrame) which dispatches to AVX2 at runtime — measured ~1.7 ms vs ~5.9 ms per 1080p frame (~3.5×), honoring arbitrary strides with no intermediate copy and no new dependency. Scalar fallback kept for non-pixel strides; regression tests cover SIMD-vs-scalar equivalence and padded-stride correctness.
  • rds-discovery: Limits::max_conns (default 1024) caps concurrently held connections — a connection flood can no longer exhaust tasks/FDs; excess sockets close on accept.

Test plan

  • cargo test -p rds-desktop --features x11 — 4/4 codec tests incl. new simd_conversion_matches_scalar + strided_input_ignores_padding
  • cargo test --workspace --all-targets --all-features — 0 failures
  • cargo clippy --workspace --all-targets --all-features -D warnings — clean
  • cargo fmt --check / cargo machete — clean
  • Measured conversion speedup on 1080p frame (1.70 ms dispatched vs 5.89 ms scalar)

Generated with Devin

rldyourmnd and others added 3 commits September 23, 2026 02:26
OpenH264 was configured as CameraVideoRealTime while encoding desktop
frames — ScreenContentRealTime tunes mode decisions for text and sharp
edges. Adaptive quantization and background detection are unsupported
for screen content and now set off explicitly (upstream disabled them
with a warning anyway).

BGRA→I420 now runs through the encoder crate's own strided-source
converter (BGRA8Source over RawFrame), which dispatches to AVX2 at
runtime on x86-64: ~1.7 ms vs ~5.9 ms per 1080p frame measured —
about 4 ms off the capture→encode path — with box-averaged chroma and
no new dependency. Padded strides are honored directly; non-pixel
strides fall back to the scalar path. Regression tests cover SIMD vs
scalar equivalence and stride padding.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Every accepted socket spawned a task with an 8 KiB read buffer and a
10 s timeout — cheap per connection, but unbounded in count, so a
connection flood could exhaust FDs. A semaphore now caps held
connections (Limits::max_conns, default 1024); excess sockets are
accepted and dropped immediately.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
control_rtt_ms used 0 as the "not measured" sentinel, so a heartbeat
echo that landed within the same millisecond — normal on loopback and
fast runners — read back as `None` and flaked
`input_acks_and_heartbeat_roundtrip` on macOS CI. `u64::MAX` is now
the sentinel; 0 is a real RTT.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@rldyourmnd
rldyourmnd merged commit 45cb421 into main Sep 22, 2026
12 checks passed
@rldyourmnd
rldyourmnd deleted the feat/desktop-discovery-hardening branch September 22, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant