mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
vorbispay: clear packet on flush-stop
This commit is contained in:
parent
1eb0f65f39
commit
2c6e198157
1 changed files with 28 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue