aja: there is no need to take object lock

Both _sink_event() and _aggregate() vfunc are called from the source pad
streaming thread. There is thus no need to protect caps fields.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7536>
This commit is contained in:
Xavier Claessens 2024-09-17 10:36:58 -04:00 committed by GStreamer Marge Bot
parent 2e8afcf51a
commit a791648600

View file

@ -47,10 +47,8 @@ G_DEFINE_TYPE(GstAjaSinkCombiner, gst_aja_sink_combiner, GST_TYPE_AGGREGATOR);
static void gst_aja_sink_combiner_finalize(GObject *object) { static void gst_aja_sink_combiner_finalize(GObject *object) {
GstAjaSinkCombiner *self = GST_AJA_SINK_COMBINER(object); GstAjaSinkCombiner *self = GST_AJA_SINK_COMBINER(object);
GST_OBJECT_LOCK(self);
gst_caps_replace(&self->audio_caps, NULL); gst_caps_replace(&self->audio_caps, NULL);
gst_caps_replace(&self->video_caps, NULL); gst_caps_replace(&self->video_caps, NULL);
GST_OBJECT_UNLOCK(self);
G_OBJECT_CLASS(parent_class)->finalize(object); G_OBJECT_CLASS(parent_class)->finalize(object);
} }
@ -154,15 +152,11 @@ static gboolean gst_aja_sink_combiner_sink_event(GstAggregator *aggregator,
gst_event_parse_caps(event, &caps); gst_event_parse_caps(event, &caps);
if (agg_pad == GST_AGGREGATOR_PAD_CAST(self->audio_sinkpad)) { if (agg_pad == GST_AGGREGATOR_PAD_CAST(self->audio_sinkpad)) {
GST_OBJECT_LOCK(self);
gst_caps_replace(&self->audio_caps, caps); gst_caps_replace(&self->audio_caps, caps);
self->caps_changed = TRUE; self->caps_changed = TRUE;
GST_OBJECT_UNLOCK(self);
} else if (agg_pad == GST_AGGREGATOR_PAD_CAST(self->video_sinkpad)) { } else if (agg_pad == GST_AGGREGATOR_PAD_CAST(self->video_sinkpad)) {
GST_OBJECT_LOCK(self);
gst_caps_replace(&self->video_caps, caps); gst_caps_replace(&self->video_caps, caps);
self->caps_changed = TRUE; self->caps_changed = TRUE;
GST_OBJECT_UNLOCK(self);
} }
break; break;
@ -230,10 +224,8 @@ static gboolean gst_aja_sink_combiner_negotiate(GstAggregator *aggregator) {
static gboolean gst_aja_sink_combiner_stop(GstAggregator *aggregator) { static gboolean gst_aja_sink_combiner_stop(GstAggregator *aggregator) {
GstAjaSinkCombiner *self = GST_AJA_SINK_COMBINER(aggregator); GstAjaSinkCombiner *self = GST_AJA_SINK_COMBINER(aggregator);
GST_OBJECT_LOCK(self);
gst_caps_replace(&self->audio_caps, NULL); gst_caps_replace(&self->audio_caps, NULL);
gst_caps_replace(&self->video_caps, NULL); gst_caps_replace(&self->video_caps, NULL);
GST_OBJECT_UNLOCK(self);
return TRUE; return TRUE;
} }