CapSoftware / scap

High-performance, cross-platform screen capture library in Rust.
https://crates.io/crates/scap
Other
229 stars 44 forks source link

Cannot start a capturer after first capturer was shut down on pipewire #100

Open quexten opened 4 months ago

quexten commented 4 months ago

Hi, first of, thank you for putting the effort into this great crate!

Starting a capturer, stopping it (either by code, or by cancelling share in gnome) and starting another capturer, with the pipewire backend, currently results in RecvError on calling get_next_frame(), making it unusable until the process is restarted.

let mut capt: Capturer = Capturer::new(options.clone());
capt.start_capture();
let img = test.get_next_frame();
match img {
    Ok(img) => {
        println!("ok");
    }
    Err(err) => {
        println!("Failed to get frame: {:?}", err);
    }
}
capt.stop_capture();
let mut capt1: Capturer = Capturer::new(options.clone());
capt1.start_capture();
let img1 = test1.get_next_frame();
match img1 {
    Ok(img) => {
        println!("ok");
    }
    Err(err) => {
        println!("Failed to get frame: {:?}", err);
    }
}