Commit 97c3b571 authored by Thibault Saunier's avatar Thibault Saunier

videoaggregator: Emit "buffer-consumed" right when it is consumed

And make sure that it is emited without the GstAggregator object lock
taken, otherwise no property can be set on the pad in the signal
callback.
parent ed330115
Pipeline #37873 passed with stages
in 58 minutes and 42 seconds
......@@ -60,6 +60,7 @@ enum
PROP_PAD_0,
PROP_PAD_ZORDER,
PROP_PAD_REPEAT_AFTER_EOS,
PROP_PAD_EMIT_SIGNALS,
};
......@@ -71,6 +72,7 @@ struct _GstVideoAggregatorPadPrivate
/* properties */
guint zorder;
gboolean repeat_after_eos;
gboolean emit_signals;
/* Subclasses can force an alpha channel in the (input thus output)
* colorspace format */
......@@ -99,6 +101,9 @@ gst_video_aggregator_pad_get_property (GObject * object, guint prop_id,
case PROP_PAD_REPEAT_AFTER_EOS:
g_value_set_boolean (value, pad->priv->repeat_after_eos);
break;
case PROP_PAD_EMIT_SIGNALS:
g_value_set_boolean (value, pad->priv->emit_signals);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -131,6 +136,9 @@ gst_video_aggregator_pad_set_property (GObject * object, guint prop_id,
case PROP_PAD_REPEAT_AFTER_EOS:
pad->priv->repeat_after_eos = g_value_get_boolean (value);
break;
case PROP_PAD_EMIT_SIGNALS:
pad->priv->emit_signals = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -217,6 +225,8 @@ gst_video_aggregator_pad_class_init (GstVideoAggregatorPadClass * klass)
"Repeat the " "last frame after EOS until all pads are EOS",
DEFAULT_PAD_REPEAT_AFTER_EOS,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
g_object_class_override_property (gobject_class, PROP_PAD_EMIT_SIGNALS,
"emit-signals");
aggpadclass->flush = GST_DEBUG_FUNCPTR (_flush_pad);
aggpadclass->skip_buffer =
......@@ -1609,6 +1619,9 @@ prepare_frames (GstElement * agg, GstPad * pad, gpointer user_data)
if (vpad->priv->buffer == NULL || !vaggpad_class->prepare_frame)
return TRUE;
if (vpad->priv->emit_signals)
g_signal_emit_by_name (vpad, "buffer-consumed", vpad->priv->buffer);
return vaggpad_class->prepare_frame (vpad, GST_VIDEO_AGGREGATOR_CAST (agg),
vpad->priv->buffer, &vpad->priv->prepared_frame);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment