gst_aggregator_flush_start (GstAggregator * self, GstAggregatorPad * aggpad,
GstEvent * event)
{
- GstBuffer *tmpbuf;
GstAggregatorPrivate *priv = self->priv;
GstAggregatorPadPrivate *padpriv = aggpad->priv;
g_atomic_int_set (&aggpad->priv->flushing, TRUE);
+
/* Remove pad buffer and wake up the streaming thread */
- tmpbuf = gst_aggregator_pad_steal_buffer (aggpad);
- gst_buffer_replace (&tmpbuf, NULL);
+ gst_aggregator_pad_drop_buffer (aggpad);
PAD_STREAM_LOCK (aggpad);
PAD_LOCK (aggpad);
}
PAD_STREAM_UNLOCK (aggpad);
- tmpbuf = gst_aggregator_pad_steal_buffer (aggpad);
- gst_buffer_replace (&tmpbuf, NULL);
+ gst_aggregator_pad_drop_buffer (aggpad);
}
/* GstAggregator vmethods default implementations */
gst_aggregator_release_pad (GstElement * element, GstPad * pad)
{
GstAggregator *self = GST_AGGREGATOR (element);
- GstBuffer *tmpbuf;
GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
SRC_STREAM_LOCK (self);
g_atomic_int_set (&aggpad->priv->flushing, TRUE);
- tmpbuf = gst_aggregator_pad_steal_buffer (aggpad);
- gst_buffer_replace (&tmpbuf, NULL);
+ gst_aggregator_pad_drop_buffer (aggpad);
gst_element_remove_pad (element, pad);
SRC_STREAM_BROADCAST (self);
gst_aggregator_pad_dispose (GObject * object)
{
GstAggregatorPad *pad = (GstAggregatorPad *) object;
- GstBuffer *buf;
- buf = gst_aggregator_pad_steal_buffer (pad);
- if (buf)
- gst_buffer_unref (buf);
+ gst_aggregator_pad_drop_buffer (pad);
G_OBJECT_CLASS (gst_aggregator_pad_parent_class)->dispose (object);
}
}
/**
+ * gst_aggregator_pad_drop_buffer:
+ * @pad: the pad where to drop any pending buffer
+ *
+ * Drop the buffer currently queued in @pad.
+ *
+ * Returns: TRUE if there was a buffer queued in @pad, or FALSE if not.
+ */
+gboolean
+gst_aggregator_pad_drop_buffer (GstAggregatorPad * pad)
+{
+ GstBuffer *buf;
+
+ buf = gst_aggregator_pad_steal_buffer (pad);
+
+ if (buf == NULL)
+ return FALSE;
+
+ gst_buffer_unref (buf);
+ return TRUE;
+}
+
+/**
* gst_aggregator_pad_get_buffer:
* @pad: the pad to get buffer from
*