Stagefright, a media playback engine issue
I have a problem in extracting meta information for the mp2 and MPEG.bwf files in some Android Devices.
Whenever i try to extract meta information of the files the APP crashes.
I have used MediaExtractor class to extract the meta data (for eg bitrate, mime, duration, channel count, sample rate etc) of the files.
But it gets failed for mp2 amd MPEG.bwf format files on specific devices eg
Samsung S6, Android 7.0
Samsung Galaxy J3 (2016), Android 5.1.1
Samsung TAB A6, Android 5.1.1
Samsung Galaxy S5, Android 6.0.1
Redmi Note 5
Few devices could able to extract the meta information successfully.
Пройдя немного глубже, я понял, что MediaExtractor использует класс NUMediaExtractor, который включен в библиотеку libstagefright.
Вот трассировка стека:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.package.app, PID: 25198
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app/com.app.Activity}: java.lang.IllegalArgumentException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: java.lang.IllegalArgumentException
at android.media.MediaExtractor.getTrackFormatNative(Native Method)
at android.media.MediaExtractor.getTrackFormat(MediaExtractor.java:446)
at app.Activity.readMethaInformation(Activity.java:491)
at app.Activity.onCreate(Activity.java:157)
at android.app.Activity.performCreate(Activity.java:6942)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880)
Может кто-нибудь знает, почему эта проблема извлечения libstagefright в конкретных устройствах? Поскольку эта библиотека специфична для конкретной ОС, ее можно заменить? Есть ли альтернатива этому?