Open pcwalton opened 9 years ago
Stagefright is non-public api and api and abi change between devices and android versions. The safe way would be to use android.media.MediaCodec. take a look at what is done in the gstreamer androidmedia plugin to access that from outside java via jni.
Yes, in the Gecko code we had a lot of problems with differences in Stagefright APIs amongst phones. This was mostly related to wanting to use our own network code instead of Android's. The various device vendors would customize stagefright and have different vtable layouts for the class we derived from to do this.
A workaround was in bug 860599 where we created an internal HTTP server that served data from Gecko that the Android network code connected too. This solved a lot of crashes.
In bug 1014614 we moved to MediaCodec for newer Android releases which is a better approach as the API is public.
Check here for the GStreamer plugin using the MediaCodec API: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/sys/androidmedia
Currently, your only option to play H.264 and AAC on Android is FFmpeg. But essentially all Android devices support H.264 via
libstagefright
. We should bind to it. This would also let us use the hardware decoders where available.