From e3be1b849060d4170427b63d3c011f3bcd433323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Fri, 21 May 2021 16:16:50 -0400 Subject: [PATCH] audio aggregator: Add QoS property to pad Add a property to emit a QoS message whenever any data is dropped. Part-of: --- gst-libs/gst/audio/gstaudioaggregator.c | 59 +++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/gst-libs/gst/audio/gstaudioaggregator.c b/gst-libs/gst/audio/gstaudioaggregator.c index 9225c1775b..2a3cc2b0d2 100644 --- a/gst-libs/gst/audio/gstaudioaggregator.c +++ b/gst-libs/gst/audio/gstaudioaggregator.c @@ -88,6 +88,12 @@ GST_DEBUG_CATEGORY_STATIC (audio_aggregator_debug); #define GST_CAT_DEFAULT audio_aggregator_debug +enum +{ + PROP_PAD_0, + PROP_PAD_QOS_MESSAGES, +}; + struct _GstAudioAggregatorPadPrivate { /* All members are protected by the pad object lock */ @@ -112,6 +118,8 @@ struct _GstAudioAggregatorPadPrivate /* A new unhandled segment event has been received */ gboolean new_segment; + + gboolean qos_messages; /* Property to decide to send QoS messages or not */ }; @@ -135,14 +143,65 @@ gst_audio_aggregator_pad_finalize (GObject * object) G_OBJECT_CLASS (gst_audio_aggregator_pad_parent_class)->finalize (object); } +static void +gst_audio_aggregator_pad_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) +{ + GstAudioAggregatorPad *pad = GST_AUDIO_AGGREGATOR_PAD (object); + + switch (prop_id) { + case PROP_PAD_QOS_MESSAGES: + GST_OBJECT_LOCK (pad); + g_value_set_boolean (value, pad->priv->qos_messages); + GST_OBJECT_UNLOCK (pad); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_audio_aggregator_pad_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstAudioAggregatorPad *pad = GST_AUDIO_AGGREGATOR_PAD (object); + + switch (prop_id) { + case PROP_PAD_QOS_MESSAGES: + GST_OBJECT_LOCK (pad); + pad->priv->qos_messages = g_value_get_boolean (value); + GST_OBJECT_UNLOCK (pad); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + static void gst_audio_aggregator_pad_class_init (GstAudioAggregatorPadClass * klass) { GObjectClass *gobject_class = (GObjectClass *) klass; GstAggregatorPadClass *aggpadclass = (GstAggregatorPadClass *) klass; + gobject_class->set_property = gst_audio_aggregator_pad_set_property; + gobject_class->get_property = gst_audio_aggregator_pad_get_property; gobject_class->finalize = gst_audio_aggregator_pad_finalize; aggpadclass->flush = GST_DEBUG_FUNCPTR (gst_audio_aggregator_pad_flush_pad); + + /** + * GstAudioAggregatorPad:qos-messages: + * + * Emit QoS messages when dropping buffers. + * + * Since: 1.20 + */ + g_object_class_install_property (gobject_class, + PROP_PAD_QOS_MESSAGES, g_param_spec_boolean ("qos-messages", + "Quality of Service Messages", + "Emit QoS messages when dropping buffers", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } static void