configurable capture fps
This commit is contained in:
@@ -17,7 +17,6 @@ use windows_capture::settings::{
|
||||
|
||||
use crate::CaptureRect;
|
||||
|
||||
const TARGET_FPS: u32 = 30;
|
||||
const MAX_ENCODE_WIDTH: u32 = 1920;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -149,6 +148,7 @@ pub fn start(
|
||||
capture_cursor: bool,
|
||||
_audio: bool,
|
||||
crop: Option<CaptureRect>,
|
||||
fps: u32,
|
||||
) -> Result<CaptureSession> {
|
||||
let monitor = Monitor::primary().map_err(|e| anyhow!("primary monitor: {e:?}"))?;
|
||||
let raw_width = monitor
|
||||
@@ -167,7 +167,7 @@ pub fn start(
|
||||
ffmpeg_path,
|
||||
width,
|
||||
height,
|
||||
fps: TARGET_FPS,
|
||||
fps,
|
||||
crop,
|
||||
};
|
||||
|
||||
|
||||
@@ -286,6 +286,7 @@ fn start_capture(
|
||||
cfg.capture.capture_cursor,
|
||||
cfg.capture.capture_audio,
|
||||
crop,
|
||||
cfg.capture.default_fps,
|
||||
)
|
||||
.map_err(|e| format!("{e:#}"))?;
|
||||
|
||||
@@ -347,12 +348,13 @@ fn resume_capture(state: State<'_, AppState>) -> Result<(), String> {
|
||||
)
|
||||
};
|
||||
|
||||
let fps = state.config.lock().expect("config mutex").capture.default_fps;
|
||||
let output = segment_path(&state.app_dir, next_idx);
|
||||
let ffmpeg = bootstrap::ffmpeg_path(&state.app_dir);
|
||||
if !ffmpeg.is_file() {
|
||||
return Err("ffmpeg.exe not found".to_string());
|
||||
}
|
||||
let session = capture::start(output, ffmpeg, capture_cursor, audio, crop)
|
||||
let session = capture::start(output, ffmpeg, capture_cursor, audio, crop, fps)
|
||||
.map_err(|e| format!("{e:#}"))?;
|
||||
*state.capture.lock().expect("capture mutex") = Some(session);
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user