mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
aspectcropratio: Set caps from the streaming thread on property changes
Otherwise it might lead to deadlocks See https://gitlab.gnome.org/GNOME/pitivi/issues/2259 Closes #518
This commit is contained in:
parent
21378d83c2
commit
eb2b58cc0b
2 changed files with 31 additions and 5 deletions
|
@ -205,10 +205,32 @@ gst_aspect_ratio_crop_finalize (GObject * object)
|
||||||
aspect_ratio_crop = GST_ASPECT_RATIO_CROP (object);
|
aspect_ratio_crop = GST_ASPECT_RATIO_CROP (object);
|
||||||
|
|
||||||
g_mutex_clear (&aspect_ratio_crop->crop_lock);
|
g_mutex_clear (&aspect_ratio_crop->crop_lock);
|
||||||
|
gst_caps_unref (aspect_ratio_crop->renegotiation_caps);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstFlowReturn
|
||||||
|
gst_aspect_ratio_crop_sink_chain (GstPad * pad, GstObject * parent,
|
||||||
|
GstBuffer * buffer)
|
||||||
|
{
|
||||||
|
GstCaps *caps = NULL;
|
||||||
|
GstAspectRatioCrop *aspect_ratio_crop = GST_ASPECT_RATIO_CROP (parent);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (parent);
|
||||||
|
caps = aspect_ratio_crop->renegotiation_caps;
|
||||||
|
aspect_ratio_crop->renegotiation_caps = NULL;
|
||||||
|
GST_OBJECT_UNLOCK (parent);
|
||||||
|
|
||||||
|
if (caps) {
|
||||||
|
gst_aspect_ratio_crop_set_caps (GST_ASPECT_RATIO_CROP (parent), caps);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gst_proxy_pad_chain_default (pad, parent, buffer);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_aspect_ratio_crop_init (GstAspectRatioCrop * aspect_ratio_crop)
|
gst_aspect_ratio_crop_init (GstAspectRatioCrop * aspect_ratio_crop)
|
||||||
{
|
{
|
||||||
|
@ -247,6 +269,8 @@ gst_aspect_ratio_crop_init (GstAspectRatioCrop * aspect_ratio_crop)
|
||||||
|
|
||||||
gst_pad_set_event_function (aspect_ratio_crop->sink,
|
gst_pad_set_event_function (aspect_ratio_crop->sink,
|
||||||
GST_DEBUG_FUNCPTR (gst_aspect_ratio_crop_sink_event));
|
GST_DEBUG_FUNCPTR (gst_aspect_ratio_crop_sink_event));
|
||||||
|
gst_pad_set_chain_function (aspect_ratio_crop->sink,
|
||||||
|
GST_DEBUG_FUNCPTR (gst_aspect_ratio_crop_sink_chain));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -461,11 +485,11 @@ gst_aspect_ratio_crop_set_property (GObject * object, guint prop_id,
|
||||||
GST_OBJECT_UNLOCK (aspect_ratio_crop);
|
GST_OBJECT_UNLOCK (aspect_ratio_crop);
|
||||||
|
|
||||||
if (recheck) {
|
if (recheck) {
|
||||||
GstCaps *caps = gst_pad_get_current_caps (aspect_ratio_crop->sink);
|
GST_OBJECT_LOCK (aspect_ratio_crop);
|
||||||
if (caps != NULL) {
|
gst_clear_caps (&aspect_ratio_crop->renegotiation_caps);
|
||||||
gst_aspect_ratio_crop_set_caps (aspect_ratio_crop, caps);
|
aspect_ratio_crop->renegotiation_caps =
|
||||||
gst_caps_unref (caps);
|
gst_pad_get_current_caps (aspect_ratio_crop->sink);
|
||||||
}
|
GST_OBJECT_UNLOCK (aspect_ratio_crop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,8 @@ struct _GstAspectRatioCrop
|
||||||
gint ar_num; /* if < 1 then don't change ar */
|
gint ar_num; /* if < 1 then don't change ar */
|
||||||
gint ar_denom;
|
gint ar_denom;
|
||||||
|
|
||||||
|
GstCaps *renegotiation_caps;
|
||||||
|
|
||||||
GMutex crop_lock;
|
GMutex crop_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue