[Libav-user] android crash with armeabi-v7a + tegra3

Michael Zucchi notzed at gmail.com
Fri Jun 22 05:30:23 CEST 2012


Morning,

I've been working on an android port of my jjmpeg library (a GPLv3 java 
binding for FFmpeg) and i've hit a snag when optimising for newer arm 
devices: for a given video I get a reliable but unpredictable bus error 
whenever i build for the armeabi-v7a platform.  I've included details 
below.  I've seen it crash in other decoders as well, but usually at one 
of those low-level asm lines.

It happens with 0.10.4 or 0.11.1, but i haven't tried HEAD yet.  It 
usually happens after about 5 minutes of video playing, but can vary 
from 1-20, so it's a bit of a pain to debug.  I've tried various player 
designs from simple single-threaded to many-threaded ones, opengles or 
not, etc.

I don't see such problems if i use just plain armeabi (armv5 i guess), 
or on amd64/x86 cpus.  I still get the same problem if i disable neon 
and/or vfp as well, it just seems to be related to armeabi-v7a on the 
tablet i'm using.

The device is a tegra 3 tablet (asus transformer prime w/ latest vendor 
firmware).  It doesn't appear to crash in the emulator, but that is only 
a single-cpu so isn't hitting the same code-paths.  It's the only device 
I have access to at the moment but i'll probably get some cheap chinese 
arm device(s) to play with soon.

I've run out of ideas at my end, but if anyone has any pointers?

If I can't get anywhere I will just default to armeabi for development 
and put it down to a shitty piece of hardware, so it's not a 
show-stopper for me, just a pita and a big waste of time.

Regards,
  Michael Z

PS I tried compiling with no optimisation but the build fails if i do 
that, so the bt is a bit off.

Program received signal SIGBUS, Bus error.
[Switching to Thread 1495]
mpeg4_decode_block (s=0x1f97f40, block=0x20b0870, n=18, coded=<value 
optimized out>, intra=292,
     rvlc=1536293248)
     at 
/home/notzed/svn/jjmpeg-0.10/jjmpeg-core/jni/ffmpeg-0.10/libavutil/arm/intreadwrite.h:54
54          __asm__ ("ldr  %0, %1" : "=r"(v) : "m"(*q));
(gdb) where
#0  mpeg4_decode_block (s=0x1f97f40, block=0x20b0870, n=18, coded=<value 
optimized out>, intra=292,
     rvlc=1536293248)
     at 
/home/notzed/svn/jjmpeg-0.10/jjmpeg-core/jni/ffmpeg-0.10/libavutil/arm/intreadwrite.h:54
#1  0x5b91f980 in mpeg4_decode_mb (s=0x1f97f40, block=0x20b0770)
     at 
/home/notzed/svn/jjmpeg-0.10/jjmpeg-core/jni/ffmpeg-0.10/libavcodec/mpeg4videodec.c:1477
#2  0x5b79820c in decode_slice (s=0x1f97f40)
     at 
/home/notzed/svn/jjmpeg-0.10/jjmpeg-core/jni/ffmpeg-0.10/libavcodec/h263dec.c:217
#3  0x5b799704 in ff_h263_decode_frame (avctx=0x1f66570, data=<value 
optimized out>,
     data_size=<value optimized out>, avpkt=<value optimized out>)
     at 
/home/notzed/svn/jjmpeg-0.10/jjmpeg-core/jni/ffmpeg-0.10/libavcodec/h263dec.c:675
#4  0x5b99bd84 in frame_worker_thread (arg=<value optimized out>)
     at 
/home/notzed/svn/jjmpeg-0.10/jjmpeg-core/jni/ffmpeg-0.10/libavcodec/pthread.c:381
#5  0x40073e30 in __thread_entry ()
    from 
/home/notzed/svn/jjmpeg-0.10/jjmpeg-android/obj/local/armeabi-v7a/libc.so
#6  0x40073984 in pthread_create ()
    from 
