Hello,
I’m running QGroundControl on Android 11 (NXP i.MX8MQ platform), using gstreamer-1.0-android-universal-1.18.5.
The issue is that decodebin3 always selects the software decoder avdec_h264, instead of using the hardware decoder amcviddec-c2imxavcdecoder.
Below is the code I use to list and print both decoders and their ranks:
GST_PLUGIN_STATIC_REGISTER(androidmedia);
GstRegistry *registry = gst_registry_get();
// List all factories (including statically registered ones)
GList *factories = gst_registry_get_feature_list(registry, GST_TYPE_ELEMENT_FACTORY);
for (GList *l = factories; l != NULL; l = l->next) {
GstElementFactory *factory = GST_ELEMENT_FACTORY(l->data);
const gchar *name = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(factory));
// Only focus on video decoders
if (g_str_has_prefix(name, "avdec_h264") ||
g_str_has_prefix(name, "amcviddec-c2imxavcdecoder")) {
gint rank = gst_plugin_feature_get_rank(GST_PLUGIN_FEATURE(factory));
const gchar *klass = gst_element_factory_get_klass(factory);
const gchar *longname = gst_element_factory_get_longname(factory);
qDebug() << "Decoder:" << name << "| Rank:" << rank << "| Class:" << klass << "| Desc:" << longname;
}
}
Output:
Decoder: avdec_h264 | Rank: 256 | Class: Codec/Decoder/Video | Desc: libav H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 decoder
Decoder: amcviddec-c2imxavcdecoder | Rank: 64 | Class: Codec/Decoder/Video/Hardware | Desc: c2.imx.avc.decoder
As you can see, the software decoder avdec_h264 has a higher rank (256) than the hardware decoder (64), so decodebin3 always chooses avdec_h264.
I know that changing the rank in the source code (using gst_plugin_feature_set_rank()) works, but I would like to avoid modifying the QGC source.
I also tried setting the environment variable:
export GST_PLUGIN_FEATURE_RANK=avdec_h264:1,amcviddec-c2imxavcdecoder:256
and confirmed it appears in /proc/<pid>/environ,
but it still has no effect — decodebin3 keeps using avdec_h264.
So my question is:
How can I force decodebin3 to use the hardware decoder without changing QGC source code?
Are there any reliable system-level methods or configuration-based solutions to adjust plugin priority?
Any suggestions or experience on this issue would be greatly appreciated.