From ae9239aac708a7c0da6c4dcea219b23f69a2325b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 21 Aug 2013 09:55:20 +0200 Subject: [PATCH] rtpgstpay: reset on FLUSH_STOP Clear the adapter and pending buffer list on FLUSH_STOP. --- gst/rtp/gstrtpgstpay.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/gst/rtp/gstrtpgstpay.c b/gst/rtp/gstrtpgstpay.c index 75f5cd7510..a1a8fe342e 100644 --- a/gst/rtp/gstrtpgstpay.c +++ b/gst/rtp/gstrtpgstpay.c @@ -152,6 +152,19 @@ gst_rtp_gst_pay_init (GstRtpGSTPay * rtpgstpay) rtpgstpay->config_interval = DEFAULT_CONFIG_INTERVAL; } +static void +gst_rtp_gst_pay_reset (GstRtpGSTPay * rtpgstpay) +{ + rtpgstpay->last_config = GST_CLOCK_TIME_NONE; + gst_adapter_clear (rtpgstpay->adapter); + rtpgstpay->flags &= 0x70; + rtpgstpay->etype = 0; + if (rtpgstpay->pending_buffers) + g_list_free_full (rtpgstpay->pending_buffers, + (GDestroyNotify) gst_buffer_list_unref); + rtpgstpay->pending_buffers = NULL; +} + static void gst_rtp_gst_pay_finalize (GObject * obj) { @@ -159,11 +172,9 @@ gst_rtp_gst_pay_finalize (GObject * obj) rtpgstpay = GST_RTP_GST_PAY (obj); + gst_rtp_gst_pay_reset (rtpgstpay); + g_object_unref (rtpgstpay->adapter); - if (rtpgstpay->pending_buffers) - g_list_free_full (rtpgstpay->pending_buffers, - (GDestroyNotify) gst_buffer_list_unref); - rtpgstpay->pending_buffers = NULL; if (rtpgstpay->taglist) gst_tag_list_unref (rtpgstpay->taglist); rtpgstpay->taglist = NULL; @@ -443,7 +454,7 @@ gst_rtp_gst_pay_sink_event (GstRTPBasePayload * payload, GstEvent * event) { gboolean ret; GstRtpGSTPay *rtpgstpay; - guint etype; + guint etype = 0; rtpgstpay = GST_RTP_GST_PAY (payload); @@ -452,6 +463,9 @@ gst_rtp_gst_pay_sink_event (GstRTPBasePayload * payload, GstEvent * event) gst_event_ref (event)); switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_FLUSH_STOP: + gst_rtp_gst_pay_reset (rtpgstpay); + break; case GST_EVENT_TAG:{ GstTagList *tags; @@ -494,7 +508,6 @@ gst_rtp_gst_pay_sink_event (GstRTPBasePayload * payload, GstEvent * event) break; } default: - etype = 0; GST_LOG_OBJECT (rtpgstpay, "no event for %s", GST_EVENT_TYPE_NAME (event)); break;