fix: Fully synchronize buffers in RecordingSession to account for late-running frames (#2206)
* fix: Fully synchronize `RecordingSession` to account for late Frames * Restructure Code * Update RecordingSession.swift * Fix last audio timestamp not being used * fix: Remove `capture/aborted` error * Update RecordingSession.swift * Don't log for every Frame * Format
This commit is contained in:
@@ -128,7 +128,8 @@ extension CameraSession {
|
||||
recordingSession.initializeVideoWriter(withSettings: videoSettings)
|
||||
|
||||
// start recording session with or without audio.
|
||||
try recordingSession.startAssetWriter()
|
||||
// Use Video [AVCaptureSession] clock as a timebase - all other sessions (here; audio) have to be synced to that Clock.
|
||||
try recordingSession.start(clock: self.captureSession.clock)
|
||||
self.recordingSession = recordingSession
|
||||
self.isRecording = true
|
||||
|
||||
@@ -150,13 +151,13 @@ extension CameraSession {
|
||||
*/
|
||||
func stopRecording(promise: Promise) {
|
||||
CameraQueues.cameraQueue.async {
|
||||
self.isRecording = false
|
||||
|
||||
withPromise(promise) {
|
||||
guard let recordingSession = self.recordingSession else {
|
||||
throw CameraError.capture(.noRecordingInProgress)
|
||||
}
|
||||
recordingSession.finish()
|
||||
// Use Video [AVCaptureSession] clock as a timebase - all other sessions (here; audio) have to be synced to that Clock.
|
||||
recordingSession.stop(clock: self.captureSession.clock)
|
||||
// There might be late frames, so maybe we need to still provide more Frames to the RecordingSession. Let's keep isRecording true for now.
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user