mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-27 00:16:37 +00:00
rtpbuffer: relax arrangement for RTP bufferlists
Don't assume there are exactly 2 buffers but allow cases where the header and payload are in 1 buffer or where the payload is in more buffers.
This commit is contained in:
parent
708b38904f
commit
34ea5bdd06
1 changed files with 25 additions and 19 deletions
|
@ -453,33 +453,20 @@ gst_rtp_buffer_list_validate (GstBufferList * list)
|
||||||
guint8 *packet_payload;
|
guint8 *packet_payload;
|
||||||
guint payload_size;
|
guint payload_size;
|
||||||
guint packet_size;
|
guint packet_size;
|
||||||
|
guint j, n_buffers;
|
||||||
|
|
||||||
/* each group should consists of 2 buffers: one containing the RTP header
|
/* each group should consists of at least 1 buffer: The first buffer always
|
||||||
* and the other one the payload, FIXME, relax the requirement of only one
|
* contains the complete RTP header. Next buffers contain the payload */
|
||||||
* payload buffer. */
|
n_buffers = gst_buffer_list_iterator_n_buffers (it);
|
||||||
if (gst_buffer_list_iterator_n_buffers (it) != 2)
|
if (n_buffers < 1)
|
||||||
goto invalid_list;
|
goto invalid_list;
|
||||||
|
|
||||||
/* get the RTP header */
|
/* get the RTP header (and if n_buffers == 1 also the payload) */
|
||||||
rtpbuf = gst_buffer_list_iterator_next (it);
|
rtpbuf = gst_buffer_list_iterator_next (it);
|
||||||
packet_header = GST_BUFFER_DATA (rtpbuf);
|
packet_header = GST_BUFFER_DATA (rtpbuf);
|
||||||
if (packet_header == NULL)
|
if (packet_header == NULL)
|
||||||
goto invalid_list;
|
goto invalid_list;
|
||||||
|
|
||||||
/* get the payload */
|
|
||||||
paybuf = gst_buffer_list_iterator_next (it);
|
|
||||||
packet_payload = GST_BUFFER_DATA (paybuf);
|
|
||||||
if (packet_payload == NULL) {
|
|
||||||
goto invalid_list;
|
|
||||||
}
|
|
||||||
payload_size = GST_BUFFER_SIZE (paybuf);
|
|
||||||
if (payload_size == 0) {
|
|
||||||
goto invalid_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the size of the RTP packet within the current group */
|
|
||||||
packet_size = GST_BUFFER_SIZE (rtpbuf) + payload_size;
|
|
||||||
|
|
||||||
/* check the sequence number */
|
/* check the sequence number */
|
||||||
if (G_UNLIKELY (i == 0)) {
|
if (G_UNLIKELY (i == 0)) {
|
||||||
prev_seqnum = g_ntohs (GST_RTP_HEADER_SEQ (packet_header));
|
prev_seqnum = g_ntohs (GST_RTP_HEADER_SEQ (packet_header));
|
||||||
|
@ -489,6 +476,25 @@ gst_rtp_buffer_list_validate (GstBufferList * list)
|
||||||
goto invalid_list;
|
goto invalid_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
packet_size = GST_BUFFER_SIZE (rtpbuf);
|
||||||
|
packet_payload = NULL;
|
||||||
|
payload_size = 0;
|
||||||
|
|
||||||
|
/* get the payload buffers */
|
||||||
|
for (j = 1; j < n_buffers; j++) {
|
||||||
|
/* get the payload */
|
||||||
|
paybuf = gst_buffer_list_iterator_next (it);
|
||||||
|
|
||||||
|
if ((packet_payload = GST_BUFFER_DATA (paybuf)) == NULL)
|
||||||
|
goto invalid_list;
|
||||||
|
|
||||||
|
if ((payload_size = GST_BUFFER_SIZE (paybuf)) == 0)
|
||||||
|
goto invalid_list;
|
||||||
|
|
||||||
|
/* the size of the RTP packet within the current group */
|
||||||
|
packet_size += payload_size;
|
||||||
|
}
|
||||||
|
|
||||||
/* validate packet */
|
/* validate packet */
|
||||||
if (!validate_data (packet_header, packet_size, packet_payload,
|
if (!validate_data (packet_header, packet_size, packet_payload,
|
||||||
payload_size)) {
|
payload_size)) {
|
||||||
|
|
Loading…
Reference in a new issue