wess / Glimpse

UIView recording library.
MIT License
557 stars 42 forks source link

Assertion Fails for NSParameterAssert(success) #8

Open shahdhiren opened 9 years ago

shahdhiren commented 9 years ago

Hi,

While recording the UIView animation, I encountered below Crash whenever I try to record the screen.

2015-04-17 07:09:46.170 Planbook[848:6733] * Assertion failure in -[GlimpseAssetWriter writeVideoFromImageFrames:], /Users/dshah/Documents/Planbook/Libraries/GlimpseAssetWriter.m:151 2015-04-17 07:09:46.176 Planbook[848:6733] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: success' * First throw call stack: ( 0 CoreFoundation 0x0000000103b08c65 exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000103446bb7 objc_exception_throw + 45 2 CoreFoundation 0x0000000103b08aca +[NSException raise:format:arguments:] + 106 3 Foundation 0x000000010305a98f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195 4 Planbook 0x0000000102dcf4b1 -[CaptureAssetWriter writeVideoFromImageFrames:] + 945 5 Planbook 0x0000000102dca293 -[CaptureView stop] + 291 6 Foundation 0x0000000102ff8744 NSFireTimer + 83 7 CoreFoundation 0x0000000103a70174 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION** + 20 8 CoreFoundation 0x0000000103a6fd35 CFRunLoopDoTimer + 1045 9 CoreFoundation 0x0000000103a31d3d CFRunLoopRun + 1901 10 CoreFoundation 0x0000000103a31366 CFRunLoopRunSpecific + 470 11 GraphicsServices 0x0000000107a93a3e GSEventRunModal + 161 12 UIKit 0x00000001044b6900 UIApplicationMain + 1282 13 Planbook 0x0000000102dd06ef main + 111 14 libdyld.dylib 0x00000001058d9145 start + 1 15 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

I have searched google and found the reason that appendPixelBuffer:withPresentationTime: method of AVAssetWriterInputPixelBufferAdaptor fails writing the buffer and hence the Success parameter is FALSE. I tried using below line instead of

while(!self.adapter.assetWriterInput.readyForMoreMediaData) {}

// [NSThread sleepForTimeInterval:sleepOffset];

This takes makes sure that buffer writing is completed. But this code also doesn't work.

Can you please provide any input for the same? Thanks in advance.