【问题标题】:Malloc Check Failed when opening video stream打开视频流时 Malloc 检查失败
【发布时间】:2013-08-22 15:24:56
【问题描述】:

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

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

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

【问题讨论】:

  • 您是否尝试使用“h264”是小型大写字母? ffmpeg -formats 列出了 h264,众所周知它比较挑剔。
  • 谢谢,好主意,不幸的是我仍然遇到同样的错误。 pInputFormat 不为空,所以我假设它已正确初始化。
  • 好吧,我想你必须找到一种方法来从错误中获得完整的回溯。您是否有 GDB 或同等软件可供您使用?
  • 我有 gdb。只是想弄清楚如何使用调试符号编译 x264 和 ffmpeg。

标签: c ffmpeg blackberry-10 x264 qnx


【解决方案1】:

试试:

AVFormatContext* pFormatCtx = avformat_alloc_context();

然后

avformat_free_context(pFormatCtx);

【讨论】:

  • 感谢您的建议。不幸的是,这没有用。根据文档 (ffmpeg.org/doxygen/trunk/…),您可以为 AVFormatContextavformat_open_input 指定一个 NULL 指针。
【解决方案2】:

我通过将--enable-memalign-hack 添加到 ffmpeg 的配置标志来解决此问题。我将问题缩小到:libavutil/mem.c,其中包括为各种内存处理程序定义的一些预处理器,这些处理程序使我找到了该配置标志。

不确定这是否是正确的解决方法,或者我是否要为以后的问题做好准备。看起来有人在这里遇到过类似的问题:http://ffmpeg.org/pipermail/ffmpeg-devel/2013-February/138634.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-01-01
    • 1970-01-01
    • 2018-04-05
    • 1970-01-01
    • 2012-02-10
    • 2011-09-13
    • 1970-01-01
    相关资源
    最近更新 更多