Merge branch 'pipewiresrc-fix-caps-negotiation-failure-when-changing-state-from-playing-to-paused' into 'master'

pipewiresrc: fix caps negotiation failure in some cases when changing state from playing to paused

See merge request pipewire/pipewire!2885
This commit is contained in:
elliot chen 2026-06-30 22:20:13 +08:00
commit 0f3b98b402

View file

@ -1240,6 +1240,14 @@ gst_pipewire_src_negotiate (GstBaseSrc * basesrc)
result = gst_pipewire_src_stream_start (pwsrc); result = gst_pipewire_src_stream_start (pwsrc);
/* Return true when flushing to avoid caps negotiation failure */
pw_thread_loop_lock (pwsrc->stream->core->loop);
if (pwsrc->flushing) {
GST_DEBUG_OBJECT (pwsrc, "is flushing");
result = TRUE;
}
pw_thread_loop_unlock (pwsrc->stream->core->loop);
return result; return result;
no_nego_needed: no_nego_needed:
@ -1797,6 +1805,13 @@ gst_pipewire_src_change_state (GstElement * element, GstStateChange transition)
/* stop recording ASAP by corking */ /* stop recording ASAP by corking */
GST_DEBUG_OBJECT (this, "in-activating stream"); GST_DEBUG_OBJECT (this, "in-activating stream");
pw_thread_loop_lock (this->stream->core->loop); pw_thread_loop_lock (this->stream->core->loop);
/* Wait if caps negotiation is currently in progress
* to prevent caps negotiation failure which can cause
* error in basesrc.
*/
if (wait_negotiated(this) == PW_STREAM_STATE_ERROR) {
GST_DEBUG_OBJECT (this, "stream state error");
}
pw_stream_set_active (this->stream->pwstream, false); pw_stream_set_active (this->stream->pwstream, false);
pw_thread_loop_unlock (this->stream->core->loop); pw_thread_loop_unlock (this->stream->core->loop);
break; break;