gst: sink: Don't provide clock in provide mode

Counter-intuitive as it seems, when we are driving the clock, we can't
also provide a clock from PipeWire to the pipeline -- we need the
pipeline to drive the graph.

So we make the mode control whether we provide a clock or not.
This commit is contained in:
Arun Raghavan 2025-03-24 22:11:36 -04:00 committed by Arun Raghavan
parent 3c62d29a55
commit 439d5d04fe

View file

@ -242,7 +242,8 @@ gst_pipewire_sink_class_init (GstPipeWireSinkClass * klass)
GST_TYPE_PIPEWIRE_SINK_MODE,
DEFAULT_PROP_MODE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
G_PARAM_STATIC_STRINGS |
GST_PARAM_MUTABLE_READY));
g_object_class_install_property (gobject_class,
PROP_FD,
@ -1037,6 +1038,12 @@ gst_pipewire_sink_change_state (GstElement * element, GstStateChange transition)
goto open_failed;
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
/* If we are a driver, we shouldn't try to also provide the clock, as we
* _are_ the clock for the graph. For that case, we rely on the pipeline
* clock to drive the pipeline (and thus the graph). */
if (this->mode == GST_PIPEWIRE_SINK_MODE_PROVIDE)
GST_OBJECT_FLAG_UNSET (this, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
/* the initial stream state is active, which is needed for linking and
* negotiation to happen and the bufferpool to be set up. We don't know
* if we'll go to plaing, so we deactivate the stream until that