[clutter-gst/clutter-gst-2.0] video-sink: clear buffer in flush
- From: Wim Taymans <wtaymans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter-gst/clutter-gst-2.0] video-sink: clear buffer in flush
- Date: Tue, 19 May 2015 11:33:00 +0000 (UTC)
commit 6dd67050554caf7e689a0de28807631b56d01b16
Author: Wim Taymans <wtaymans redhat com>
Date: Tue May 19 13:31:12 2015 +0200
video-sink: clear buffer in flush
We need to release our refs to the buffer in FLUSH_START so that
upstream can free and reuse the memory.
clutter-gst/clutter-gst-video-sink.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/clutter-gst/clutter-gst-video-sink.c b/clutter-gst/clutter-gst-video-sink.c
index 63867d4..ef6d996 100644
--- a/clutter-gst/clutter-gst-video-sink.c
+++ b/clutter-gst/clutter-gst-video-sink.c
@@ -1971,6 +1971,31 @@ clutter_gst_video_sink_propose_allocation (GstBaseSink * base_sink, GstQuery * q
return TRUE;
}
+static gboolean
+clutter_gst_video_sink_event (GstBaseSink * basesink, GstEvent * event)
+{
+ ClutterGstVideoSink *sink = CLUTTER_GST_VIDEO_SINK (basesink);
+ ClutterGstVideoSinkPrivate *priv = sink->priv;
+ ClutterGstSource *gst_source = priv->source;
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_FLUSH_START:
+ g_mutex_lock (&gst_source->buffer_lock);
+ if (gst_source->buffer) {
+ GST_DEBUG ("Freeing existing buffer %p", gst_source->buffer);
+ gst_buffer_unref (gst_source->buffer);
+ gst_source->buffer = NULL;
+ }
+ g_mutex_unlock (&gst_source->buffer_lock);
+ break;
+
+ default:
+ break;
+ }
+
+ return GST_BASE_SINK_CLASS (parent_class)->event (basesink, event);
+}
+
static void
clutter_gst_video_sink_class_init (ClutterGstVideoSinkClass * klass)
{
@@ -2007,6 +2032,7 @@ clutter_gst_video_sink_class_init (ClutterGstVideoSinkClass * klass)
gstbase_sink_class->set_caps = clutter_gst_video_sink_set_caps;
gstbase_sink_class->get_caps = clutter_gst_video_sink_get_caps;
gstbase_sink_class->propose_allocation = clutter_gst_video_sink_propose_allocation;
+ gstbase_sink_class->event = clutter_gst_video_sink_event;
/**
* ClutterGstVideoSink:texture:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]