From 2e0395aa59054c5f0cd4fdca0400348f57e69fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 1 Jun 2015 19:23:01 +0200 Subject: [PATCH] androidmedia: Give lower ranks to codecs not starting with OMX. On some devices there are codecs that don't start with OMX., while there are also some that do. And on some of these devices the ones that don't start with OMX. just crash during initialization while the others work. To make things even more complicated other devices have codecs with the same name that work and no alternatives. So just give a lower rank to these non-OMX codecs and hope that there's an alternative with a higher rank. Also stagefright gives codecs starting with OMX. a higher rank too and considers other codecs that don't start with OMX. as software codecs. --- sys/androidmedia/gstamc.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sys/androidmedia/gstamc.c b/sys/androidmedia/gstamc.c index 88f81a7ab3..2b8d494e2b 100644 --- a/sys/androidmedia/gstamc.c +++ b/sys/androidmedia/gstamc.c @@ -3130,12 +3130,25 @@ register_codecs (GstPlugin * plugin) /* Give the Google software codec a secondary rank, * everything else is likely a hardware codec, except - * OMX.SEC.*.sw.dec (as seen in Galaxy S4) */ + * OMX.SEC.*.sw.dec (as seen in Galaxy S4). + * + * Also on some devices there are codecs that don't start + * with OMX., while there are also some that do. And on + * some of these devices the ones that don't start with + * OMX. just crash during initialization while the others + * work. To make things even more complicated other devices + * have codecs with the same name that work and no alternatives. + * So just give a lower rank to these non-OMX codecs and hope + * that there's an alternative with a higher rank. + */ if (g_str_has_prefix (codec_info->name, "OMX.google") || - g_str_has_suffix (codec_info->name, ".sw.dec")) + g_str_has_suffix (codec_info->name, ".sw.dec")) { rank = GST_RANK_SECONDARY; - else + } else if (g_str_has_prefix (codec_info->name, "OMX.")) { rank = GST_RANK_PRIMARY; + } else { + rank = GST_RANK_MARGINAL; + } ret |= gst_element_register (plugin, element_name, rank, subtype); g_free (element_name);