From e78bb1b29caece40f85b9c76b0b6d48379a66b86 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sun, 13 Dec 2020 21:56:25 +0100 Subject: [PATCH] Use directsoundsink by default because of buggy wasapi plugin --- src/engine/gststartup.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/engine/gststartup.cpp b/src/engine/gststartup.cpp index 1dd6921d..5f895708 100644 --- a/src/engine/gststartup.cpp +++ b/src/engine/gststartup.cpp @@ -61,6 +61,21 @@ void GstStartup::InitializeGStreamer() { gstfastspectrum_register_static(); #endif +#ifdef Q_OS_WIN32 + // Use directsoundsink by default because of buggy wasapi plugin. + GstRegistry *reg = gst_registry_get(); + if (reg) { + GstPluginFeature *directsoundsink = gst_registry_lookup_feature(reg, "directsoundsink"); + GstPluginFeature *wasapisink = gst_registry_lookup_feature(reg, "wasapisink"); + if (directsoundsink && wasapisink) { + gst_plugin_feature_set_rank(directsoundsink, GST_RANK_PRIMARY); + gst_plugin_feature_set_rank(wasapisink, GST_RANK_SECONDARY); + } + if (directsoundsink) gst_object_unref(directsoundsink); + if (wasapisink) gst_object_unref(wasapisink); + } +#endif + } void GstStartup::SetEnvironment() {