2 Commits
Author SHA1 Message Date
Alvin-Zilverstand ae1612547a ci: run rust tests in parallel with installer build and speed up release compile
Build Windows Release / Rust tests (push) Canceled after 0s
Build Windows Release / Windows installer (push) Canceled after 0s
2026-09-14 14:14:47 +02:00
Alvin-Zilverstand d2dd2f9c27 fix: detect capture capabilities after window init to avoid MTA COM crash 2026-09-14 14:12:40 +02:00
3 changed files with 47 additions and 10 deletions

No files matched your search

+25 -3
View File
@@ -32,6 +32,31 @@ concurrency:
cancel-in-progress: true
jobs:
tests:
name: Rust tests
runs-on: windows-latest
defaults:
run:
shell: pwsh
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
src-tauri
- name: Run Rust tests
run: cargo test
windows-installer:
name: Windows installer
runs-on: windows-latest
@@ -81,9 +106,6 @@ jobs:
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Run Rust tests
run: cargo test
- name: Build Windows desktop installers
run: pnpm run desktop:build
-1
View File
@@ -16,5 +16,4 @@ tauri-plugin-global-shortcut = "2"
[profile.release]
lto = "thin"
codegen-units = 1
strip = true
+22 -6
View File
@@ -39,7 +39,7 @@ use std::io::{Read, Write};
use std::net::TcpListener;
use std::path::PathBuf;
use std::process::Command;
use std::sync::Mutex;
use std::sync::{Mutex, OnceLock};
use std::thread;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use tauri::{Manager, State};
@@ -53,7 +53,7 @@ struct AppRuntime {
valve_events: Mutex<Vec<RawGameEvent>>,
hotkey_shortcuts: Mutex<Option<HotkeyShortcuts>>,
app_handle: Mutex<Option<tauri::AppHandle>>,
capture_capabilities: CaptureCapabilities,
capture_capabilities: OnceLock<CaptureCapabilities>,
}
#[derive(Clone)]
@@ -63,14 +63,24 @@ struct CaptureCapabilities {
desktop_duplication_available: bool,
}
const DEFAULT_CAPS: CaptureCapabilities = CaptureCapabilities {
ffmpeg_path: None,
system_audio_available: false,
desktop_duplication_available: false,
};
fn native_system_loopback_available_bg() -> bool {
std::thread::scope(|scope| scope.spawn(native_system_loopback_available).join().unwrap_or(false))
}
fn detect_capture_capabilities() -> CaptureCapabilities {
let ffmpeg_path = find_ffmpeg_executable();
let (system_audio_available, desktop_duplication_available) = match &ffmpeg_path {
Some(path) => (
native_system_loopback_available() || ffmpeg_supports_input_device(path, "wasapi"),
native_system_loopback_available_bg() || ffmpeg_supports_input_device(path, "wasapi"),
ffmpeg_supports_filter(path, "ddagrab"),
),
None => (native_system_loopback_available(), false),
None => (native_system_loopback_available_bg(), false),
};
CaptureCapabilities {
ffmpeg_path,
@@ -1598,7 +1608,7 @@ fn main() {
valve_events: Mutex::new(Vec::new()),
hotkey_shortcuts: Mutex::new(None),
app_handle: Mutex::new(None),
capture_capabilities: detect_capture_capabilities(),
capture_capabilities: OnceLock::new(),
})
.setup(|app| {
let handle = app.handle().clone();
@@ -1606,6 +1616,11 @@ fn main() {
// Store app handle for hotkey re-registration
{
let runtime = app.state::<AppRuntime>();
// Detect capture capabilities after Tauri has initialized COM for the
// main thread. Detecting before setup (e.g. WASAPI on the main thread)
// puts the thread in MTA mode and makes window creation fail with
// RPC_E_CHANGED_MODE.
let _ = runtime.capture_capabilities.set(detect_capture_capabilities());
let _ = runtime.app_handle.lock().map(|mut guard| {
*guard = Some(handle.clone());
});
@@ -1893,8 +1908,9 @@ fn enforce_storage_cap(runtime: &AppRuntime) -> Result<(), String> {
fn status_from_recorder(
recorder: &RecorderService,
capture: Option<&ActiveCapture>,
capabilities: &CaptureCapabilities,
capabilities: &OnceLock<CaptureCapabilities>,
) -> DesktopStatus {
let capabilities = capabilities.get().unwrap_or(&DEFAULT_CAPS);
let game_id = recorder.state.detected_game_id.clone().unwrap_or_default();
let quality = recorder.settings.effective_quality_for(&game_id).clone();
DesktopStatus {