c - 打开视频流时 Malloc 检查失败

标签 c ffmpeg blackberry-10 x264 qnx

我正在编写一个 BlackBerry 10 应用程序,它使用 ffmpeg 和 libx264 解码 H264 视频流(来自 Parrot AR Drone)。这些库都是针对 BlackBerry QNX 编译的。

这是我的代码:

av_register_all();
avcodec_register_all();
avformat_network_init();

printf("AV setup complete\n");

const char* drone_addr = "http://192.168.1.1:5555";
AVFormatContext* pFormatCtx = NULL;
AVInputFormat* pInputFormat = av_find_input_format("H264");

printf("Opening video feed from drone\n");

//THIS LINE FAILS 
int result = avformat_open_input(&pFormatCtx, drone_addr, pInputFormat, NULL); 

最后一行失败并出现错误:

Malloc Check Failed: :../../dlist.c:1168

如何修复此错误或进一步调试它?

更新:仅当我向 avformat_open_input 提供 pInputFormat 时,才会发生错误。如果我提供 NULL,我不会收到错误。但对于我的应用程序,我必须提供此参数,因为 ffmpeg 无法单独从源确定视频格式。

最佳答案

尝试:

AVFormatContext* pFormatCtx = avformat_alloc_context();

然后

avformat_free_context(pFormatCtx);

关于c - 打开视频流时 Malloc 检查失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18384687/

相关文章:

augmented-reality - 为 blackberry 10 创建增强现实应用程序

c - 意外的文件结束错误,寻找常见原因但找不到任何

c - 递归关系: find bit strings of length seven contain two consecutive 0 in C

ffmpeg - 从 udp 流中捕获屏幕截图的最佳方法是什么?

ffmpeg - 如何使用 ffmpeg API 转换音频文件?

ffmpeg - 如何在 C 中解码来自这个无名的几乎 UVC 灰度相机的流

c - 可疑的静态链接可执行文件大小

c - Fork() 父级和子级

arrays - 如何消除使用指针的二维数组声明中的错误?

blackberry-simulator - 在模拟器中启用屏幕键盘