mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
rtpgstdepay: flush on FLUSH_STOP event
This commit is contained in:
parent
5ff9093843
commit
69b0dcd7df
1 changed files with 34 additions and 8 deletions
|
@ -49,10 +49,13 @@ G_DEFINE_TYPE (GstRtpGSTDepay, gst_rtp_gst_depay, GST_TYPE_RTP_BASE_DEPAYLOAD);
|
||||||
|
|
||||||
static void gst_rtp_gst_depay_finalize (GObject * object);
|
static void gst_rtp_gst_depay_finalize (GObject * object);
|
||||||
|
|
||||||
|
static gboolean gst_rtp_gst_depay_handle_event (GstRTPBaseDepayload * depay,
|
||||||
|
GstEvent * event);
|
||||||
static GstStateChangeReturn gst_rtp_gst_depay_change_state (GstElement *
|
static GstStateChangeReturn gst_rtp_gst_depay_change_state (GstElement *
|
||||||
element, GstStateChange transition);
|
element, GstStateChange transition);
|
||||||
|
|
||||||
static void gst_rtp_gst_depay_reset (GstRtpGSTDepay * rtpgstdepay);
|
static void gst_rtp_gst_depay_reset (GstRtpGSTDepay * rtpgstdepay, gboolean
|
||||||
|
full);
|
||||||
static gboolean gst_rtp_gst_depay_setcaps (GstRTPBaseDepayload * depayload,
|
static gboolean gst_rtp_gst_depay_setcaps (GstRTPBaseDepayload * depayload,
|
||||||
GstCaps * caps);
|
GstCaps * caps);
|
||||||
static GstBuffer *gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload,
|
static GstBuffer *gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload,
|
||||||
|
@ -86,6 +89,7 @@ gst_rtp_gst_depay_class_init (GstRtpGSTDepayClass * klass)
|
||||||
"Extracts GStreamer buffers from RTP packets",
|
"Extracts GStreamer buffers from RTP packets",
|
||||||
"Wim Taymans <wim.taymans@gmail.com>");
|
"Wim Taymans <wim.taymans@gmail.com>");
|
||||||
|
|
||||||
|
gstrtpbasedepayload_class->handle_event = gst_rtp_gst_depay_handle_event;
|
||||||
gstrtpbasedepayload_class->set_caps = gst_rtp_gst_depay_setcaps;
|
gstrtpbasedepayload_class->set_caps = gst_rtp_gst_depay_setcaps;
|
||||||
gstrtpbasedepayload_class->process = gst_rtp_gst_depay_process;
|
gstrtpbasedepayload_class->process = gst_rtp_gst_depay_process;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +107,7 @@ gst_rtp_gst_depay_finalize (GObject * object)
|
||||||
|
|
||||||
rtpgstdepay = GST_RTP_GST_DEPAY (object);
|
rtpgstdepay = GST_RTP_GST_DEPAY (object);
|
||||||
|
|
||||||
gst_rtp_gst_depay_reset (rtpgstdepay);
|
gst_rtp_gst_depay_reset (rtpgstdepay, TRUE);
|
||||||
g_object_unref (rtpgstdepay->adapter);
|
g_object_unref (rtpgstdepay->adapter);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
@ -118,14 +122,16 @@ store_cache (GstRtpGSTDepay * rtpgstdepay, guint CV, GstCaps * caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_gst_depay_reset (GstRtpGSTDepay * rtpgstdepay)
|
gst_rtp_gst_depay_reset (GstRtpGSTDepay * rtpgstdepay, gboolean full)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
gst_adapter_clear (rtpgstdepay->adapter);
|
gst_adapter_clear (rtpgstdepay->adapter);
|
||||||
rtpgstdepay->current_CV = 0;
|
if (full) {
|
||||||
for (i = 0; i < 8; i++)
|
rtpgstdepay->current_CV = 0;
|
||||||
store_cache (rtpgstdepay, i, NULL);
|
for (i = 0; i < 8; i++)
|
||||||
|
store_cache (rtpgstdepay, i, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -481,6 +487,26 @@ missing_caps:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_rtp_gst_depay_handle_event (GstRTPBaseDepayload * depay, GstEvent * event)
|
||||||
|
{
|
||||||
|
GstRtpGSTDepay *rtpgstdepay;
|
||||||
|
|
||||||
|
rtpgstdepay = GST_RTP_GST_DEPAY (depay);
|
||||||
|
|
||||||
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
|
case GST_EVENT_FLUSH_STOP:
|
||||||
|
gst_rtp_gst_depay_reset (rtpgstdepay, FALSE);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
GST_RTP_BASE_DEPAYLOAD_CLASS (parent_class)->handle_event (depay, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
gst_rtp_gst_depay_change_state (GstElement * element, GstStateChange transition)
|
gst_rtp_gst_depay_change_state (GstElement * element, GstStateChange transition)
|
||||||
{
|
{
|
||||||
|
@ -491,7 +517,7 @@ gst_rtp_gst_depay_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
gst_rtp_gst_depay_reset (rtpgstdepay);
|
gst_rtp_gst_depay_reset (rtpgstdepay, TRUE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -501,7 +527,7 @@ gst_rtp_gst_depay_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
gst_rtp_gst_depay_reset (rtpgstdepay);
|
gst_rtp_gst_depay_reset (rtpgstdepay, TRUE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue