api: Use fakesink when PipeWire enabled but unavailable

Instead of misleading users that they are using PipeWire after enabling it, use fakesink in order to not output any sound at all
This commit is contained in:
Rafał Dzięgiel
2021-09-03 11:50:40 +02:00
parent 38e721be03
commit cccc584961

View File

@@ -3158,8 +3158,14 @@ gst_clapper_main (gpointer data)
if (pipewiresink) { if (pipewiresink) {
g_object_set (self->playbin, "audio-sink", pipewiresink, NULL); g_object_set (self->playbin, "audio-sink", pipewiresink, NULL);
} else { } else {
g_warning ("GstClapper: pipewiresink element not available. " GstElement *fakesink;
"Default audio sink will be used instead.");
g_warning ("GstClapper: pipewiresink element not available");
fakesink = gst_element_factory_make ("fakesink", "fakeaudiosink");
if (fakesink)
g_object_set (self->playbin, "audio-sink", fakesink, NULL);
else
g_warning ("GstClapper: default audio sink will be used instead");
} }
} }