mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
rtpbasedepayload: Only aggregate RTP header extensions if in use
Right now we split the RTP header from the current buffer into a new buffer and aggregate those buffers for later processing if the depayloader creates an output buffer. This is cumbersome as it happens even if none of the incoming RTP buffers carries RTP header extensions at all just because header aggregation has been enabled in the depayloader class. This commit will start aggregation only in case that there really are RTP header extensions available on an incoming RTP buffer. The check is trivial and cheap. Once activated we keep aggregation active for all buffers. The active state is reset on state change READY_TO_PAUSE. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5278>
This commit is contained in:
parent
237d195209
commit
372709400f
1 changed files with 14 additions and 2 deletions
|
@ -110,6 +110,7 @@ struct _GstRTPBaseDepayloadPrivate
|
||||||
|
|
||||||
/* maintain buffer list for header extensions read() */
|
/* maintain buffer list for header extensions read() */
|
||||||
gboolean hdrext_aggregate;
|
gboolean hdrext_aggregate;
|
||||||
|
gboolean hdrext_seen;
|
||||||
GstBufferList *hdrext_buffers;
|
GstBufferList *hdrext_buffers;
|
||||||
GstBuffer *hdrext_delayed;
|
GstBuffer *hdrext_delayed;
|
||||||
GstBuffer *hdrext_outbuf;
|
GstBuffer *hdrext_outbuf;
|
||||||
|
@ -449,6 +450,7 @@ gst_rtp_base_depayload_init (GstRTPBaseDepayload * filter,
|
||||||
priv->max_reorder = DEFAULT_MAX_REORDER;
|
priv->max_reorder = DEFAULT_MAX_REORDER;
|
||||||
priv->auto_hdr_ext = DEFAULT_AUTO_HEADER_EXTENSION;
|
priv->auto_hdr_ext = DEFAULT_AUTO_HEADER_EXTENSION;
|
||||||
priv->hdrext_aggregate = FALSE;
|
priv->hdrext_aggregate = FALSE;
|
||||||
|
priv->hdrext_seen = FALSE;
|
||||||
|
|
||||||
gst_segment_init (&filter->segment, GST_FORMAT_UNDEFINED);
|
gst_segment_init (&filter->segment, GST_FORMAT_UNDEFINED);
|
||||||
|
|
||||||
|
@ -859,8 +861,14 @@ gst_rtp_base_depayload_handle_buffer (GstRTPBaseDepayload * filter,
|
||||||
g_assert_null (priv->hdrext_delayed);
|
g_assert_null (priv->hdrext_delayed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update RTP buffer cache for header extensions */
|
/* update RTP buffer cache for header extensions if any */
|
||||||
if (priv->hdrext_aggregate) {
|
if (priv->hdrext_aggregate &&
|
||||||
|
!priv->hdrext_seen && gst_rtp_buffer_get_extension (&rtp)) {
|
||||||
|
GST_INFO_OBJECT (filter, "Activate RTP header ext aggregation");
|
||||||
|
priv->hdrext_seen = priv->hdrext_aggregate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->hdrext_seen) {
|
||||||
GstBuffer *b = gst_buffer_new ();
|
GstBuffer *b = gst_buffer_new ();
|
||||||
/* make a copy of the buffer that only contains the RTP header
|
/* make a copy of the buffer that only contains the RTP header
|
||||||
with the extensions to not waste too much memory */
|
with the extensions to not waste too much memory */
|
||||||
|
@ -1685,6 +1693,10 @@ gst_rtp_base_depayload_change_state (GstElement * element,
|
||||||
priv->negotiated = FALSE;
|
priv->negotiated = FALSE;
|
||||||
priv->discont = FALSE;
|
priv->discont = FALSE;
|
||||||
priv->segment_seqnum = GST_SEQNUM_INVALID;
|
priv->segment_seqnum = GST_SEQNUM_INVALID;
|
||||||
|
priv->hdrext_seen = FALSE;
|
||||||
|
if (priv->hdrext_delayed)
|
||||||
|
gst_buffer_unref (priv->hdrext_delayed);
|
||||||
|
gst_rtp_base_depayload_reset_hdrext_buffers (filter);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue