From 4788a3da0dd26a8c64ea6c49846a0cb1e831f41c Mon Sep 17 00:00:00 2001 From: Jochen Henneberg Date: Sun, 17 Sep 2023 18:47:31 +0200 Subject: [PATCH] rtpasfdepay: Enabled header extension aggregation Because this depayloader may build several output buffers within one process run we push them all into a GstBufferList and push them out at once to make sure that each buffer gets notified about each header extension. Part-of: --- .../gst/asfdemux/gstrtpasfdepay.c | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-ugly/gst/asfdemux/gstrtpasfdepay.c b/subprojects/gst-plugins-ugly/gst/asfdemux/gstrtpasfdepay.c index c9e247202b..0fc14a4e12 100644 --- a/subprojects/gst-plugins-ugly/gst/asfdemux/gstrtpasfdepay.c +++ b/subprojects/gst-plugins-ugly/gst/asfdemux/gstrtpasfdepay.c @@ -104,6 +104,9 @@ gst_rtp_asf_depay_class_init (GstRtpAsfDepayClass * klass) static void gst_rtp_asf_depay_init (GstRtpAsfDepay * depay) { + gst_rtp_base_depayload_set_aggregate_hdrext_enabled (GST_RTP_BASE_DEPAYLOAD + (depay), TRUE); + depay->adapter = gst_adapter_new (); } @@ -335,6 +338,7 @@ gst_rtp_asf_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) GstRtpAsfDepay *depay; const guint8 *payload; GstBuffer *outbuf; + GstBufferList *outbufs = NULL; gboolean S, L, R, D, I; guint payload_len, hdr_len, offset; guint len_offs; @@ -359,6 +363,7 @@ gst_rtp_asf_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) GST_LOG_OBJECT (depay, "got payload len of %u", payload_len); + outbufs = gst_buffer_list_new (); do { guint packet_len; @@ -473,9 +478,12 @@ gst_rtp_asf_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) gst_rtp_buffer_get_payload_subbuffer (&rtpbuf, offset, packet_len); } - /* If we haven't completed a full ASF packet, return */ - if (!outbuf) + /* If we haven't completed a full ASF packet, return but first + push what we have so far */ + if (!outbuf) { + gst_rtp_base_depayload_push_list (depayload, outbufs); return NULL; + } outbuf = gst_rtp_asf_depay_update_padding (depay, outbuf); @@ -490,7 +498,7 @@ gst_rtp_asf_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) GST_BUFFER_TIMESTAMP (outbuf) = timestamp; - gst_rtp_base_depayload_push (depayload, outbuf); + gst_buffer_list_add (outbufs, outbuf); /* only apply the timestamp to the first buffer of this packet */ timestamp = -1; @@ -501,6 +509,8 @@ gst_rtp_asf_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) payload_len -= packet_len; } while (payload_len > 0); + gst_rtp_base_depayload_push_list (depayload, outbufs); + gst_rtp_buffer_unmap (&rtpbuf); return NULL; @@ -511,6 +521,12 @@ too_small: gst_rtp_buffer_unmap (&rtpbuf); GST_WARNING_OBJECT (depayload, "Payload too small, expected at least 4 " "bytes for header, but got only %d bytes", payload_len); + if (gst_buffer_list_length (outbufs) == 0) { + gst_rtp_base_depayload_dropped (depayload); + gst_buffer_list_unref (outbufs); + } else { + gst_rtp_base_depayload_push_list (depayload, outbufs); + } return NULL; } }