Re: Fail to use Vitamio Android ffmpeg library: cannot locate '__aeabi_llsl'

465 views
Skip to first unread message

Linda Li

unread,
Apr 19, 2013, 5:45:52 PM4/19/13
to andro...@googlegroups.com
I think I figure it out.
For some reason, lib*.a can not be used here.
(Although I found a version by churnalbs used it, I guessed he used a different ndk, possibly ndk5rc)

So I compile *.o to libffmpeg.so, and use PREBUILT_SHARED_LIBRARY in Android.mk (for how to use it, see ndk doc)

include $(CLEAR_VARS)
LOCAL_MODULE := ffmpeg_VITAMIO_prebuilt
LOCAL_SRC_FILES := libffmpeg_VITAMIO.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

LOCAL_SHARED_LIBRARIES := ffmpeg_VITAMIO_prebuilt

And also I need to add the below in java.
System.loadLibrary("ffmpeg_VITAMIO_prebuilt");

Now, compiling works.
However, new error:
Whenever the ndk native function is called (I use a button to click to run the native function), the app crashes.

The log is:

04-19 15:18:34.836: I/DEBUG(67): scr 20000012

04-19 15:18:34.906: I/DEBUG(67): #00 pc 000190d8 /system/lib/libc.so

04-19 15:18:34.906: I/DEBUG(67): #01 pc 0001938e /system/lib/libc.so

04-19 15:18:34.906: I/DEBUG(67): #02 pc 0000937a /data/data/com.example.andrvideoprocess/lib/libnative_sample.so


/data/data/com.example.andrvideoprocess/lib/libnative_sample.so

04-19 15:18:34.916: I/DEBUG(67): beb0fddc 00000017

04-19 15:18:34.916: I/DEBUG(67): beb0fde0 8056ab24

04-19 15:18:34.916: I/DEBUG(67): beb0fde4 beb112ec

04-19 15:18:34.916: I/DEBUG(67): beb0fde8 ffffffff

04-19 15:18:34.916: I/DEBUG(67): beb0fdec 8050937d /data/data/com.example.andrvideoprocess/lib/libnative_sample.so

04-19 15:18:35.116: I/BootReceiver(130): Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE)

04-19 15:18:35.136: I/ActivityManager(130): Process com.example.andrvideoprocess (pid 30386) has died.

04-19 15:18:35.136: I/WindowManager(130): WIN DEATH: Window{40911bd8 com.example.andrvideoprocess/com.example.andrvideoprocess.MainActivity paused=false}

04-19 15:18:35.146: E/ActivityManager(130): fail to set top app changed!



OK, I then use arm-linux-androideabi-addr2line to check what is wrong:

arm-linux-androideabi-addr2line  -C -f -e /obj/local/armeabi-v7a/libnative_sample.so  0000937a

The output is:

BFD: Dwarf Error: mangled line number section.
Java_com_example_jniInterface_jniInterfaceJava_flattenVideoFile
unwind-c.c:0

I am totally defeated. Don't know where to fix it.



 

Fabien R

unread,
Apr 21, 2013, 5:32:18 AM4/21/13
to andro...@googlegroups.com
On 19/04/2013 23:45, Linda Li wrote:
> The output is: BFD: Dwarf Error: mangled line number section.
>> Java_com_example_jniInterface_jniInterfaceJava_flattenVideoFile
>> unwind-c.c:0
>>
Can you show the corresponding prototype declaration in your source code ?
Did you use javah to generate it ?
-
Fabien

Linda Li

unread,
Apr 22, 2013, 4:58:51 PM4/22/13
to andro...@googlegroups.com
In Java, it is:
public native static void flattenVideoFile();


In JNI, jni_part.cpp
JNIEXPORT void JNICALL Java_com_example_jniInterface_jniInterfaceJava_flattenVideoFile(
        JNIEnv* env, jobject)


I use Eclipse,
#include <jni.h>

#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>

