Commit 68a253f2 authored by Xavier Claessens's avatar Xavier Claessens
Browse files

appsink: Release resources on READY state instead of NULL

parent 8bda575d
Pipeline #189501 passed with stages
in 21 minutes and 11 seconds
......@@ -193,6 +193,8 @@ static void gst_app_sink_set_property (GObject * object, guint prop_id,
static void gst_app_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstStateChangeReturn gst_app_sink_change_state (GstElement * element,
GstStateChange transition);
static gboolean gst_app_sink_unlock_start (GstBaseSink * bsink);
static gboolean gst_app_sink_unlock_stop (GstBaseSink * bsink);
static gboolean gst_app_sink_start (GstBaseSink * psink);
......@@ -458,10 +460,10 @@ gst_app_sink_class_init (GstAppSinkClass * klass)
gst_element_class_add_static_pad_template (element_class,
&gst_app_sink_template);
element_class->change_state = gst_app_sink_change_state;
basesink_class->unlock = gst_app_sink_unlock_start;
basesink_class->unlock_stop = gst_app_sink_unlock_stop;
basesink_class->start = gst_app_sink_start;
basesink_class->stop = gst_app_sink_stop;
basesink_class->event = gst_app_sink_event;
basesink_class->preroll = gst_app_sink_preroll;
basesink_class->render = gst_app_sink_render;
......@@ -614,6 +616,23 @@ gst_app_sink_get_property (GObject * object, guint prop_id, GValue * value,
}
}
static GstStateChangeReturn
gst_app_sink_change_state (GstElement * element, GstStateChange transition)
{
switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED:
gst_app_sink_start (GST_BASE_SINK_CAST (element));
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_app_sink_stop (GST_BASE_SINK_CAST (element));
break;
default:
break;
}
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
}
static gboolean
gst_app_sink_unlock_start (GstBaseSink * bsink)
{
......
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