refactor: move PipeWire initialization into a reusable helper function (#69)

Extract duplicated `pipewire::init()`, `MainLoopRc::new()`, and `ContextRc::new()` setup code from `pw_get_global_objects_thread`, `create_virtual_mic`, and `create_link` into a shared `setup_pipewire_context` helper in `src/utils/pipewire.rs`. Also ran codebase-wide linters to improve code quality.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
Tarasov Aleksandr
2026-04-20 19:22:50 +03:00
committed by GitHub
parent 302f153b91
commit 7f8b7194b6
2 changed files with 14 additions and 16 deletions
+4 -4
View File
@@ -42,10 +42,10 @@ async fn main() -> Result<(), Box<dyn Error>> {
lock_file.lock()?;
let socket_path = runtime_dir.join("daemon.sock");
if let Err(e) = fs::remove_file(&socket_path) {
if e.kind() != std::io::ErrorKind::NotFound {
return Err(e.into());
}
if let Err(e) = fs::remove_file(&socket_path)
&& e.kind() != std::io::ErrorKind::NotFound
{
return Err(e.into());
}
let listener = UnixListener::bind(&socket_path)?;