tighten export and capture handling
This commit is contained in:
@@ -329,6 +329,10 @@ impl CaptureSession {
|
||||
/// Re-encode the intermediate file with correct timestamps.
|
||||
/// The capture declares -framerate N and applies fps=M filter.
|
||||
/// This scales PTS to match real-time duration.
|
||||
///
|
||||
/// Idempotent: if `input` has already been consumed (e.g. a previous
|
||||
/// pause/resume cycle ran this to completion and removed it), and
|
||||
/// `output` exists, returns Ok without re-running ffmpeg.
|
||||
pub fn fix_intermediate_fps(
|
||||
ffmpeg: &std::path::Path,
|
||||
input: &std::path::Path,
|
||||
@@ -339,6 +343,11 @@ pub fn fix_intermediate_fps(
|
||||
) -> Result<()> {
|
||||
use std::process::Command;
|
||||
|
||||
if !input.is_file() && output.is_file() {
|
||||
tracing::debug!("capture fix: input already consumed, output exists, skipping");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if frame_count == 0 || elapsed_secs <= 0.0 {
|
||||
tracing::warn!("capture fix: no frames counted, keeping original");
|
||||
let _ = std::fs::rename(input, output);
|
||||
|
||||
Reference in New Issue
Block a user