Skip to main content

run_capture

Function run_capture 

Source
pub fn run_capture<F>(
    settings: RustCaptureSettings,
    controls: Arc<Controls>,
    encode_tid_tx: Sender<ThreadId>,
    on_frame: F,
) -> Result<(), String>
where F: FnMut(Vec<EncodedStripe>) + Send + 'static,
Expand description

Capture an X11 display until stop is set, on the best path this session can run.

nvfbc::run_capture is tried first: where the NVIDIA driver offers framebuffer capture and the session encodes on NVENC, the screen is composited into video memory and encoded in place, so a frame reaches the bitstream without being copied once. dri3::run_capture is next: on a server whose screen lives on the GPU, the server blits the root into dmabufs this process allocated and the hardware session reads them in place. Each reports that it cannot serve the session — a codec its engine has no support for, software encoding, a watermark that has to be blended into host pixels, a server or device that does not qualify — and the capture then runs on the general XShm path below, which every X server supports. Whichever path runs, the capture’s frame rate paces the server’s fake vblank for as long as it does ([VblankRate]).

Blocking; intended to run on a dedicated thread.