# livekit-ffi-backpressure.patch Apply on livekit/rust-sdks (webrtc-sys VAAPI + VideoTrackSource). 1. VideoSource: latest-wins pending slot — at most one OnFrame in flight; a new capture overwrites pending instead of pushing another I420 onto EncoderQueue. 2. VAAPI H264 Encode: drop delta frames older than 1 frame period, or Encode calls closer than 8 ms (queue drain), *before* ToI420. Logs `VAAPI encode sample delay_ms=` every 90 frames so the clock domain is visible in the cameras journal. Rebuild: `CC=clang CXX=clang++ cargo build --release -p livekit-ffi` Install: copy `target/release/liblivekit_ffi.so` to `native/` and set `LIVEKIT_LIB_PATH` (see systemd drop-in `ffi-backpressure.conf`).