废话少说,直接上结果:
VTDecompressionSessionCreate: -12911
原因总结:
创建session时,就是VTDecompressionSessionCreate函数:
sps结尾不对时,session创建成功,解码时报-12911异常;
sps中间数据不对时,创建session时报-12911异常,但是很快就报异常。
报12710时:sps pps给的不对。
如果videoformatdescr为空,解码VTDecompressionSessionDecodeFrame时就会报错: -12902(或-5),
也就是说如果没有调用 CMVideoFormatDescriptionCreateFromH264ParameterSets,就会报错-12902;
如果解码报错-12911时,是因为丢包了,包数据不完整或者包数据错误。
解码函数:
OSStatus decodeStatus = VTDecompressionSessionDecodeFrame(decompressSessionRef,
sampleBuffer, flags, &outputPixelBuffer, &flagOut);
avformat_open_input返回异常AVERROR_INVALIDDATA:
原因:未找到解码格式,办法:用指定解码器
is->iformat=av_find_input_format("h264");
err = avformat_open_input(&ic, is->filename, is->iformat, NULL);
以上属于个人亲测,会不断持续更新,也欢迎拍砖!