mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
gstdepay: check for correct fragment offset
Make sure we only insert the rtp packet in the adapter when the frag_offset matches. When the first packet of a fragment is dropped, it avoids putting the remaining packets in the adapter and processing the partial fragment. Conflicts: gst/rtp/gstrtpgstdepay.c
This commit is contained in:
parent
8a402e0c06
commit
c0713e4b80
1 changed files with 14 additions and 4 deletions
|
@ -190,7 +190,7 @@ gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
|||
GstBuffer *subbuf, *outbuf = NULL;
|
||||
gint payload_len;
|
||||
guint8 *payload;
|
||||
guint CV;
|
||||
guint CV, frag_offset, avail;
|
||||
GstRTPBuffer rtp = { NULL };
|
||||
|
||||
rtpgstdepay = GST_RTP_GST_DEPAY (depayload);
|
||||
|
@ -219,9 +219,12 @@ gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
|||
* | Frag_offset |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
/* frag_offset =
|
||||
* (payload[4] << 24) | (payload[5] << 16) | (payload[6] << 8) | payload[7];
|
||||
*/
|
||||
frag_offset =
|
||||
(payload[4] << 24) | (payload[5] << 16) | (payload[6] << 8) | payload[7];
|
||||
|
||||
avail = gst_adapter_available (rtpgstdepay->adapter);
|
||||
if (avail != frag_offset)
|
||||
goto wrong_frag;
|
||||
|
||||
/* subbuffer skipping the 8 header bytes */
|
||||
subbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, 8, -1);
|
||||
|
@ -324,6 +327,13 @@ empty_packet:
|
|||
gst_rtp_buffer_unmap (&rtp);
|
||||
return NULL;
|
||||
}
|
||||
wrong_frag:
|
||||
{
|
||||
gst_adapter_clear (rtpgstdepay->adapter);
|
||||
gst_rtp_buffer_unmap (&rtp);
|
||||
GST_LOG_OBJECT (rtpgstdepay, "wrong fragment, skipping");
|
||||
return NULL;
|
||||
}
|
||||
too_small:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpgstdepay, STREAM, DECODE,
|
||||
|
|
Loading…
Reference in a new issue