[AVAssetWriterInput markAsFinished] Cannot call method when status is 2
fupeng opened this issue · 6 comments
Nice work about the AVSegmentingAppleEncoder!
Every time I tested this app on my iPhone 4, I got this exception: [AVAssetWriterInput markAsFinished] Cannot call method when status is 2. It seems that tempAssetWriter is not finished as expected. Do you have any idea about this?
//2012-12-14 14:19:13.257 RosyWriter[1747:707] Switching encoders
//2012-12-14 14:19:14.434 RosyWriter[1747:1a37] Encoder switch finished
//2012-12-14 14:19:18.256 RosyWriter[1747:707] Switching encoders
//2012-12-14 14:19:19.245 RosyWriter[1747:2103] Encoder switch finished
//2012-12-14 14:19:23.258 RosyWriter[1747:707] Switching encoders
//2012-12-14 14:19:28.265 RosyWriter[1747:707] Switching encoders
//2012-12-14 14:19:33.256 RosyWriter[1747:707] Switching encoders
//2012-12-14 14:19:38.256 RosyWriter[1747:707] Switching encoders
//2012-12-14 14:19:43.258 RosyWriter[1747:707] Switching encoders
//2012-12-14 14:19:48.256 RosyWriter[1747:707] Switching encoders
//2012-12-14 14:19:50.443 RosyWriter[1747:2103] Couldn't add asset writer audio input.
//2012-12-14 14:19:50.540 RosyWriter[1747:2103] Encoder switch finished
//2012-12-14 14:19:51.803 RosyWriter[1747:1a37] Error: The operation could not be completed{
// NSLocalizedDescription = "The operation could not be completed";
// NSLocalizedFailureReason = "An unknown error occurred (-12763)";
// NSUnderlyingError = "Error Domain=NSOSStatusErrorDomain Code=-12763 "The operation couldn\U2019t be completed. (OSStatus error -12763.)"";
//}
//2012-12-14 14:19:52.936 RosyWriter[1747:1fc3] Encoder switch finished
//2012-12-14 14:19:53.258 RosyWriter[1747:707] Switching encoders
//2012-12-14 14:19:53.003 RosyWriter[1747:1fc3] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '* -[AVAssetWriterInput markAsFinished] Cannot call method when status is 2'
//*** First throw call stack:
//(0x373d288f 0x350d7259 0x336faeb3 0x336fa62d 0x9e699 0x304f2c59 0x304fe7bb 0x33c41dfb 0x33c41cd0)
//terminate called throwing an exception
Don't mark it as finished when the status is 2
It seems that there are threading issues going on, and the only real way to fix this that I've found is to catch the exception.
Probably it is because you are trying to reuse your AVAssetWriter instance (GPUImageMovieWriter maybe). Remember to always create a new instance when you need to start the recording.
This code no longer is used and we've found a better way around the problem
what is the way? I need to make these changes!
Please check out our new code on Kickflip.io which has an open source live
broadcasting SDK that solves these problems in a much better way.
On Monday, March 10, 2014, Rakasis notifications@github.com wrote:
what is the way? I need to make these changes!
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-37241918
.