status = VTDecompressionSessionCreate(kCFAllocatorDefault,
_decoderFormatDescription,
NULL, attrs,
&callBackRecord,
&_decoderSession);
返回:kVTVideoDecoderNotAvailableNowErr = -12913, 导致_decoderSession == nil,解码失败;
解决:
及时释放资源:
-(void)clearH264Deocder {
if(_decoderSession) {
VTDecompressionSessionInvalidate(_decoderSession);
CFRelease(_decoderSession);
_decoderSession = NULL;
}
if(_decoderFormatDescription) {
CFRelease(_decoderFormatDescription);
_decoderFormatDescription = NULL;
}
free(_sps);
free(_pps);
_spsSize = _ppsSize = 0;
}