mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
gstpipewiresrc: Fix re-linking
When using PW source, one might want to dynamically link PW source to a different source. Setting possible_caps to NULL prevents the caps intersect from returning a successful result on format change. Do not set possible_caps to NULL as we get that from peer caps which should stay the same ideally for the duration of pipeline run. That allows re-linking PW source any number of times with a pipeline like below. gst-launch-1.0 pipewiresrc autoconnect=false ! queue ! video/x-raw,format=YUY2 ! videoconvert ! xvimagesink The above pipeline can be made to switch between a camera source and a screen capture source like wf-recorder. Note that this fix only improves the status quo and won't work if the peer caps change due to a re-negotiation.
This commit is contained in:
parent
4ae348254e
commit
3c62d29a55
1 changed files with 2 additions and 2 deletions
|
|
@ -990,7 +990,7 @@ gst_pipewire_src_negotiate (GstBaseSrc * basesrc)
|
|||
GST_DEBUG_OBJECT (basesrc, "connect capture with path %s, target-object %s",
|
||||
pwsrc->stream->path, pwsrc->stream->target_object);
|
||||
|
||||
pwsrc->possible_caps = possible_caps;
|
||||
pwsrc->possible_caps = gst_caps_ref (possible_caps);
|
||||
pwsrc->negotiated = FALSE;
|
||||
|
||||
enum pw_stream_flags flags;
|
||||
|
|
@ -1027,7 +1027,6 @@ gst_pipewire_src_negotiate (GstBaseSrc * basesrc)
|
|||
}
|
||||
|
||||
negotiated_caps = g_steal_pointer (&pwsrc->caps);
|
||||
pwsrc->possible_caps = NULL;
|
||||
pw_thread_loop_unlock (pwsrc->stream->core->loop);
|
||||
|
||||
if (negotiated_caps == NULL)
|
||||
|
|
@ -1472,6 +1471,7 @@ gst_pipewire_src_stop (GstBaseSrc * basesrc)
|
|||
pwsrc->eos = false;
|
||||
gst_buffer_replace (&pwsrc->last_buffer, NULL);
|
||||
gst_caps_replace(&pwsrc->caps, NULL);
|
||||
gst_caps_replace(&pwsrc->possible_caps, NULL);
|
||||
pwsrc->transform_value = UINT32_MAX;
|
||||
pw_thread_loop_unlock (pwsrc->stream->core->loop);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue