fix: AVAssetWriter status is 1 crash (#995)
fixes #930 markAsFinished has to be called within the finishWritingWithCompletionHandler. Moving that 2 lines allowed me to spam start / stop for hundreds of time without a single crash.
This commit is contained in:
parent
485f33eb1c
commit
2ccce3587d
@ -199,9 +199,9 @@ class RecordingSession {
|
|||||||
userInfo: [NSLocalizedDescriptionKey: "Stopped Recording Session too early, no frames have been recorded!"])
|
userInfo: [NSLocalizedDescriptionKey: "Stopped Recording Session too early, no frames have been recorded!"])
|
||||||
completionHandler(.failed, error)
|
completionHandler(.failed, error)
|
||||||
} else if assetWriter.status == .writing {
|
} else if assetWriter.status == .writing {
|
||||||
bufferAdaptor?.assetWriterInput.markAsFinished()
|
|
||||||
audioWriter?.markAsFinished()
|
|
||||||
assetWriter.finishWriting {
|
assetWriter.finishWriting {
|
||||||
|
self.bufferAdaptor?.assetWriterInput.markAsFinished()
|
||||||
|
self.audioWriter?.markAsFinished()
|
||||||
self.completionHandler(self.assetWriter.status, self.assetWriter.error)
|
self.completionHandler(self.assetWriter.status, self.assetWriter.error)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user