diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index 3f0470e6a..40c469da3 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -1001,17 +1001,18 @@ connect_error: } static void -on_param_changed (void *data, uint32_t id, +handle_format_change (GstPipeWireSrc *pwsrc, const struct spa_pod *param) { - GstPipeWireSrc *pwsrc = data; - - if (param == NULL || id != SPA_PARAM_Format) { - GST_DEBUG_OBJECT (pwsrc, "clear format"); - return; - } if (pwsrc->caps) gst_caps_unref(pwsrc->caps); + if (param == NULL) { + GST_DEBUG_OBJECT (pwsrc, "clear format"); + pwsrc->caps = NULL; + pwsrc->negotiated = FALSE; + pwsrc->is_video = FALSE; + return; + } pwsrc->caps = gst_caps_from_format (param); if (pwsrc->caps && gst_caps_is_fixed (pwsrc->caps)) { @@ -1093,6 +1094,18 @@ on_param_changed (void *data, uint32_t id, pw_thread_loop_signal (pwsrc->core->loop, FALSE); } +static void +on_param_changed (void *data, uint32_t id, + const struct spa_pod *param) +{ + GstPipeWireSrc *pwsrc = data; + switch (id) { + case SPA_PARAM_Format: + handle_format_change(pwsrc, param); + break; + } +} + static gboolean gst_pipewire_src_unlock (GstBaseSrc * basesrc) {