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:
@@ -273,11 +273,11 @@ class CameraSession: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate, AVC
|
||||
switch captureOutput {
|
||||
case is AVCaptureVideoDataOutput:
|
||||
// Write the Video Buffer to the .mov/.mp4 file, this is the first timestamp if nothing has been recorded yet
|
||||
recordingSession.appendBuffer(sampleBuffer, type: .video)
|
||||
recordingSession.appendBuffer(sampleBuffer, clock: captureSession.clock, type: .video)
|
||||
case is AVCaptureAudioDataOutput:
|
||||
// Synchronize the Audio Buffer with the Video Session's time because it's two separate AVCaptureSessions
|
||||
audioCaptureSession.synchronizeBuffer(sampleBuffer, toSession: captureSession)
|
||||
recordingSession.appendBuffer(sampleBuffer, type: .audio)
|
||||
recordingSession.appendBuffer(sampleBuffer, clock: audioCaptureSession.clock, type: .audio)
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
Reference in New Issue
Block a user