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: &mut F,
) -> Option<Result<(), String>>
where F: FnMut(Vec<EncodedStripe>),
Expand description

Run the zero-copy X11 capture until controls.stop is set, or report that it cannot start.

None means DRI3 cannot serve this session and nothing was delivered, which is the caller’s signal to run the XShm path instead. That includes a first frame the encoder could not read, since a buffer the server imported is not yet proof the encoder can. Anything else means the capture ran, every frame going from the server’s blit into the encoder without a copy, and carries how it ended.

Each iteration paces to the live target rate, applies the cross-thread controls on the thread that owns the sessions, follows the root geometry, asks the server whether anything was drawn, and only then blits, waits, and encodes through the same send / quality / key-frame policy every full-frame encoder obeys.