/home/notzed/svn/jjmpeg-0.10/jjmpeg-android/obj/local/armeabi-v7a/libc.so
#7  0x00000000 in ?? ()
(gdb) info registers
r0             0x1      1
r1             0x7      7
r2             0x12     18
r3             0xe97f   59775
r4             0x4      4
r5             0x1f97f40        33128256
r6             0x20b0870        34277488
r7             0x5bf1a72c       1542563628
r8             0x29ec   10732
r9             0x215b710        34977552
r10            0x1f980b0        33128624
r11            0x20acd58        34262360
r12            0xa      10
sp             0x5ceb6cb8       0x5ceb6cb8
lr             0x5b91f980       1536293248
pc             0x5b91df5c       0x5b91df5c <mpeg4_decode_block+344>
fps            0x0      0
cpsr           0x80000010       2147483664
(gdb) disassemble
Dump of assembler code for function mpeg4_decode_block:
...
0x5b91df34 <mpeg4_decode_block+304>:    strne   r2, [sp, #28]
0x5b91df38 <mpeg4_decode_block+308>:    strne   r3, [sp, #20]
0x5b91df3c <mpeg4_decode_block+312>:    movw    r3, #10740      ; 0x29f4
0x5b91df40 <mpeg4_decode_block+316>:    movw    r8, #10732      ; 0x29ec
0x5b91df44 <mpeg4_decode_block+320>:    movw    r12, #63488     ; 0xf800
0x5b91df48 <mpeg4_decode_block+324>:    ldr     r3, [r5, r3]
0x5b91df4c <mpeg4_decode_block+328>:    movt    r12, #65535     ; 0xffff

0x5b91df50 <mpeg4_decode_block+332>:    str     r12, [sp, #40]
0x5b91df54 <mpeg4_decode_block+336>:    and     r1, r3, #7      ; 0x7
0x5b91df58 <mpeg4_decode_block+340>:    ldr     r9, [r5, r8]
0x5b91df5c <mpeg4_decode_block+344>:    ldr     r2, [r9, r3, lsr #3]
0x5b91df60 <mpeg4_decode_block+348>:    rev     r2, r2
0x5b91df64 <mpeg4_decode_block+352>:    mov     r1, r2, lsl r1
0x5b91df68 <mpeg4_decode_block+356>:    mov     r2, r1, lsr #23
0x5b91df6c <mpeg4_decode_block+360>:    mov     r2, r2, lsl #2

(gdb) x /10x 0x1f97f40 + 0x29ec
0x1f9a92c:      0x0215b710      0x02160a22      0x0000e967      0x00029890
0x1f9a93c:      0x00029898      0x00000000      0x00000000      0x00000000
0x1f9a94c:      0x00000000      0x00000001
(gdb) x /10x 0x215b710 + (0xe97f >> 3)
0x215d43f:      0xa20f047d      0x08142840      0xdeb9354c      0xb24ba7f7
0x215d44f:      0xb6d71947      0xf7bedeb5      0x9f318e57      0xfa883a97
0x215d45f:      0xf45edcda      0xd02a0f51

Build config

#define FFMPEG_CONFIGURATION 
"--prefix=/home/notzed/svn/jjmpeg-0.10/jjmpeg-android/jni/build/armeabi-v7a 
--cross-prefix=/usr/local/android-ndk-r7c/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- 
--enable-cross-compile --target-os=linux 
--extra-cflags='-I/usr/local/android-ndk-r7c/platforms/android-8/arch-arm//usr/include 
-mfloat-abi=softfp -mfpu=neon -marm -march=armv7-a -g -O0 
--sysroot=/usr/local/android-ndk-r7c/platforms/android-8/arch-arm/' 
--extra-ldflags='-L/usr/local/android-ndk-r7c/platforms/android-8/arch-arm//usr/lib 
--sysroot=/usr/local/android-ndk-r7c/platforms/android-8/arch-arm/' 
--arch=arm --disable-stripping --enable-debug --assert-level=2 
--disable-shared --enable-static --disable-symver --enable-pthreads 
--enable-gpl --enable-version3 --disable-doc --disable-ffmpeg 
--disable-ffplay --disable-ffprobe --disable-ffserver --disable-avdevice 
--disable-avfilter --disable-postproc"

#define ARCH_ARM 1
#define HAVE_ARMV5TE 1
#define HAVE_ARMV6 1
#define HAVE_ARMV6T2 1
#define HAVE_ARMVFP 1
#define HAVE_NEON 1
#define HAVE_VFPV3 1
#define HAVE_FAST_UNALIGNED 1
#define HAVE_PTHREADS 1




More information about the Libav-user mailing list