We are currently experiencing downtime impacting viewing & cloning the Mesa repo, and some GitLab pages returning 503. Please see #freedesktop on IRC for more updates.

Commit e693d297 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

rtpvorbispay: When getting new headers, replace the old version of them

This prevents storing an infinite amount of e.g. comment headers if they
come without a new initialization header in front of them. There can
only be one header of each type.
parent eefcdc9e
......@@ -780,17 +780,45 @@ gst_rtp_vorbis_pay_handle_buffer (GstRTPBasePayload * basepayload,
/* we need to collect the headers and construct a config string from them */
if (VDT != 0) {
rtpvorbispay->need_headers = TRUE;
if (!rtpvorbispay->need_headers && VDT == 1) {
GST_INFO_OBJECT (rtpvorbispay, "getting new headers, replace existing");
g_list_free_full (rtpvorbispay->headers,
(GDestroyNotify) gst_buffer_unref);
rtpvorbispay->headers = NULL;
rtpvorbispay->need_headers = TRUE;
}
GST_DEBUG_OBJECT (rtpvorbispay, "collecting header");
/* append header to the list of headers */
/* append header to the list of headers, or replace
* if the same type of header was already in there.
*
* This prevents storing an infinite amount of e.g. comment headers, there
* must only be one */
gst_buffer_unmap (buffer, &map);
rtpvorbispay->headers = g_list_append (rtpvorbispay->headers, buffer);
if (rtpvorbispay->headers) {
gboolean found = FALSE;
GList *l;
guint8 new_header_type;
gst_buffer_extract (buffer, 0, &new_header_type, 1);
for (l = rtpvorbispay->headers; l; l = l->next) {
GstBuffer *header = l->data;
guint8 header_type;
if (gst_buffer_extract (header, 0, &header_type, 1)
&& header_type == new_header_type) {
found = TRUE;
gst_buffer_unref (header);
l->data = buffer;
}
}
if (!found)
rtpvorbispay->headers = g_list_append (rtpvorbispay->headers, buffer);
} else {
rtpvorbispay->headers = g_list_append (rtpvorbispay->headers, buffer);
}
ret = GST_FLOW_OK;
goto done;
} else if (rtpvorbispay->headers && rtpvorbispay->need_headers) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment