Skip to content

Commit

Permalink
GstStartup: Use directsoundsink as primary sink
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaski committed Jul 29, 2023
1 parent d1a6e53 commit 483b42d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/engine/gststartup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,23 @@ void GstStartup::InitializeGStreamer() {
gstfastspectrum_register_static();
#endif

#if defined(Q_OS_WIN32) && defined(__MINGW32__)
// MinGW does not have wasapi2sink and wasapisink does not support device switching, so use directsoundsink as the default sink.
#ifdef Q_OS_WIN32
// Use directsoundsink as the default sink on Windows.
// wasapisink does not support device switching and wasapi2sink has issues, see #1227.
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) {
if (GstPluginFeature *directsoundsink = gst_registry_lookup_feature(reg, "directsoundsink")) {
gst_plugin_feature_set_rank(directsoundsink, GST_RANK_PRIMARY);
gst_object_unref(directsoundsink);
}
if (GstPluginFeature *wasapisink = gst_registry_lookup_feature(reg, "wasapisink")) {
gst_plugin_feature_set_rank(wasapisink, GST_RANK_SECONDARY);
gst_object_unref(wasapisink);
}
if (GstPluginFeature *wasapi2sink = gst_registry_lookup_feature(reg, "wasapi2sink")) {
gst_plugin_feature_set_rank(wasapi2sink, GST_RANK_SECONDARY);
gst_object_unref(wasapi2sink);
}
if (directsoundsink) gst_object_unref(directsoundsink);
if (wasapisink) gst_object_unref(wasapisink);
}
#endif

Expand Down

0 comments on commit 483b42d

Please sign in to comment.