mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
rtpvorbisdepay: handle packets > 0xffff
Handle input packet sizes larger than 16 bits in the depayloader. Remove size restrictions on the payloader.
This commit is contained in:
parent
43e9b56122
commit
3a1199c2f7
2 changed files with 14 additions and 8 deletions
|
@ -446,6 +446,7 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
||||||
guint32 header, ident;
|
guint32 header, ident;
|
||||||
guint8 F, VDT, packets;
|
guint8 F, VDT, packets;
|
||||||
GstRTPBuffer rtp = { NULL };
|
GstRTPBuffer rtp = { NULL };
|
||||||
|
guint length;
|
||||||
|
|
||||||
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (depayload);
|
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (depayload);
|
||||||
|
|
||||||
|
@ -539,10 +540,14 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
||||||
/* construct assembled buffer */
|
/* construct assembled buffer */
|
||||||
payload_len = gst_adapter_available (rtpvorbisdepay->adapter);
|
payload_len = gst_adapter_available (rtpvorbisdepay->adapter);
|
||||||
payload = gst_adapter_take (rtpvorbisdepay->adapter, payload_len);
|
payload = gst_adapter_take (rtpvorbisdepay->adapter, payload_len);
|
||||||
/* fix the length */
|
|
||||||
payload[0] = ((payload_len - 2) >> 8) & 0xff;
|
/* use this length */
|
||||||
payload[1] = (payload_len - 2) & 0xff;
|
length = payload_len - 2;
|
||||||
|
|
||||||
to_free = payload;
|
to_free = payload;
|
||||||
|
} else {
|
||||||
|
/* read length from data */
|
||||||
|
length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (depayload, "assemble done");
|
GST_DEBUG_OBJECT (depayload, "assemble done");
|
||||||
|
@ -567,9 +572,9 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
||||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*
|
||||||
*/
|
*/
|
||||||
while (payload_len > 2) {
|
while (payload_len > 2) {
|
||||||
guint16 length;
|
if (length == 0)
|
||||||
|
|
||||||
length = GST_READ_UINT16_BE (payload);
|
length = GST_READ_UINT16_BE (payload);
|
||||||
|
|
||||||
payload += 2;
|
payload += 2;
|
||||||
payload_len -= 2;
|
payload_len -= 2;
|
||||||
|
|
||||||
|
@ -604,6 +609,8 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
payload += length;
|
payload += length;
|
||||||
payload_len -= length;
|
payload_len -= length;
|
||||||
|
/* make sure to read next length */
|
||||||
|
length = 0;
|
||||||
|
|
||||||
ret = gst_rtp_base_depayload_push (depayload, outbuf);
|
ret = gst_rtp_base_depayload_push (depayload, outbuf);
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
|
|
|
@ -727,7 +727,7 @@ gst_rtp_vorbis_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
||||||
GST_LOG_OBJECT (rtpvorbispay, "size %" G_GSIZE_FORMAT
|
GST_LOG_OBJECT (rtpvorbispay, "size %" G_GSIZE_FORMAT
|
||||||
", duration %" GST_TIME_FORMAT, size, GST_TIME_ARGS (duration));
|
", duration %" GST_TIME_FORMAT, size, GST_TIME_ARGS (duration));
|
||||||
|
|
||||||
if (G_UNLIKELY (size < 1 || size > 0xffff))
|
if (G_UNLIKELY (size < 1))
|
||||||
goto wrong_size;
|
goto wrong_size;
|
||||||
|
|
||||||
/* find packet type */
|
/* find packet type */
|
||||||
|
@ -822,8 +822,7 @@ done:
|
||||||
wrong_size:
|
wrong_size:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtpvorbispay, STREAM, DECODE,
|
GST_ELEMENT_WARNING (rtpvorbispay, STREAM, DECODE,
|
||||||
("Invalid packet size (1 < %" G_GSIZE_FORMAT " <= 0xffff)", size),
|
("Invalid packet size (1 < %" G_GSIZE_FORMAT ")", size), (NULL));
|
||||||
(NULL));
|
|
||||||
gst_buffer_unmap (buffer, &map);
|
gst_buffer_unmap (buffer, &map);
|
||||||
gst_buffer_unref (buffer);
|
gst_buffer_unref (buffer);
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
|
Loading…
Reference in a new issue