Question

I'm writing a BlackBerry 10 application which decodes an H264 video stream (from a Parrot AR Drone) using ffmpeg and libx264. These libraries have both been compiled for BlackBerry QNX.

Here's my code:

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); 

The last line fails with the error:

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

How can I fix this error or debug it further?

Update: The error only occurs when I supply pInputFormat to avformat_open_input. If I supply NULL I don't get an error. But for my app I must supply this parameter since it is not possible for ffmpeg to determine the video format from the feed alone.

Was it helpful?

Solution 2

I fixed this by adding the --enable-memalign-hack to the configure flags for ffmpeg. I narrowed the problem down to: libavutil/mem.c which includes some preprocessor defines for various memory handlers which led me to that configure flag.

Not sure if this is the right fix, or whether I'm setting myself up for problems later. Looks like someone else has had similar problems here: http://ffmpeg.org/pipermail/ffmpeg-devel/2013-February/138634.html

OTHER TIPS

Try:

AVFormatContext* pFormatCtx = avformat_alloc_context();

Then

avformat_free_context(pFormatCtx);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top