Skip to content

Commit

Permalink
rtpbasepayload: don't write empty extension header
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
xhaakon committed Jun 28, 2021
1 parent d294d7d commit 556ce36
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions gst-libs/gst/rtp/gstrtpbasepayload.c
Expand Up @@ -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);
Expand Down

0 comments on commit 556ce36

Please sign in to comment.