fix: 手动停止录制时跳过耗时的文件分析,避免 save dialog 延迟/卡住

fragmented MP4 在 SIGINT 后可能导致 ffprobe/ffmpeg 分析卡住。
stopRequested 时直接返回基本文件信息,不跑 ffprobe 和音量检测。
This commit is contained in:
yumoqing 2026-07-01 08:02:57 +08:00
parent ec88e9f530
commit 6f2661c3d1

View File

@ -135,6 +135,25 @@ public final class FFmpegRecorder: StreamRecorderEngine {
throw RecordingError.outputNotFound
}
// fragmented MP4 ffprobe
if stopRequested {
NSLog("[Recorder] Stop requested, skipping analysis")
let attrs = try? FileManager.default.attributesOfItem(atPath: outputPath)
let fileSize = attrs?[.size] as? Int64 ?? 0
let result = RecordingResult(
outputPath: outputPath,
duration: duration,
fileSize: fileSize,
hasVideo: true,
hasAudio: true,
videoInfo: nil,
audioInfo: nil,
audioLevel: nil
)
delegate?.recorder(self, didFinishWithResult: result)
return
}
NSLog("[Recorder] Analyzing output file...")
//
let ffprobePath = ffmpegPath.replacingOccurrences(of: "ffmpeg", with: "ffprobe")