gst: sink: Disable active state setting when going to PAUSED

On first start, the stream is set to be active when connected. However,
when the element is going to PAUSED and not subsequently to PLAYING,
this is incorrect behaviour.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4049
This commit is contained in:
Arun Raghavan 2024-06-11 09:55:00 -04:00 committed by Wim Taymans
parent a9bf5fa24a
commit 9da01413a1

View file

@ -792,6 +792,15 @@ gst_pipewire_sink_change_state (GstElement * element, GstStateChange transition)
goto open_failed;
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
/* 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
* transition happens. This is janky, but because of how bins propagate
* state changes one transition at a time, there may not be a better way
* to do this. PAUSED -> READY -> PAUSED transitions, this is a noop */
pw_thread_loop_lock (this->stream->core->loop);
pw_stream_set_active(this->stream->pwstream, false);
pw_thread_loop_unlock (this->stream->core->loop);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
/* uncork and start play */