How to add gstreamer and selected plugins to AOSP module?

Hi,
Trying to add previously downloaded gstreamer static libs(gstreamer-1.0-android-universal-1.14.5 need older version) to my AOSP audio module in Anroid.bp like this:

cc_library {
    name: "mygstreamer_pipeline",
    vendor: true,
    defaults: ["cpp_library_defaults"],
    srcs: [
        "default/mysrc/*.cpp"
    ],
    export_include_dirs: ["default/myincludes/include"],
    static_libs: [
        "libgstreamer",
        "libgmodule",
        "libgobject",
        "libffi",
        "libglib",
        "libintl",
        "libiconv",
        "libgstrtp",
    ],
    shared_libs: ["liblog",],
    cflags: [
        "-ggdb",
    ],

Example of one of the static libs above

cc_prebuilt_library_static {
    name: "libgobject",
    strip: {
        none: true,
    },
    vendor: true,
    compile_multilib: "both",
    target: {
        android_x86_64: {
        srcs: ["prebuilt/gstreamer-1.0-android-universal-1.14.5/x86_64/lib/libgobject-2.0.a"],
        },
        android_x86: {
            srcs: ["prebuilt/gstreamer-1.0-android-universal-1.14.5/x86/lib/libgobject-2.0.a"],
        }
    }
}

Everything compiles but when code trying to create whole pipeline the only element that is created is pipeline(gst_pipeline_new) but no plugins(like appsrc, rtpbin etc…).

How can I fix it or compile maybe differently libs to my module?
Thanks upfront.

1.14 is ancient at this point, FWIW.

The Android binaries provided by the GStreamer project are meant to be used inside Android apps, and come with a custom build system for apps. Specifically, all plugins are statically linked into the app and the build system is adding initialization code for all selected plugins.

For AOSP integration you’re probably better off compiling GStreamer yourself instead of using the binaries. Either dynamically linked or statically linked (but then you need to actually link to the plugins you want to use and initialize them). Or if you use 1.24 or newer you can also build a single GStreamer library with all plugins (and their dependencies) that you want to use and have it initialize those automatically (“gstreamer-full”).

Alternatively, you could statically link the plugins and initialize them accordingly inside your code, just like the app build system would do (check the ndk-build parts that come with the binaries for inspiration).

Thanks for fast answer.
Compiling GStreamer was my first option but I failed due to many errors and then some “Wrong version of Ubuntu”, maybe its because I wanted to make 1.14 version of lib.

As for alternative option, hope I got you right, this what helped to compile and see plugins alive:
All, static libs for plugins and dependencies was added as

cc_prebuilt_library_static {name: "libgobject"...}
to cc_library { name: "mygstreamer_pipeline", static_libs: ["libgobject", ...], }

and then called from pipeline init class, like

extern "C" {
    void gst_plugin_app_register();
    void gst_plugin_rtpmanager_register();
    void gst_plugin_rtp_register();
    void gst_plugin_udp_register();
    void gst_plugin_audioconvert_register();
    void gst_plugin_rawparse_register();
}

bool init_gstream_audio(RtpStreamPipe *rtp_pipe) {

// Initialize GStreamer
    gst_init(NULL, NULL);
    gst_plugin_app_register();
    gst_plugin_rtpmanager_register();
    gst_plugin_rtp_register();
    gst_plugin_udp_register();
    gst_plugin_audioconvert_register();
    gst_plugin_rawparse_register();

Dont think its perfect but working for now, so thank you :slight_smile: