One simple straight question, when to release source pixelbuffer after transferred image to avoid crash:
//pixel_buffer is the original
CVPixelBufferCreate(kCFAllocatorDefault,
CVPixelBufferGetWidth(pixel_buffer),
CVPixelBufferGetHeight(pixel_buffer),
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange,
NULL, &targetPxb);
if (targetPxb != NULL) {
auto status = VTPixelTransferSessionTransferImage(transSession,
pixel_buffer,
targetPxb);
if (status == noErr) {
// CFRelease(pixel_buffer); //this will cause crash
}
}