fix: 手动停止录制时跳过耗时的文件分析,避免 save dialog 延迟/卡住
fragmented MP4 在 SIGINT 后可能导致 ffprobe/ffmpeg 分析卡住。 stopRequested 时直接返回基本文件信息,不跑 ffprobe 和音量检测。
This commit is contained in:
parent
ec88e9f530
commit
6f2661c3d1
@ -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")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user