mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-28 06:21:23 +00:00
fix(pwsp-daemon): added retries to link_player_to_virtual_mic()
https://github.com/arabianq/pipewire-soundpad/issues/15
This commit is contained in:
@@ -27,6 +27,16 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
get_daemon_config(); // Initialize daemon config
|
get_daemon_config(); // Initialize daemon config
|
||||||
create_virtual_mic()?;
|
create_virtual_mic()?;
|
||||||
get_audio_player().await; // Initialize audio player
|
get_audio_player().await; // Initialize audio player
|
||||||
|
|
||||||
|
let max_retries = 5;
|
||||||
|
for i in 0..=max_retries {
|
||||||
|
match link_player_to_virtual_mic().await {
|
||||||
|
Ok(_) => break,
|
||||||
|
Err(e) => println!("{e}\t{i}/{max_retries}"),
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(Duration::from_millis(300 * i)).await;
|
||||||
|
}
|
||||||
link_player_to_virtual_mic().await?;
|
link_player_to_virtual_mic().await?;
|
||||||
|
|
||||||
let runtime_dir = get_runtime_dir();
|
let runtime_dir = get_runtime_dir();
|
||||||
|
|||||||
+4
-4
@@ -39,16 +39,16 @@ pub async fn link_player_to_virtual_mic() -> Result<(), Box<dyn Error>> {
|
|||||||
if let Ok(device) = get_device("pwsp-daemon").await {
|
if let Ok(device) = get_device("pwsp-daemon").await {
|
||||||
pwsp_daemon_output = device;
|
pwsp_daemon_output = device;
|
||||||
} else {
|
} else {
|
||||||
eprintln!("Could not find alsa_playback.pwsp-daemon device, skipping device linking");
|
return Err(
|
||||||
return Ok(());
|
"Could not find alsa_playback.pwsp-daemon device, skipping device linking".into(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let pwsp_daemon_input;
|
let pwsp_daemon_input;
|
||||||
if let Ok(device) = get_device("pwsp-virtual-mic").await {
|
if let Ok(device) = get_device("pwsp-virtual-mic").await {
|
||||||
pwsp_daemon_input = device;
|
pwsp_daemon_input = device;
|
||||||
} else {
|
} else {
|
||||||
eprintln!("Could not find pwsp-virtual-mic device, skipping device linking");
|
return Err("Could not find pwsp-virtual-mic device, skipping device linking".into());
|
||||||
return Ok(());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let output_fl = pwsp_daemon_output
|
let output_fl = pwsp_daemon_output
|
||||||
|
|||||||
Reference in New Issue
Block a user