diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-01-06 00:03:48 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-01-16 15:33:16 +0400 |
commit | 92885ed0df462446ff326457b8f6432801ba05a7 (patch) | |
tree | fa6b9cbe129ca73c2f89b18c6b4ee9a94f7fa415 /src/spice-gstaudio.c | |
parent | 58aab431883f11b2e8e1ccc9e44e25c452311d5a (diff) |
gst: check pulsesrc version >= 1.14.5
There is a racy bug in pulsesrc that we can't easily workaround:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/69
It is fixed with 1.15, and will be backported to upcoming 1.14.5.
PulseAudio may not be picked by autoaudiosrc, but looking up the
actual source or mimicking GstAutoDetect is unnecessarily complicated.
When pulsesrc < 1.14.5 is detected, let's drop its rank, so it won't be picked.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
Diffstat (limited to 'src/spice-gstaudio.c')
-rw-r--r-- | src/spice-gstaudio.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c index 84f452d..98c1f4f 100644 --- a/src/spice-gstaudio.c +++ b/src/spice-gstaudio.c @@ -527,7 +527,35 @@ SpiceGstaudio *spice_gstaudio_new(SpiceSession *session, GMainContext *context, const char *name) { GError *err = NULL; + if (gst_init_check(NULL, NULL, &err)) { + GstPluginFeature *pulsesrc; + + pulsesrc = gst_registry_lookup_feature(gst_registry_get(), "pulsesrc"); + if (pulsesrc) { + unsigned major, minor, micro; + GstPlugin *plugin = gst_plugin_feature_get_plugin(pulsesrc); + + if (sscanf(gst_plugin_get_version(plugin), "%u.%u.%u", + &major, &minor, µ) != 3) { + g_warn_if_reached(); + gst_object_unref(plugin); + gst_object_unref(pulsesrc); + return NULL; + } + + if (major < 1 || + (major == 1 && minor < 14) || + (major == 1 && minor == 14 && micro < 5)) { + g_warning("Bad pulsesrc version %s, lowering its rank", + gst_plugin_get_version(plugin)); + gst_plugin_feature_set_rank(pulsesrc, GST_RANK_NONE); + } + + gst_object_unref(plugin); + gst_object_unref(pulsesrc); + } + return g_object_new(SPICE_TYPE_GSTAUDIO, "session", session, "main-context", context, |