Hi, i am new to gstreamer and android but i am trying something similar to you and facing same issue like you.
I also tried gstreamer prebuilt binaries to AOSP under external/gstreamer* directory in the source tree, this is my Android.bp file under external/gstreamer directory:
cc_prebuilt_library_static {
name: "libglib",
strip: {
none: true,
},
vendor: true,
compile_multilib: "both",
target: {
android_x86_64: {
srcs: ["x86_64/lib/libglib-2.0.a"],
export_include_dirs: [
"x86_64/include/glib-2.0",
"x86_64/lib/glib-2.0/include",
],
},
android_x86: {
srcs: ["x86/lib/libglib-2.0.a"],
export_include_dirs: [
"x86/include/glib-2.0",
"x86/lib/glib-2.0/include",
],
}
},
}
cc_prebuilt_library_static {
name: "libgstapp",
strip: {
none: true,
},
vendor: true,
compile_multilib: "both",
target: {
android_x86_64: {
srcs: ["x86_64/lib/libgstapp-1.0.a"],
export_include_dirs: [
"x86_64/include",
],
},
android_x86: {
srcs: ["x86/lib/libgstapp-1.0.a"],
export_include_dirs: [
"x86/include",
],
}
},
}
cc_prebuilt_library_static {
name: "libgstbase",
strip: {
none: true,
},
vendor: true,
compile_multilib: "both",
target: {
android_x86_64: {
srcs: ["x86_64/lib/libgstbase-1.0.a"],
export_include_dirs: [
"x86_64/include",
],
},
android_x86: {
srcs: ["x86/lib/libgstbase-1.0.a"],
export_include_dirs: [
"x86/include",
],
}
},
}
cc_prebuilt_library_static {
name: "libgobject",
strip: {
none: true,
},
vendor: true,
compile_multilib: "both",
target: {
android_x86_64: {
srcs: ["x86_64/lib/libgobject-2.0.a"],
export_include_dirs: [
"x86_64/include",
],
},
android_x86: {
srcs: ["x86/lib/libgobject-2.0.a"],
export_include_dirs: [
"x86/include",
],
}
},
}
cc_prebuilt_library_static {
name: "libffi",
strip: {
none: true,
},
vendor: true,
compile_multilib: "both",
target: {
android_x86_64: {
srcs: ["x86_64/lib/libffi.a"],
export_include_dirs: [
"x86_64/include",
],
},
android_x86: {
srcs: ["x86/lib/libffi.a"],
export_include_dirs: [
"x86/include",
],
}
},
}
cc_prebuilt_library_static {
name: "libintl",
strip: {
none: true,
},
vendor: true,
compile_multilib: "both",
target: {
android_x86_64: {
srcs: ["x86_64/lib/libintl.a"],
export_include_dirs: [
"x86_64/include",
],
},
android_x86: {
srcs: ["x86/lib/libintl.a"],
export_include_dirs: [
"x86/include",
],
}
},
}
cc_prebuilt_library_static {
name: "libgstreamer",
strip: {
none: true,
},
vendor: true,
compile_multilib: "both",
target: {
android_x86_64: {
srcs: ["x86_64/lib/libgstreamer-1.0.a"],
export_include_dirs: [
"x86_64/include/glib-2.0",
"x86_64/include/gstreamer-1.0",
],
},
android_x86: {
srcs: ["x86/lib/libgstreamer-1.0.a"],
export_include_dirs: [
"x86/include/gstreamer-1.0",
"x86/include/glib-2.0",
],
}
},
static_libs: [
"libglib",
"libintl",
"libgmodule",
"libiconv",
"libpcre2",
"libgstapp",
"libgobject",
"libgstbase",
"libgstplugin",
],
}
cc_prebuilt_library_static {
name: "libgmodule",
strip: {
none: true,
},
vendor: true,
compile_multilib: "both",
target: {
android_x86_64: {
srcs: ["x86_64/lib/libgmodule-2.0.a"],
export_include_dirs: [
"x86_64/include/glib-2.0",
],
},
android_x86: {
srcs: ["x86/lib/libgmodule-2.0.a"],
export_include_dirs: [
"x86/include/glib-2.0",
],
}
},
}
cc_prebuilt_library_static {
name: "libgstplugin",
strip: {
none: true,
},
vendor: true,
compile_multilib: "both",
target: {
android_x86_64: {
srcs: ["x86_64/lib/gstreamer-1.0/libgstapp.a"],
export_include_dirs: [
"x86_64/include",
],
},
android_x86: {
srcs: ["x86/lib/gstreamer-1.0/libgstapp.a"],
export_include_dirs: [
"x86/include",
],
}
},
static_libs: [
"libglib",
"libintl",
"libgmodule",
"libiconv",
"libpcre2",
"libgstapp",
"libgobject",
"libgstbase",
],
}
cc_prebuilt_library_static {
name: "libiconv",
strip: {
none: true,
},
vendor: true,
compile_multilib: "both",
target: {
android_x86_64: {
srcs: ["x86_64/lib/libiconv.a"],
export_include_dirs: [
"x86_64/include",
],
},
android_x86: {
srcs: ["x86/lib/libiconv.a"],
export_include_dirs: [
"x86/include/",
],
}
},
}
cc_prebuilt_library_static {
name: "libpcre2",
strip: {
none: true,
},
vendor: true,
compile_multilib: "both",
target: {
android_x86_64: {
srcs: ["x86_64/lib/libpcre2-8.a"],
export_include_dirs: [
"x86_64/include",
],
},
android_x86: {
srcs: ["x86/lib/libpcre2-8.a"],
export_include_dirs: [
"x86/include",
],
}
},
}
And then under this directory device/generic/goldfish/audio i am linking those libraries in this Android.bp file:
//
// Copyright (C) 2011 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package {
default_applicable_licenses: ["device_generic_goldfish_audio_license"],
}
// Added automatically by a large-scale-change
// See: http://go/android-license-faq
license {
name: "device_generic_goldfish_audio_license",
visibility: [":__subpackages__"],
license_kinds: [
"SPDX-license-identifier-Apache-2.0",
],
license_text: [
"NOTICE",
],
}
cc_library_shared {
name: "android.hardware.audio.legacy@7.0-impl.ranchu",
defaults: ["android.hardware.audio@7.0-impl_default"],
relative_install_path: "hw",
vendor: true,
}
cc_defaults {
name: "android.hardware.audio@7.x-impl.ranchu_default",
vendor: true,
relative_install_path: "hw",
defaults: ["hidl_defaults"],
srcs: [
"entry.cpp",
"device_factory.cpp",
"primary_device.cpp",
"stream_common.cpp",
"stream_in.cpp",
"stream_out.cpp",
"io_thread.cpp",
"device_port_source.cpp",
"device_port_sink.cpp",
"talsa.cpp",
"ring_buffer.cpp",
"audio_ops.cpp",
"util.cpp",
],
shared_libs: [
"android.hardware.audio@7.0",
"android.hardware.audio@7.0-util",
"android.hardware.audio.common@7.0",
"android.hardware.audio.common@7.0-util",
"libaudioutils",
"libbase",
"libcutils",
"libhidlbase",
"liblog",
"libtinyalsav2",
"libutils",
"libfmq",
"libprocessgroup",
// "mygstreamer",
],
static_libs: [
"libgstreamer",
"libglib",
"libintl",
"libgobject",
"libgmodule", // Added gmodule dependency
"libiconv", // Added libiconv dependency
"libpcre2", // Added pcre2 dependency
"libffi",
"libgstapp",
"libgstbase",
],
header_libs: [
"android.hardware.audio.common.util@all-versions",
"libaudio_system_headers",
],
cflags: [
"-include common/all-versions/VersionMacro.h",
],
}
cc_library_shared {
name: "android.hardware.audio@7.0-impl.ranchu",
defaults: ["android.hardware.audio@7.x-impl.ranchu_default"],
vintf_fragments: ["android.hardware.audio@7.0-impl.ranchu.xml"],
shared_libs: [
"android.hardware.audio.common@7.0-enums",
],
cflags: [
"-DLOG_TAG=\"android.hardware.audio@7.0-impl.ranchu\"",
"-DMAJOR_VERSION=7",
"-DMINOR_VERSION=0",
"-include common/all-versions/VersionMacro.h",
],
// a.h.audio@X.0-impl.ranchu (see above) loads a.h.audio.legacy@X.0-impl
// which loads:
// - audio.r_submix.default which provides the r_submix device (b/161485545)
// - audio.a2dp.default which provides the a2dp device (b/228804498)
// - audio.bluetooth.default which provides the bluetooth device (b/228804498)
// This should be retired once we don't need to load the
// deprecated libhardware modules listed above.
//
// audio.a2dp.default is not part of the required list as it's already in the
// generic system image
required: [
"android.hardware.audio.legacy@7.0-impl.ranchu",
"audio.r_submix.default",
"audio.bluetooth.default",
],
}
cc_library_shared {
name: "android.hardware.audio.legacy@7.1-impl.ranchu",
defaults: ["android.hardware.audio@7.1-impl_default"],
relative_install_path: "hw",
vendor: true,
}
cc_library_shared {
name: "android.hardware.audio@7.1-impl.ranchu",
defaults: ["android.hardware.audio@7.x-impl.ranchu_default"],
vintf_fragments: ["android.hardware.audio@7.1-impl.ranchu.xml"],
shared_libs: [
"android.hardware.audio@7.1",
"android.hardware.audio.common@7.1-enums",
// "mygstreamer",
],
static_libs: [
"libgstreamer",
"libglib",
"libintl",
"libgobject",
"libgmodule", // Added gmodule dependency
"libiconv", // Added libiconv dependency
"libpcre2", // Added pcre2 dependency
"libffi",
"libgstapp",
"libgstbase",
"libgstplugin"
],
cflags: [
"-DLOG_TAG=\"android.hardware.audio@7.1-impl.ranchu\"",
"-DMAJOR_VERSION=7",
"-DMINOR_VERSION=1",
"-DCOMMON_TYPES_MINOR_VERSION=0",
"-DCORE_TYPES_MINOR_VERSION=0",
],
// a.h.audio@X.0-impl.ranchu (see above) loads a.h.audio.legacy@X.0-impl
// which loads:
// - audio.r_submix.default which provides the r_submix device (b/161485545)
// - audio.a2dp.default which provides the a2dp device (b/228804498)
// - audio.bluetooth.default which provides the bluetooth device (b/228804498)
// This should be retired once we don't need to load the
// deprecated libhardware modules listed above.
//
// audio.a2dp.default is not part of the required list as it's already in the
// generic system image
required: [
"android.hardware.audio.legacy@7.1-impl.ranchu",
"audio.r_submix.default",
"audio.bluetooth.default",
],
}