我得到错误-12910(kVTVideoDecoderUnsupportedDataFormatErr)。我使用Avios积分(https://github.com/tidwall/Avios),这是相关的部分:解码H264:VTDecompressionSessionCreate失败,在SIM</strong>在我的iPad,<strong>运行的代码,但不使用时错误VTDecompressionSessionCreate代码-12910(kVTVideoDecoderUnsupportedDataFormatErr)
private func initVideoSession() throws {
formatDescription = nil
var _formatDescription : CMFormatDescription?
let parameterSetPointers : [UnsafePointer<UInt8>] = [ pps!.buffer.baseAddress, sps!.buffer.baseAddress ]
let parameterSetSizes : [Int] = [ pps!.buffer.count, sps!.buffer.count ]
var status = CMVideoFormatDescriptionCreateFromH264ParameterSets(kCFAllocatorDefault, 2, parameterSetPointers, parameterSetSizes, 4, &_formatDescription);
if status != noErr {
throw H264Error.CMVideoFormatDescriptionCreateFromH264ParameterSets(status)
}
formatDescription = _formatDescription!
if videoSession != nil {
VTDecompressionSessionInvalidate(videoSession)
videoSession = nil
}
var videoSessionM : VTDecompressionSession?
let decoderParameters = NSMutableDictionary()
let destinationPixelBufferAttributes = NSMutableDictionary()
destinationPixelBufferAttributes.setValue(NSNumber(unsignedInt: kCVPixelFormatType_32BGRA), forKey: kCVPixelBufferPixelFormatTypeKey as String)
var outputCallback = VTDecompressionOutputCallbackRecord()
outputCallback.decompressionOutputCallback = callback
outputCallback.decompressionOutputRefCon = UnsafeMutablePointer<Void>(unsafeAddressOf(self))
status = VTDecompressionSessionCreate(nil, formatDescription, decoderParameters, destinationPixelBufferAttributes, &outputCallback, &videoSessionM)
if status != noErr {
throw H264Error.VTDecompressionSessionCreate(status)
}
self.videoSession = videoSessionM;
}
这里pps
和sps
是含有PPS和SPS帧缓冲器。
如上所述,奇怪的是,它在模拟器上完全正常工作,但不是在实际设备上。两者都在iOS 9.3上,我正在模拟与设备相同的硬件。
什么可能导致此错误?
而且,更一般地说,我可以在哪里找到VideoToolbox的API参考和错误文档?真正无法在Apple网站上找到任何相关内容。