mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
videoaggregator: Make sure to hold object lock while iterating sink pads
They might otherwise just change while we iterate.
This commit is contained in:
parent
546dd512e8
commit
dad8f75f87
1 changed files with 19 additions and 9 deletions
|
@ -949,6 +949,20 @@ gst_video_aggregator_default_update_src_caps (GstAggregator * agg,
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_update_conversion_info (GstElement * element, GstPad * pad, gpointer user_data)
|
||||
{
|
||||
GstVideoAggregatorPad *vaggpad = GST_VIDEO_AGGREGATOR_PAD (pad);
|
||||
GstVideoAggregatorPadClass *vaggpad_klass =
|
||||
GST_VIDEO_AGGREGATOR_PAD_GET_CLASS (vaggpad);
|
||||
|
||||
if (vaggpad_klass->update_conversion_info) {
|
||||
vaggpad_klass->update_conversion_info (vaggpad);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_video_aggregator_default_negotiated_src_caps (GstAggregator * agg,
|
||||
GstCaps * caps)
|
||||
|
@ -1001,15 +1015,8 @@ gst_video_aggregator_default_negotiated_src_caps (GstAggregator * agg,
|
|||
}
|
||||
|
||||
/* Then browse the sinks once more, setting or unsetting conversion if needed */
|
||||
for (l = GST_ELEMENT (vagg)->sinkpads; l; l = l->next) {
|
||||
GstVideoAggregatorPad *pad = GST_VIDEO_AGGREGATOR_PAD (l->data);
|
||||
GstVideoAggregatorPadClass *vaggpad_klass =
|
||||
GST_VIDEO_AGGREGATOR_PAD_GET_CLASS (pad);
|
||||
|
||||
if (vaggpad_klass->update_conversion_info) {
|
||||
vaggpad_klass->update_conversion_info (pad);
|
||||
}
|
||||
}
|
||||
gst_element_foreach_sink_pad (GST_ELEMENT_CAST (vagg),
|
||||
_update_conversion_info, NULL);
|
||||
|
||||
if (vagg->priv->current_caps == NULL ||
|
||||
gst_caps_is_equal (caps, vagg->priv->current_caps) == FALSE) {
|
||||
|
@ -1032,6 +1039,7 @@ gst_video_aggregator_get_sinkpads_interlace_mode (GstVideoAggregator * vagg,
|
|||
{
|
||||
GList *walk;
|
||||
|
||||
GST_OBJECT_LOCK (vagg);
|
||||
for (walk = GST_ELEMENT (vagg)->sinkpads; walk; walk = g_list_next (walk)) {
|
||||
GstVideoAggregatorPad *vaggpad = walk->data;
|
||||
|
||||
|
@ -1040,9 +1048,11 @@ gst_video_aggregator_get_sinkpads_interlace_mode (GstVideoAggregator * vagg,
|
|||
if (vaggpad->info.finfo
|
||||
&& GST_VIDEO_INFO_FORMAT (&vaggpad->info) != GST_VIDEO_FORMAT_UNKNOWN) {
|
||||
*mode = GST_VIDEO_INFO_INTERLACE_MODE (&vaggpad->info);
|
||||
GST_OBJECT_UNLOCK (vagg);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
GST_OBJECT_UNLOCK (vagg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue