Commit 2c6e1981 authored by Wim Taymans's avatar Wim Taymans

vorbispay: clear packet on flush-stop

parent 1eb0f65f
......@@ -67,6 +67,8 @@ static GstStateChangeReturn gst_rtp_vorbis_pay_change_state (GstElement *
element, GstStateChange transition);
static GstFlowReturn gst_rtp_vorbis_pay_handle_buffer (GstBaseRTPPayload * pad,
GstBuffer * buffer);
static gboolean gst_rtp_vorbis_pay_handle_event (GstPad * pad,
GstEvent * event);
static void
gst_rtp_vorbis_pay_base_init (gpointer klass)
......@@ -97,6 +99,7 @@ gst_rtp_vorbis_pay_class_init (GstRtpVorbisPayClass * klass)
gstbasertppayload_class->set_caps = gst_rtp_vorbis_pay_setcaps;
gstbasertppayload_class->handle_buffer = gst_rtp_vorbis_pay_handle_buffer;
gstbasertppayload_class->handle_event = gst_rtp_vorbis_pay_handle_event;
GST_DEBUG_CATEGORY_INIT (rtpvorbispay_debug, "rtpvorbispay", 0,
"Vorbis RTP Payloader");
......@@ -109,6 +112,14 @@ gst_rtp_vorbis_pay_init (GstRtpVorbisPay * rtpvorbispay,
/* needed because of GST_BOILERPLATE */
}
static void
gst_rtp_vorbis_pay_clear_packet (GstRtpVorbisPay * rtpvorbispay)
{
if (rtpvorbispay->packet)
gst_buffer_unref (rtpvorbispay->packet);
rtpvorbispay->packet = NULL;
}
static void
gst_rtp_vorbis_pay_cleanup (GstRtpVorbisPay * rtpvorbispay)
{
......@@ -116,9 +127,7 @@ gst_rtp_vorbis_pay_cleanup (GstRtpVorbisPay * rtpvorbispay)
g_list_free (rtpvorbispay->headers);
rtpvorbispay->headers = NULL;
if (rtpvorbispay->packet)
gst_buffer_unref (rtpvorbispay->packet);
rtpvorbispay->packet = NULL;
gst_rtp_vorbis_pay_clear_packet (rtpvorbispay);
}
static gboolean
......@@ -635,6 +644,22 @@ header_error:
}
}
static gboolean
gst_rtp_vorbis_pay_handle_event (GstPad * pad, GstEvent * event)
{
GstRtpVorbisPay *rtpvorbispay = GST_RTP_VORBIS_PAY (GST_PAD_PARENT (pad));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_STOP:
gst_rtp_vorbis_pay_clear_packet (rtpvorbispay);
break;
default:
break;
}
/* false to let parent handle event as well */
return FALSE;
}
static GstStateChangeReturn
gst_rtp_vorbis_pay_change_state (GstElement * element,
GstStateChange transition)
......
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