我得到錯誤-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網站上找到任何相關內容。