rtpbasepayload: don't write empty extension header

When some header extensions are present but none decides to write any
data to the currently processed RTP buffer, remove the extension data
section.

Resulting RTP buffer wasn't formatted correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1173>
This commit is contained in:
Jakub Adam 2021-05-24 19:11:51 +02:00 committed by Jakub Adam
parent d294d7da36
commit 556ce36ce4

View file

@ -1764,13 +1764,17 @@ set_headers (GstBuffer ** buffer, guint idx, gpointer user_data)
g_ptr_array_foreach (data->payload->priv->header_exts,
(GFunc) write_header_extension, &hdrext);
wordlen = hdrext.written_size / 4 + ((hdrext.written_size % 4) ? 1 : 0);
if (hdrext.written_size > 0) {
wordlen = hdrext.written_size / 4 + ((hdrext.written_size % 4) ? 1 : 0);
/* zero-fill the hdrext padding bytes */
memset (&hdrext.data[hdrext.written_size], 0,
wordlen * 4 - hdrext.written_size);
/* zero-fill the hdrext padding bytes */
memset (&hdrext.data[hdrext.written_size], 0,
wordlen * 4 - hdrext.written_size);
gst_rtp_buffer_set_extension_data (&rtp, bit_pattern, wordlen);
gst_rtp_buffer_set_extension_data (&rtp, bit_pattern, wordlen);
} else {
gst_rtp_buffer_remove_extension_data (&rtp);
}
}
GST_OBJECT_UNLOCK (data->payload);
gst_rtp_buffer_unmap (&rtp);