Commit bf3ab237 authored by François Grisez's avatar François Grisez
Browse files

Workaround to prevent VideoToolbox's H264 encoder from crash on MacOSX

parent cc422c23
......@@ -194,10 +194,22 @@ static void h264_enc_process(MSFilter *f) {
YuvBuf src_yuv_frame, dst_yuv_frame = {0};
CVPixelBufferRef pixbuf;
CFMutableDictionaryRef enc_param = NULL;
int i;
int i, pixbuf_fmt = kCVPixelFormatType_420YpCbCr8Planar;
CFNumberRef value;
CFMutableDictionaryRef pixbuf_attr;
ms_yuv_buf_init_from_mblk(&src_yuv_frame, frame);
CVPixelBufferPoolCreatePixelBuffer(NULL, pixbuf_pool, &pixbuf);
pixbuf_attr = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);
value = CFNumberCreate(NULL, kCFNumberIntType, &pixbuf_fmt);
CFDictionarySetValue(pixbuf_attr, kCVPixelBufferPixelFormatTypeKey, value);
CVPixelBufferCreate(NULL, ctx->conf.vsize.width, ctx->conf.vsize.height, kCVPixelFormatType_420YpCbCr8Planar, pixbuf_attr, &pixbuf);
CVPixelBufferLockBaseAddress(pixbuf, 0);
dst_yuv_frame.w = (int)CVPixelBufferGetWidth(pixbuf);
dst_yuv_frame.h = (int)CVPixelBufferGetHeight(pixbuf);
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