aggregator: forward gap event information to gap buffer

When the GAP event was flagged with MISSING_DATA, subclasses
may want to adopt a different behaviour, for example by repeating
the last buffer.

As we turn these gap events into gap buffers, we need to flag
those, we do so with a new custom meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/708>
This commit is contained in:
Mathieu Duponchelle 2020-11-26 18:11:12 +01:00 committed by GStreamer Marge Bot
parent 07a71e0563
commit da25b95bdf

View file

@ -79,6 +79,8 @@
* these into gap buffers with matching PTS and duration. It will also
* flag these buffers with GST_BUFFER_FLAG_GAP and GST_BUFFER_FLAG_DROPPABLE
* to ease their identification and subsequent processing.
* In addition, if the gap event was flagged with GST_GAP_FLAG_MISSING_DATA,
* a custom meta is added to the resulting gap buffer (GstAggregatorMissingDataMeta).
*
* * Subclasses must use (a subclass of) #GstAggregatorPad for both their
* sink and source pads.
@ -1723,6 +1725,7 @@ gst_aggregator_default_sink_event (GstAggregator * self,
GstClockTime pts, endpts;
GstClockTime duration;
GstBuffer *gapbuf;
GstGapFlags flags = 0;
gst_event_parse_gap (event, &pts, &duration);
@ -1752,6 +1755,11 @@ gst_aggregator_default_sink_event (GstAggregator * self,
GST_BUFFER_FLAG_SET (gapbuf, GST_BUFFER_FLAG_GAP);
GST_BUFFER_FLAG_SET (gapbuf, GST_BUFFER_FLAG_DROPPABLE);
gst_event_parse_gap_flags (event, &flags);
if (flags & GST_GAP_FLAG_MISSING_DATA) {
gst_buffer_add_custom_meta (gapbuf, "GstAggregatorMissingDataMeta");
}
/* Remove GAP event so we can replace it with the buffer */
PAD_LOCK (aggpad);
if (g_queue_peek_tail (&aggpad->priv->data) == event)
@ -2741,6 +2749,7 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
static const gchar *meta_tags[] = { NULL };
aggregator_parent_class = g_type_class_peek_parent (klass);
@ -2855,6 +2864,9 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
GST_TYPE_SEGMENT | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_CLOCK_TIME,
GST_TYPE_CLOCK_TIME, GST_TYPE_CLOCK_TIME,
GST_TYPE_STRUCTURE | G_SIGNAL_TYPE_STATIC_SCOPE);
gst_meta_register_custom ("GstAggregatorMissingDataMeta", meta_tags, NULL,
NULL, NULL);
}
static inline gpointer