Skip to main content

run_capture

Function run_capture 

Source
pub fn run_capture<F>(
    settings: CaptureSettings,
    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.

dri3::run_capture is tried first: 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. On an NVIDIA X server it reaches the encoder sooner than NvFBC and at a fraction of the CPU. nvfbc::run_capture is next, for an NVIDIA server DRI3 cannot serve (a driver without GBM): the driver composites the screen into video memory and NVENC encodes it in place. Each reports that it cannot serve the session — a codec its engine has no support for, software encoding, a watermark NvFBC would have to blend 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.