mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
rtph265depay: implement process_rtp_packet() vfunc
For more optimised RTP packet handling: means we don't need to map the input buffer again but can just re-use the mapping the base class has already done. Based on: https://bugzilla.gnome.org/show_bug.cgi?id=750235 https://bugzilla.gnome.org/show_bug.cgi?id=753228
This commit is contained in:
parent
2d3dc2caa6
commit
fee3129d49
1 changed files with 8 additions and 16 deletions
|
@ -103,7 +103,7 @@ static GstStateChangeReturn gst_rtp_h265_depay_change_state (GstElement *
|
||||||
element, GstStateChange transition);
|
element, GstStateChange transition);
|
||||||
|
|
||||||
static GstBuffer *gst_rtp_h265_depay_process (GstRTPBaseDepayload * depayload,
|
static GstBuffer *gst_rtp_h265_depay_process (GstRTPBaseDepayload * depayload,
|
||||||
GstBuffer * buf);
|
GstRTPBuffer * rtp);
|
||||||
static gboolean gst_rtp_h265_depay_setcaps (GstRTPBaseDepayload * filter,
|
static gboolean gst_rtp_h265_depay_setcaps (GstRTPBaseDepayload * filter,
|
||||||
GstCaps * caps);
|
GstCaps * caps);
|
||||||
static gboolean gst_rtp_h265_depay_handle_event (GstRTPBaseDepayload * depay,
|
static gboolean gst_rtp_h265_depay_handle_event (GstRTPBaseDepayload * depay,
|
||||||
|
@ -133,7 +133,7 @@ gst_rtp_h265_depay_class_init (GstRtpH265DepayClass * klass)
|
||||||
"Jurgen Slowack <jurgenslowack@gmail.com>");
|
"Jurgen Slowack <jurgenslowack@gmail.com>");
|
||||||
gstelement_class->change_state = gst_rtp_h265_depay_change_state;
|
gstelement_class->change_state = gst_rtp_h265_depay_change_state;
|
||||||
|
|
||||||
gstrtpbasedepayload_class->process = gst_rtp_h265_depay_process;
|
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_h265_depay_process;
|
||||||
gstrtpbasedepayload_class->set_caps = gst_rtp_h265_depay_setcaps;
|
gstrtpbasedepayload_class->set_caps = gst_rtp_h265_depay_setcaps;
|
||||||
gstrtpbasedepayload_class->handle_event = gst_rtp_h265_depay_handle_event;
|
gstrtpbasedepayload_class->handle_event = gst_rtp_h265_depay_handle_event;
|
||||||
}
|
}
|
||||||
|
@ -1016,17 +1016,16 @@ not_implemented:
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
gst_rtp_h265_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
gst_rtp_h265_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
|
||||||
{
|
{
|
||||||
GstRtpH265Depay *rtph265depay;
|
GstRtpH265Depay *rtph265depay;
|
||||||
GstBuffer *outbuf = NULL;
|
GstBuffer *outbuf = NULL;
|
||||||
guint8 nal_unit_type;
|
guint8 nal_unit_type;
|
||||||
GstRTPBuffer rtp = { NULL };
|
|
||||||
|
|
||||||
rtph265depay = GST_RTP_H265_DEPAY (depayload);
|
rtph265depay = GST_RTP_H265_DEPAY (depayload);
|
||||||
|
|
||||||
/* flush remaining data on discont */
|
/* flush remaining data on discont */
|
||||||
if (GST_BUFFER_IS_DISCONT (buf)) {
|
if (GST_BUFFER_IS_DISCONT (rtp->buffer)) {
|
||||||
gst_adapter_clear (rtph265depay->adapter);
|
gst_adapter_clear (rtph265depay->adapter);
|
||||||
rtph265depay->wait_start = TRUE;
|
rtph265depay->wait_start = TRUE;
|
||||||
rtph265depay->current_fu_type = 0;
|
rtph265depay->current_fu_type = 0;
|
||||||
|
@ -1047,13 +1046,11 @@ gst_rtp_h265_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
||||||
gboolean donl_present = FALSE;
|
gboolean donl_present = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
timestamp = GST_BUFFER_PTS (buf);
|
timestamp = GST_BUFFER_PTS (rtp->buffer);
|
||||||
|
|
||||||
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
|
payload_len = gst_rtp_buffer_get_payload_len (rtp);
|
||||||
|
payload = gst_rtp_buffer_get_payload (rtp);
|
||||||
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
|
marker = gst_rtp_buffer_get_marker (rtp);
|
||||||
payload = gst_rtp_buffer_get_payload (&rtp);
|
|
||||||
marker = gst_rtp_buffer_get_marker (&rtp);
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (rtph265depay, "receiving %d bytes", payload_len);
|
GST_DEBUG_OBJECT (rtph265depay, "receiving %d bytes", payload_len);
|
||||||
|
|
||||||
|
@ -1319,7 +1316,6 @@ gst_rtp_h265_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gst_rtp_buffer_unmap (&rtp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return outbuf;
|
return outbuf;
|
||||||
|
@ -1328,13 +1324,11 @@ gst_rtp_h265_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
||||||
empty_packet:
|
empty_packet:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (rtph265depay, "empty packet");
|
GST_DEBUG_OBJECT (rtph265depay, "empty packet");
|
||||||
gst_rtp_buffer_unmap (&rtp);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
waiting_start:
|
waiting_start:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (rtph265depay, "waiting for start");
|
GST_DEBUG_OBJECT (rtph265depay, "waiting for start");
|
||||||
gst_rtp_buffer_unmap (&rtp);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -1342,7 +1336,6 @@ not_implemented_donl_present:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (rtph265depay, STREAM, FORMAT,
|
GST_ELEMENT_ERROR (rtph265depay, STREAM, FORMAT,
|
||||||
(NULL), ("DONL field present not supported yet"));
|
(NULL), ("DONL field present not supported yet"));
|
||||||
gst_rtp_buffer_unmap (&rtp);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1350,7 +1343,6 @@ not_implemented:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (rtph265depay, STREAM, FORMAT,
|
GST_ELEMENT_ERROR (rtph265depay, STREAM, FORMAT,
|
||||||
(NULL), ("NAL unit type %d not supported yet", nal_unit_type));
|
(NULL), ("NAL unit type %d not supported yet", nal_unit_type));
|
||||||
gst_rtp_buffer_unmap (&rtp);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue