From d7f5d456f4a04a2e0109044a045be9dacda34ff9 Mon Sep 17 00:00:00 2001 From: Jonathan Fuerth Date: Tue, 18 Apr 2017 13:49:22 -0400 Subject: [PATCH] Fix crash when recording isn't started immediately Fixes "Cannot call method when status is 1" on call to startRecording() that happens if recording isn't started immediately after attaching the input. This fix makes it possible to attach the MovieOutput to the camera up front and then call startRecording later on without any visual hiccups. --- framework/Source/iOS/MovieOutput.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/Source/iOS/MovieOutput.swift b/framework/Source/iOS/MovieOutput.swift index 0d2d289b..d378cfce 100644 --- a/framework/Source/iOS/MovieOutput.swift +++ b/framework/Source/iOS/MovieOutput.swift @@ -188,7 +188,7 @@ public class MovieOutput: ImageConsumer, AudioEncodingTarget { } public func processAudioBuffer(_ sampleBuffer:CMSampleBuffer) { - guard let assetWriterAudioInput = assetWriterAudioInput else { return } + guard isRecording, let assetWriterAudioInput = assetWriterAudioInput else { return } sharedImageProcessingContext.runOperationSynchronously{ let currentSampleTime = CMSampleBufferGetOutputPresentationTimeStamp(sampleBuffer)