Ticket #1037 (closed defect: needs_more_info)

Opened 16 months ago

Last modified 14 months ago

avcodec_alloc_context3 and avcodec_alloc_frame causes app to exit on Android 3.2

Reported by: pawg Owned by:
Priority: important Component: avcodec
Version: 0.10 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I am trying to decode H264 video on Samsung Galaxy Tab 10.1 using Android 3.2, kernel version 2.6.36.3. I am using FFmpeg software decoder. When I try to allocate context or frame using avcodec_alloc_context3 or avcodec_alloc_frame, my app freezes and after about 5 seconds exits without any error or log captured on Logcat.

Code which fails:

AVCodec* myCodec;
AVCodecContext* myContext;
AVFrame* myFrame;

myCodec = avcodec_find_decoder(CODEC_ID_H264);
myContext = avcodec_alloc_context3(myCodec);
myFrame = avcodec_alloc_frame();

Attachments

output.txt Download (6.7 KB) - added by pawg 16 months ago.

Change History

comment:1 Changed 16 months ago by cehoyos

The code you provide does not look as if it would compile, and please add backtrace if FFmpeg really freezes.

Changed 16 months ago by pawg

comment:2 follow-up: ↓ 3 Changed 16 months ago by pawg

My code compiles fine using latest android ndk. Not sure what you mean by backtrace, but I added output from android system log. I may add that on android 2.x there are no problems with my app.

comment:3 in reply to: ↑ 2 Changed 16 months ago by cehoyos

Replying to pawg:

My code compiles fine using latest android ndk.

Which code? You only posted a small part that will not compile.

Not sure what you mean by backtrace

Please see http://ffmpeg.org/bugreports.html

comment:4 Changed 16 months ago by pawg

My codec initialization function is the following:

/*
AVCodec* myCodec;
AVCodecContext* myContext;
AVFrame* myFrame;
**These variables are defined at class level - put here only for information*/

init(){

avcodec_init();
avcodec_register_all();
myCodec = NULL;

myCodec = avcodec_find_decoder(CODEC_ID_H264);
if (!myCodec) {

log.error("codec CODEC_ID_H264 not found");
return;

}

/*this function causes the application to exit, the same goes for avcodec_alloc_frame if I comment this line*/
myContext = avcodec_alloc_context3(myCodec);

if (myCodec->capabilities & CODEC_CAP_TRUNCATED)

myContext->flags |= CODEC_FLAG_TRUNCATED;

myContext->flags2 |= (CODEC_FLAG2_CHUNKS | CODEC_FLAG_TRUNCATED);

if (avcodec_open(myContext, myCodec) < 0) {

log.error("Could not open codec");
return;

}
myFrame = avcodec_alloc_frame();
log.information("initialized decoder");

}

Last edited 16 months ago by pawg (previous) (diff)

comment:5 Changed 16 months ago by cehoyos

I still believe that a C (or C++) program that has "AVCodec* myCodec;" as first line will not compile. Don't you think so?

Please consider providing gdb output, it will show where the problem you see occurs.

comment:6 Changed 16 months ago by pawg

I made an update to my source code - the variables were only defined as reference and the function is part of a bigger class. The provided output.txt from dump gives info that a possible problem is with av_opt_set_defaults2 function.

comment:7 Changed 15 months ago by michael

output.txt says SIGILL which very likely means you used the wrong compiler options to compile some of the code.

comment:8 Changed 15 months ago by cehoyos

  • Status changed from new to closed
  • Resolution set to needs_more_info

Please reopen if you can at least provide gdb output, see http://ffmpeg.org/bugreports.html

comment:9 Changed 14 months ago by pawg

Ticket can be left as closed with "no issue" status - ndk compiler needed to have additional flags for Tegra 2 cpu

Note: See TracTickets for help on using tickets.