~hmh/pipewire_gst_bugs

ref: dfa8e5b9f52b4c57fba6958e4c6d384901a58b7f pipewire_gst_bugs/src/main.rs -rw-r--r-- 828 bytes
dfa8e5b9HMH Deadlock set_state 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use std::thread::spawn;
use std::sync::mpsc;

use pipewire::get_capturables;
use tracing::{info, warn};

mod pipewire;
mod pipewire_dbus;

fn main() {
    tracing_subscriber::fmt()
        .with_max_level(tracing::Level::TRACE)
        .init();
    gstreamer::init().unwrap();

    let capturables = get_capturables().unwrap();
    let c1 = capturables[0].clone();
    let c2 = capturables[1].clone();
    let (send, recv) = mpsc::channel::<pipewire::PipeWireCapturable>();

    let t = spawn(move || {
        let mut r;
        for _ in 0..2 {
            let c = recv.recv().unwrap();
            // uncommenting the following line prevents the deadlock
            // r = None;
            r = Some(c.recorder().unwrap());
        }
    });

    send.send(c1).unwrap();
    send.send(c2).unwrap();

    t.join().unwrap();
}