Commit bec3479f authored by panxiaochun's avatar panxiaochun

fix the problem:repeatedly stop cause app crash

parent f888f471
...@@ -129,31 +129,33 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;} ...@@ -129,31 +129,33 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
- (void)stop; - (void)stop;
{ {
[super stop]; if (self.running == YES) {
[super stop];
[videoDataOutput release]; [videoDataOutput release];
if (videoDataOutputQueue) { if (videoDataOutputQueue) {
dispatch_release(videoDataOutputQueue); dispatch_release(videoDataOutputQueue);
} }
if (self.recordVideo == YES) { if (self.recordVideo == YES) {
if (self.recordAssetWriter) { if (self.recordAssetWriter) {
if (self.recordAssetWriter.status == AVAssetWriterStatusWriting) { if (self.recordAssetWriter.status == AVAssetWriterStatusWriting) {
[self.recordAssetWriter finishWriting]; [self.recordAssetWriter finishWriting];
NSLog(@"[Camera] recording stopped"); NSLog(@"[Camera] recording stopped");
} else { } else {
NSLog(@"[Camera] Recording Error: asset writer status is not writing"); NSLog(@"[Camera] Recording Error: asset writer status is not writing");
}
[recordAssetWriter release];
} }
[recordAssetWriter release];
}
[recordAssetWriterInput release]; [recordAssetWriterInput release];
[recordPixelBufferAdaptor release]; [recordPixelBufferAdaptor release];
} }
if (self.customPreviewLayer) { if (self.customPreviewLayer) {
[self.customPreviewLayer removeFromSuperlayer]; [self.customPreviewLayer removeFromSuperlayer];
self.customPreviewLayer = nil; self.customPreviewLayer = nil;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment