我正面临一个奇怪的崩溃
VTCompressionSessionEncodeFrame(session, (CVPixelBufferRef)data, pts, dur, frameProps, NULL, &flags);
以下代码。
void H264Encode::pushBuffer(const uint8_t *const data, size_t size, videocore::IMetadata &metadata)
{
if(m_compressionSession) {
m_encodeMutex.lock();
VTCompressionSessionRef session = (VTCompressionSessionRef)m_compressionSession;
CMTime pts = CMTimeMake(metadata.timestampDelta + m_ctsOffset, 1000.); // timestamp is in ms.
CMTime dur = CMTimeMake(1, m_fps);
VTEncodeInfoFlags flags;
CFMutableDictionaryRef frameProps = NULL;
if(m_forceKeyframe) {
s_forcedKeyframePTS = pts.value;
frameProps = CFDictionaryCreateMutable(kCFAllocatorDefault, 1,&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFDictionaryAddValue(frameProps, kVTEncodeFrameOptionKey_ForceKeyFrame, kCFBooleanTrue);
}
VTCompressionSessionEncodeFrame(session, (CVPixelBufferRef)data, pts, dur, frameProps, NULL, &flags);
if(m_forceKeyframe) {
CFRelease(frameProps);
m_forceKeyframe = false;
}
m_encodeMutex.unlock();
}
我要做的是将CVPixelBufferRef转换为h264视频数据。 但它总是在EXEC_BAD_ACCESS的上述功能中崩溃。
xcode控制台上出现的崩溃日志就是这样的..
Method cache corrupted. This may be a message to an invalid object, or a memory error somewhere else.
objc[29576]: receiver 0x10d2077c8, SEL 0x103734801, isa 0x600000123a20, cache 0x600000123a30, buckets 0x600000123a40, mask 0x0, occupied 0x0
objc[29576]: receiver 0 bytes, buckets 0 bytes
objc[29576]: selector '_cfTypeID'
objc[29576]: isa ' UH\211\345H\213G]\303UH\211\345SP\211\363\350\376\355\377\377\271\373\345\377\377H\205\300tH\213\204\333\225\302\266\362\272'
objc[29576]:Method cache corrupted.
有没有人知道它崩溃的原因以及可能的解决办法。任何提示或指导都可能有所帮助..