Ios8 VTCompressionSessionCodeFrame返回OSStatus错误代码-12780
关于在ios8上使用VideoToolbox中的VTCompressionSession,我有一个问题 我的VTCompressionSession设置正确,没有返回错误代码。然而,当我尝试使用VTCompressionSessionCodeFrame对帧进行编码时,我得到了一个OSStatus错误代码-12780。我找不到任何关于此类错误代码的定义或解释。有人有什么想法吗 以下是我的代码片段:Ios8 VTCompressionSessionCodeFrame返回OSStatus错误代码-12780,ios8,video-encoding,Ios8,Video Encoding,关于在ios8上使用VideoToolbox中的VTCompressionSession,我有一个问题 我的VTCompressionSession设置正确,没有返回错误代码。然而,当我尝试使用VTCompressionSessionCodeFrame对帧进行编码时,我得到了一个OSStatus错误代码-12780。我找不到任何关于此类错误代码的定义或解释。有人有什么想法吗 以下是我的代码片段: CVPixelBufferRef input_frame_buffer_; void* plane_
CVPixelBufferRef input_frame_buffer_;
void* plane_ptrs[3] = {frame->channel[0], frame->channel[1], frame->channel[3]};
size_t plane_widths[3] = {frame->header.width,
frame->header.width / 2, frame->header.width / 2};
size_t plane_heights[3] = {frame->header.height,
frame->header.height / 2, frame->header.height / 2};
size_t plane_bytes_per_row[3] = {frame->stride[0], frame->stride[1], frame->stride[2]};
CVReturn pixel_buffer_status =
CVPixelBufferCreateWithPlanarBytes(kCFAllocatorDefault,
frame->header.width,
frame->header.height,
(OSType) kCVPixelFormatType_420YpCbCr8Planar,
frame->channel[0],
0,
3,
plane_ptrs,
plane_widths,
plane_heights,
plane_bytes_per_row,
&MyPixelBufferReleaseCallback,
(void*)this,
nullptr,
&input_frame_buffer_);
if (pixel_buffer_status != kCVReturnSuccess) {
logger_->Error("CVPixelBufferCreateWithBytes failed.");
return;
}
VTEncodeInfoFlags info_flags;
OSStatus status = VTCompressionSessionEncodeFrame(session_,
input_frame_buffer_, frame->header.pts, kCMTimeInvalid, nullptr,
mySourceFrameRefCon,
&info_flags);
看起来您需要为
dataSize
参数传递一个值。请参见我在apple开发者论坛上的回答和以下示例代码:
roxlu解决方案是使用VTCompression的像素缓冲池
我以前也遇到过同样的问题,您可以按照以下步骤操作