我有桌面服务器,它是编码帧。我的 iOS 客户端正在连接到此客户端并使用NWConnection
以下方式接收数据:
NWListener 使用 .udp 参数有时会导致奇怪的日志
实际问题:
没有错误的设备(视频正常):iPhone 11 Pro iOS 13.5.1、iPhone Xs Max iOS 13.5.1
带有 -12909 的设备(未显示):iPhone 11 iOS 13.5.1、iPhone 7+ iOS 12.4.1
我的问题是:
什么可能导致OSStatus - kVTVideoDecoderBadDataErr -12909
。这是否意味着我丢失了很多数据,或者某些视频字节被重新排序或其他什么?
完整代码示例: https ://github.com/ChoadPet/H.264-Decoding
我通过此回调接收❌ Failed
状态,-12909 OSStatus
并且imageBuffer == nil
没有显示任何框架:
var record = VTDecompressionOutputCallbackRecord(
decompressionOutputCallback: callback,
decompressionOutputRefCon: Unmanaged.passUnretained(self).toOpaque()
)
...
private var callback: VTDecompressionOutputCallback = {
(decompressionOutputRefCon: UnsafeMutableRawPointer?,
sourceFrameRefCon: UnsafeMutableRawPointer?, status: OSStatus,
infoFlags: VTDecodeInfoFlags, imageBuffer: CVPixelBuffer?,
presentationTimeStamp: CMTime, duration: CMTime) in
if imageBuffer != nil && status == noErr {
NSLog("===== ✅ Image successfully decompressed =====")
} else {
NSLog("===== ❌ Failed to decompress, OSStatus: \(status), imageBuffer: \(String(describing: imageBuffer)) =====")
}
}
展示部分:
var flagOut: VTDecodeInfoFlags = []
let status = VTDecompressionSessionDecodeFrame(session,
sampleBuffer: sampleBuffer,
flags: [._EnableAsynchronousDecompression],
frameRefcon: nil,
infoFlagsOut: &flagOut)
videoLayer?.enqueue(sampleBuffer) // videoLayer - AVSampleBufferDisplayLayer
谢谢你。