From 9aa12399a834c70dbb135e61b1599c2776e30f6c Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Wed, 5 Feb 2020 11:17:33 +0100 Subject: [PATCH] fluiddec: Keep fluidsynth from probing audio drivers It might cause problems and we don't need the drivers anyway. This also avoids a bunch of stderr spam from the drivers. https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/1026 --- ext/fluidsynth/gstfluiddec.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ext/fluidsynth/gstfluiddec.c b/ext/fluidsynth/gstfluiddec.c index 0339ad249f..0550f62316 100644 --- a/ext/fluidsynth/gstfluiddec.c +++ b/ext/fluidsynth/gstfluiddec.c @@ -54,6 +54,11 @@ #include "gstfluiddec.h" +#define GST_HAVE_FLUIDSYNTH_VERSION(major,minor,micro) \ + (FLUIDSYNTH_VERSION_MAJOR > (major) || \ + (FLUIDSYNTH_VERSION_MAJOR == (major) && FLUIDSYNTH_VERSION_MINOR > (minor)) || \ + (FLUIDSYNTH_VERSION_MAJOR == (major) && FLUIDSYNTH_VERSION_MINOR == (minor) && FLUIDSYNTH_VERSION_MICRO >= (micro))) + GST_DEBUG_CATEGORY_STATIC (gst_fluid_dec_debug); #define GST_CAT_DEFAULT gst_fluid_dec_debug @@ -727,6 +732,17 @@ plugin_init (GstPlugin * plugin) GST_DEBUG_CATEGORY_INIT (gst_fluid_dec_debug, "fluiddec", 0, "Fluidsynth MIDI decoder plugin"); +#if GST_HAVE_FLUIDSYNTH_VERSION(1, 1, 9) + { + /* Disable all audio drivers so new_fluid_settings() does not probe them. + * This can crash if FluidSynth is already in use. */ + const char *empty[] = { NULL }; + if (fluid_audio_driver_register (empty) != FLUID_OK) { + GST_WARNING ("Failed to clear audio drivers"); + } + } +#endif + return gst_element_register (plugin, "fluiddec", GST_RANK_SECONDARY, GST_TYPE_FLUID_DEC); }