Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae1612547a | ||
|
|
d2dd2f9c27 |
No files matched your search
@@ -32,6 +32,31 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
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:
|
windows-installer:
|
||||||
name: Windows installer
|
name: Windows installer
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
@@ -81,9 +106,6 @@ jobs:
|
|||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Run Rust tests
|
|
||||||
run: cargo test
|
|
||||||
|
|
||||||
- name: Build Windows desktop installers
|
- name: Build Windows desktop installers
|
||||||
run: pnpm run desktop:build
|
run: pnpm run desktop:build
|
||||||
|
|
||||||
|
|||||||
@@ -16,5 +16,4 @@ tauri-plugin-global-shortcut = "2"
|
|||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = "thin"
|
lto = "thin"
|
||||||
codegen-units = 1
|
|
||||||
strip = true
|
strip = true
|
||||||
+22
-6
@@ -39,7 +39,7 @@ use std::io::{Read, Write};
|
|||||||
use std::net::TcpListener;
|
use std::net::TcpListener;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::sync::Mutex;
|
use std::sync::{Mutex, OnceLock};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||||
use tauri::{Manager, State};
|
use tauri::{Manager, State};
|
||||||
@@ -53,7 +53,7 @@ struct AppRuntime {
|
|||||||
valve_events: Mutex<Vec<RawGameEvent>>,
|
valve_events: Mutex<Vec<RawGameEvent>>,
|
||||||
hotkey_shortcuts: Mutex<Option<HotkeyShortcuts>>,
|
hotkey_shortcuts: Mutex<Option<HotkeyShortcuts>>,
|
||||||
app_handle: Mutex<Option<tauri::AppHandle>>,
|
app_handle: Mutex<Option<tauri::AppHandle>>,
|
||||||
capture_capabilities: CaptureCapabilities,
|
capture_capabilities: OnceLock<CaptureCapabilities>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@@ -63,14 +63,24 @@ struct CaptureCapabilities {
|
|||||||
desktop_duplication_available: bool,
|
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 {
|
fn detect_capture_capabilities() -> CaptureCapabilities {
|
||||||
let ffmpeg_path = find_ffmpeg_executable();
|
let ffmpeg_path = find_ffmpeg_executable();
|
||||||
let (system_audio_available, desktop_duplication_available) = match &ffmpeg_path {
|
let (system_audio_available, desktop_duplication_available) = match &ffmpeg_path {
|
||||||
Some(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"),
|
ffmpeg_supports_filter(path, "ddagrab"),
|
||||||
),
|
),
|
||||||
None => (native_system_loopback_available(), false),
|
None => (native_system_loopback_available_bg(), false),
|
||||||
};
|
};
|
||||||
CaptureCapabilities {
|
CaptureCapabilities {
|
||||||
ffmpeg_path,
|
ffmpeg_path,
|
||||||
@@ -1598,7 +1608,7 @@ fn main() {
|
|||||||
valve_events: Mutex::new(Vec::new()),
|
valve_events: Mutex::new(Vec::new()),
|
||||||
hotkey_shortcuts: Mutex::new(None),
|
hotkey_shortcuts: Mutex::new(None),
|
||||||
app_handle: Mutex::new(None),
|
app_handle: Mutex::new(None),
|
||||||
capture_capabilities: detect_capture_capabilities(),
|
capture_capabilities: OnceLock::new(),
|
||||||
})
|
})
|
||||||
.setup(|app| {
|
.setup(|app| {
|
||||||
let handle = app.handle().clone();
|
let handle = app.handle().clone();
|
||||||
@@ -1606,6 +1616,11 @@ fn main() {
|
|||||||
// Store app handle for hotkey re-registration
|
// Store app handle for hotkey re-registration
|
||||||
{
|
{
|
||||||
let runtime = app.state::<AppRuntime>();
|
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| {
|
let _ = runtime.app_handle.lock().map(|mut guard| {
|
||||||
*guard = Some(handle.clone());
|
*guard = Some(handle.clone());
|
||||||
});
|
});
|
||||||
@@ -1893,8 +1908,9 @@ fn enforce_storage_cap(runtime: &AppRuntime) -> Result<(), String> {
|
|||||||
fn status_from_recorder(
|
fn status_from_recorder(
|
||||||
recorder: &RecorderService,
|
recorder: &RecorderService,
|
||||||
capture: Option<&ActiveCapture>,
|
capture: Option<&ActiveCapture>,
|
||||||
capabilities: &CaptureCapabilities,
|
capabilities: &OnceLock<CaptureCapabilities>,
|
||||||
) -> DesktopStatus {
|
) -> DesktopStatus {
|
||||||
|
let capabilities = capabilities.get().unwrap_or(&DEFAULT_CAPS);
|
||||||
let game_id = recorder.state.detected_game_id.clone().unwrap_or_default();
|
let game_id = recorder.state.detected_game_id.clone().unwrap_or_default();
|
||||||
let quality = recorder.settings.effective_quality_for(&game_id).clone();
|
let quality = recorder.settings.effective_quality_for(&game_id).clone();
|
||||||
DesktopStatus {
|
DesktopStatus {
|
||||||
|
|||||||
Reference in new issue
Block a user