fix: apply audio volumes, enumerate real devices, remove dead code

- Audio sources were created but never added to the scene, so mic,
  game and app audio never reached the output; all sources are now
  added with their configured volume via obs_source_set_volume
- getAudioDevices enumerates real WASAPI devices again instead of
  returning hardcoded defaults (the crash-isolation bypass)
- Recording module split: encoder selection and output building move
  to their own files; obs_context shrinks from 1556 to 464 lines
- Remove unused IPC (recordings/timeline/export commands), the
  CommandHandler trait, crash marker files, and the stats plumbing
  that was never wired to the frontend
- Deduplicate the LCU reconnect logic into connect_and_listen
This commit is contained in:
vhaudiquet committed 2026-11-13 00:06:16 +01:00
1 parent 4f9f84446d
commit 2e98159083
15 files changed
+457 -2662

No files matched your search

+5 -40
View File
@@ -12,29 +12,6 @@ use super::handlers::IpcHandlers;
use super::protocol::{IpcMessage, IpcNotification, IpcResponse, MessageType};
use crate::error::{IpcError, Result};
/// Write an *unbuffered* marker file that survives native crashes/segfaults.
/// See [`super::handlers`] for the rationale: the tracing log appender buffers
/// writes in memory, so logs emitted microseconds before a native segfault are
/// lost on disk. This helper fsyncs so the bytes hit disk before returning.
#[cfg(target_os = "windows")]
fn write_ipc_crash_marker(stage: &str) {
use std::io::Write;
let dir = std::env::temp_dir().join("record-daemon-crash-markers");
let _ = std::fs::create_dir_all(&dir);
let path = dir.join(format!(
"{}_{}.txt",
stage,
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_nanos())
.unwrap_or(0)
));
if let Ok(mut f) = std::fs::File::create(&path) {
let _ = writeln!(f, "{} @ {:?}", stage, std::thread::current().id());
let _ = f.sync_all();
}
}
/// IPC server configuration.
#[derive(Debug, Clone)]
pub struct IpcServerConfig {
@@ -490,13 +467,14 @@ impl IpcServer {
};
info!("[IPC] Received message ({} bytes)", line.len());
#[cfg(target_os = "windows")]
write_ipc_crash_marker("ipc_read_done");
// Parse message
let message = match IpcMessage::from_json(&line) {
Ok(msg) => {
info!("[IPC] Parsed message type={:?} command={:?}", msg.message_type, msg.command);
info!(
"[IPC] Parsed message type={:?} command={:?}",
msg.message_type, msg.command
);
msg
}
Err(e) => {
@@ -514,21 +492,10 @@ impl IpcServer {
continue;
}
};
#[cfg(target_os = "windows")]
write_ipc_crash_marker(&format!("ipc_parsed_{:?}", message.command));
// Handle message
let response = match message.message_type {
MessageType::Request => {
#[cfg(target_os = "windows")]
let cmd_dbg = format!("{:?}", message.command);
#[cfg(target_os = "windows")]
write_ipc_crash_marker(&format!("ipc_dispatch_pre_{}", cmd_dbg));
let r = handlers.handle(message).await;
#[cfg(target_os = "windows")]
write_ipc_crash_marker(&format!("ipc_dispatch_post_{}", cmd_dbg));
r
}
MessageType::Request => handlers.handle(message).await,
MessageType::Notification => {
// Notifications don't get responses
trace!("Received notification: {:?}", message);
@@ -551,8 +518,6 @@ impl IpcServer {
.write_all(b"\n")
.await
.map_err(IpcError::WriteError)?;
#[cfg(target_os = "windows")]
write_ipc_crash_marker("ipc_response_sent");
}
Ok(())