#include </usr/src/android-ndk-r8b/platforms/android-14/arch-arm/usr/include/android/bitmap.h>

#include <iostream>
#include <sstream>
#include <time.h>
#include <stdio.h>
#include <unistd.h>

#ifndef INT64_C
#define INT64_C(c) (c ## LL)
#define UINT64_C(c) (c ## ULL)
#endif

extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavutil/opt.h>
}

using namespace std;
using namespace cv;

Fabien R

unread,
Apr 23, 2013, 3:01:37 AM4/23/13
to andro...@googlegroups.com
On 22/04/2013 22:58, Linda Li wrote:
> In Java, it is:
> public native static void flattenVideoFile();
>
What is the package name including this code ?
-
Fabien

Linda Li

unread,
Apr 25, 2013, 11:57:54 PM4/25/13
to andro...@googlegroups.com

Now I give my further investigation.
It is hard to tell what is going on with the DEBUG information.
I also try to use debug as native android app, it does not work. The break points do not work.

I then use android native log to track the program.

The snippet is below:
if ((ret=av_read_frame(inVStruct.inFormatContext, & inVStruct.inPacket)) < 0)
{
LOGI("fail: av_read_frame ");
break;
}

if (inVStruct.inPacket.stream_index == inVStruct.video_stream_index) {
....
}


only if inVStruct.inPacket.stream_index == inVStruct.video_stream_index, the frame read is successful.
However, it reads 612 frames and never succeeds.

Here is log information:

04-25 22:40:22.533: I/native-activity(32757): av_read_frame_count: 608
04-25 22:40:22.533: I/native-activity(32757): inVStruct.inPacket.stream_index= 4624496:
04-25 22:40:22.533: I/native-activity(32757): inVStruct.video_stream_index= 0:
04-25 22:40:22.533: I/native-activity(32757): av_read_frame_count: 609
04-25 22:40:22.533: I/native-activity(32757): inVStruct.inPacket.stream_index= 4624808:
04-25 22:40:22.533: I/native-activity(32757): inVStruct.video_stream_index= 0:
04-25 22:40:22.533: I/native-activity(32757): av_read_frame_count: 610
04-25 22:40:22.533: I/native-activity(32757): inVStruct.inPacket.stream_index= 4625112:
04-25 22:40:22.533: I/native-activity(32757): inVStruct.video_stream_index= 0:
04-25 22:40:22.533: I/native-activity(32757): av_read_frame_count: 611
04-25 22:40:22.533: I/native-activity(32757): inVStruct.inPacket.stream_index= 4627112:
04-25 22:40:22.533: I/native-activity(32757): inVStruct.video_stream_index= 0:
04-25 22:40:22.533: I/native-activity(32757): av_read_frame_count: 612

The AVPacket's steram_index is 4,000,000's something!
Why?
Again, the c++ code works well as an independent file. And inVStruct.inPacket.stream_index is either 0 or 1.

Linda Li

unread,
Apr 26, 2013, 12:00:16 AM4/26/13
to andro...@googlegroups.com
It should be irrelevant.
package com.example.ffmpegjni

Fabien R

unread,
Apr 26, 2013, 3:12:06 AM4/26/13
to andro...@googlegroups.com
On 26/04/2013 06:00, Linda Li wrote:
> It should be irrelevant.
> package com.example.ffmpegjni
The prototype you gave was:

In JNI, jni_part.cpp
JNIEXPORT void JNICALL
Java_com_example_jniInterface_jniInterfaceJava_flattenVideoFile(
JNIEnv* env, jobject)

It means that your java package was:
com.example.jniInterface.jniInterfaceJava

-
Fabien


Linda Li

unread,
May 2, 2013, 3:27:10 PM5/2/13
to andro...@googlegroups.com
You are right. I messed up with different versions of similar projects.
it should be: package com.example.jniInterface;
Anyway, since the app compiles, this part should be not an issue.
Reply all
Reply to author
Forward
0 new messages