diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2024-02-27 18:59:41 +0530 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2024-03-13 06:29:01 +0000 |
commit | fa387a3eb7442d2faa0aae1a728b2ed978eb1cf2 (patch) | |
tree | 85ccf00b8a7e6878d8ac3d4141b5a43b1533459d | |
parent | acd40e7852c5e2bf188159466009824aebc0bb3b (diff) |
gsturi: Sort by feature name to break a feature rank tie
This matches autoplug in other places such as decodebin, otherwise we
will pick "randomly" based on the order in which plugins are
registered, which is mostly dependent on the order in which readdir()
returns items.
So let's make it predictable.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6348>
-rw-r--r-- | subprojects/gstreamer/gst/gsturi.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/subprojects/gstreamer/gst/gsturi.c b/subprojects/gstreamer/gst/gsturi.c index ae1fb72827..6c569db7c4 100644 --- a/subprojects/gstreamer/gst/gsturi.c +++ b/subprojects/gstreamer/gst/gsturi.c @@ -564,8 +564,12 @@ search_by_entry (GstPluginFeature * feature, gpointer search_entry) static gint sort_by_rank (GstPluginFeature * first, GstPluginFeature * second) { - return gst_plugin_feature_get_rank (second) - + int diff = gst_plugin_feature_get_rank (second) - gst_plugin_feature_get_rank (first); + if (diff == 0) + diff = g_strcmp0 (gst_plugin_feature_get_name (first), + gst_plugin_feature_get_name (second)); + return diff; } static GList * |