我有一个应用程序,其中我解码来自ip camera的视频帧,但方法avcodec_decode_video2(m_pCodecCtx,m_pFrame,& consume_bytes,& avpkt);目前在avcodec.h中生成bad_access,我无法弄清楚出了什么问题.
这个应用程序与旧的库FFMpeg工作正常,但通过苹果政策,为了发布应用程序支持arm64,所以我更新了我的库以支持arm64,之后发生了这个问题.
这是截图
虽然bad_access应用程序正在生成以下日志:
[h264 @ 0x1071400] sps_id 12 out of range [h264 @ 0x1071400] pps_id 417 out of range [h264 @ 0x1071400] sps_id 3 out of range [h264 @ 0x1071400] sps_id 32 out of range [h264 @ 0x1071400] sps_id 6 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 32 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 3 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 32 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 2 out of range [h264 @ 0x1071400] sps_id 2 out of range [h264 @ 0x1071400] sps_id 2 out of range [h264 @ 0x1071400] sps_id 2 out of range [h264 @ 0x1071400] sps_id 2 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 32 out of range [h264 @ 0x1071400] sps_id 3 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] sps_id 2 out of range [h264 @ 0x1071400] sps_id 2 out of range [h264 @ 0x1071400] sps_id 2 out of range [h264 @ 0x1071400] sps_id 2 out of range [h264 @ 0x1071400] sps_id 2 out of range [h264 @ 0x1071400] pps_id 418 out of range [h264 @ 0x1071400] Partitioned H.264 support is incomplete [h264 @ 0x1071400] sps_id 6 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 1 out of range [h264 @ 0x1071400] non-existing PPS 3 referenced [h264 @ 0x1071400] decode_slice_header error [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] slice type 10 too large at 0 0 [h264 @ 0x1071400] decode_slice_header error [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] non-existing PPS 2 referenced [h264 @ 0x1071400] decode_slice_header error [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] slice type 29 too large at 0 0 [h264 @ 0x1071400] decode_slice_header error [h264 @ 0x1071400] sps_id 2 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] sps_id 0 out of range [h264 @ 0x1071400] slice type 32 too large at 0 0 [h264 @ 0x1071400] decode_slice_header error [h264 @ 0x1071400] slice type 32 too large at 0 0 [h264 @ 0x1071400] decode_slice_header error [h264 @ 0x1071400] slice type 32 too large at 0 0 [h264 @ 0x1071400] decode_slice_header error [h264 @ 0x1071400] slice type 32 too large at 0 0
完整的错误日志:https://drive.google.com/file/d/0B-Nh7ci6wLX0OVlxaXV4aGpJems/view?usp=sharing
崩溃日志:http://crashes.to/s/6765d63b540
注意:如果您还有其他需要,请发表评论.
解决方法
我解决了我的问题,问题在于折旧方法avcodec_alloc_frame().
m_pCodecCtx = avcodec_alloc_context3(m_pCodec); if(m_pCodecCtx == NULL) { NSLog(@"if(pCodecCtx == NULL)\n"); return ; } [g_Lock lock]; //¥Úø™codec°£»Áπ˚¥Úø™≥…𶵃ª∞£¨∑÷≈‰AVFrame£ if(avcodec_open2(m_pCodecCtx,m_pCodec,NULL) >= 0) { m_pFrame = avcodec_alloc_frame(); /* Allocate video frame */ } [g_Lock unlock];
然后我最终更新了我的头文件,之后我得到了关于方法avcodec_alloc_frame()折旧的警告,所以,我将它更新为av_frame_alloc(),它运行完美!