gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 17:48:46 26 4
gpt4 key购买 nike

我正在编写一个 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com