summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2010-12-21 13:55:40 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2010-12-21 13:55:40 +0100
commite47f4487b40c8b7139887cf66365a2edf033b3ac (patch)
treef1654c84ced0fe94deb653201a8edc0e4907a018
parent2c6e198157f8dd2314a6ccb72e214c61b4188934 (diff)
theorapay: clear packet on flush-stop
-rw-r--r--gst/rtp/gstrtptheorapay.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/gst/rtp/gstrtptheorapay.c b/gst/rtp/gstrtptheorapay.c
index 82651eca8..47a156103 100644
--- a/gst/rtp/gstrtptheorapay.c
+++ b/gst/rtp/gstrtptheorapay.c
@@ -84,6 +84,9 @@ static GstStateChangeReturn gst_rtp_theora_pay_change_state (GstElement *
element, GstStateChange transition);
static GstFlowReturn gst_rtp_theora_pay_handle_buffer (GstBaseRTPPayload * pad,
GstBuffer * buffer);
+static gboolean gst_rtp_theora_pay_handle_event (GstPad * pad,
+ GstEvent * event);
+
static void gst_rtp_theora_pay_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@@ -121,6 +124,7 @@ gst_rtp_theora_pay_class_init (GstRtpTheoraPayClass * klass)
gstbasertppayload_class->set_caps = gst_rtp_theora_pay_setcaps;
gstbasertppayload_class->handle_buffer = gst_rtp_theora_pay_handle_buffer;
+ gstbasertppayload_class->handle_event = gst_rtp_theora_pay_handle_event;
gobject_class->set_property = gst_rtp_theora_pay_set_property;
gobject_class->get_property = gst_rtp_theora_pay_get_property;
@@ -145,15 +149,21 @@ gst_rtp_theora_pay_init (GstRtpTheoraPay * rtptheorapay,
}
static void
+gst_rtp_theora_pay_clear_packet (GstRtpTheoraPay * rtptheorapay)
+{
+ if (rtptheorapay->packet)
+ gst_buffer_unref (rtptheorapay->packet);
+ rtptheorapay->packet = NULL;
+}
+
+static void
gst_rtp_theora_pay_cleanup (GstRtpTheoraPay * rtptheorapay)
{
g_list_foreach (rtptheorapay->headers, (GFunc) gst_mini_object_unref, NULL);
g_list_free (rtptheorapay->headers);
rtptheorapay->headers = NULL;
- if (rtptheorapay->packet)
- gst_buffer_unref (rtptheorapay->packet);
- rtptheorapay->packet = NULL;
+ gst_rtp_theora_pay_clear_packet (rtptheorapay);
if (rtptheorapay->config_data)
g_free (rtptheorapay->config_data);
@@ -758,6 +768,22 @@ header_error:
}
}
+static gboolean
+gst_rtp_theora_pay_handle_event (GstPad * pad, GstEvent * event)
+{
+ GstRtpTheoraPay *rtptheorapay = GST_RTP_THEORA_PAY (GST_PAD_PARENT (pad));
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_FLUSH_STOP:
+ gst_rtp_theora_pay_clear_packet (rtptheorapay);
+ break;
+ default:
+ break;
+ }
+ /* false to let parent handle event as well */
+ return FALSE;
+}
+
static GstStateChangeReturn
gst_rtp_theora_pay_change_state (GstElement * element,
GstStateChange transition)