DJI-Mobile-SDK-Tutorials / Android-VideoStreamDecodingSample

This sample project demonstrates how to use FFmpeg for video frame parsing and to use MediaCodec for hardware decoding on DJI Products.
MIT License
169 stars 80 forks source link

Building for Android API <21 #9

Closed pisarik closed 7 years ago

pisarik commented 7 years ago

Hello!

I successfully builded this sample. And it works fine on API >=21. Then this solution was embedded in my project. I replaced all neccessary methods in dji_video_jni.c with my packages. And my project working fine on API >= 21. When I trying to run it on my phone with Android API level 19, then i getting the following error:

FATAL EXCEPTION: main
Process: uiip.dji.pcapi.com, PID: 8922
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "atof" referenced by "libffmpeg.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:364)
at java.lang.System.loadLibrary(System.java:526)
at uiip.dji.pcapi.com.media.NativeHelper.<clinit>(NativeHelper.java:65)
at uiip.dji.pcapi.com.MainActivity.onCreate(MainActivity.java:21)
at android.app.Activity.performCreate(Activity.java:5275)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2166)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2252)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)

Foremost, I tried to set targetSdkVersion to 19 in Build.Gradle (Module: app) and add the line APP_PLATFORM := android-19 in libs/Application.mk and rebuild jni libs. But this didn't help.

Then I found this post. And decided to try to change compileSdkVersion to 19, I deleted all api-specific stuff as styles appCompat and also I made the method decodeFrame() in DJIVideoStreamDecoder empty (just as mock), because it contains method mediacodec.reset(), which is 21 level api. So it didn't help too.

Then I tried to compile with different older ndk versions (9b, 10e, 11c), and different Android Plugin Version (2.1.3). It didn't help.

Is it problem in libffmpeg.so? How should i deal with it?

pisarik commented 7 years ago

Sorry, didn't notice the same issue.