Note that there are some explanatory texts on larger screens.

plurals
  1. POAVCaptureSession returning blank image on iPhone 3G only
    primarykey
    data
    text
    <p>I'm using Apple's example code for AVCaptureSession, and the UIImage that gets created is completely blank. This only happens on the iPhone 3G, along with a unique error that shows up on console that says -</p> <blockquote> <p>Error: CGDataProviderCreateWithCopyOfData: vm_copy failed: status 2.</p> </blockquote> <p>I've researched the error online and found this <a href="https://stackoverflow.com/questions/3367849/cgbitmapcontextcreateimage-vm-copy-failed-iphone-sdk">StackOverflow answer</a>, and it gets rid of the error...but the image is still blank.</p> <p>Has anyone else experienced this and know how to fix it?</p> <p>Thanks in advance.</p> <p>My Code -</p> <pre><code>CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); CVPixelBufferLockBaseAddress(imageBuffer, 0); void *baseAddress = CVPixelBufferGetBaseAddress(imageBuffer); size_t bytesPerRow = CVPixelBufferGetBytesPerRow(imageBuffer); size_t width = CVPixelBufferGetWidth(imageBuffer); size_t height = CVPixelBufferGetHeight(imageBuffer); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(baseAddress, width, height, 8, bytesPerRow, colorSpace, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst); CGImageRef quartzImage = CGBitmapContextCreateImage(context); CVPixelBufferUnlockBaseAddress(imageBuffer,0); CGContextRelease(context); CGColorSpaceRelease(colorSpace); UIImage *image = [UIImage imageWithCGImage:quartzImage]; CGImageRelease(quartzImage); return image; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload