2016-08-03 49 views
1

我得到錯誤-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; 
} 

這裏ppssps是含有PPS和SPS幀緩衝器。

如上所述,奇怪的是,它在模擬器上完全正常工作,但不是在實際設備上。兩者都在iOS 9.3上,我正在模擬與設備相同的硬​​件。

什麼可能導致此錯誤?

而且,更一般地說,我可以在哪裏找到VideoToolbox的API參考和錯誤文檔?真正無法在Apple網站上找到任何相關內容。

回答

2

答案的結果是流分辨率大於1920x1080,這是iPad支持的最大值。這與支持超出該分辨率的模擬器明顯不同(也許它只是使用Mac VideoToolbox庫而不是模擬iOS的)。

將流減少爲比1080p更少的像素解決了問題。

這是來自蘋果員工中的一員,其向我指出了正確的方向響應:https://forums.developer.apple.com/thread/11637

至於正確VideoToolbox參考 - 仍然一無所獲的價值存在,這是一個巨大的劣勢。人們不禁要問,這些輔導作者是如何得到他們的信息的。

編輯: iOS 10現在似乎支持大於1080p的數據流。