Commit 3a1199c2 authored by Wim Taymans's avatar Wim Taymans

rtpvorbisdepay: handle packets > 0xffff

Handle input packet sizes larger than 16 bits in the depayloader.
Remove size restrictions on the payloader.
parent 43e9b561
......@@ -446,6 +446,7 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
guint32 header, ident;
guint8 F, VDT, packets;
GstRTPBuffer rtp = { NULL };
guint length;
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (depayload);
......@@ -539,10 +540,14 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
/* construct assembled buffer */
payload_len = gst_adapter_available (rtpvorbisdepay->adapter);
payload = gst_adapter_take (rtpvorbisdepay->adapter, payload_len);
/* fix the length */
payload[0] = ((payload_len - 2) >> 8) & 0xff;
payload[1] = (payload_len - 2) & 0xff;
/* use this length */
length = payload_len - 2;
to_free = payload;
} else {
/* read length from data */
length = 0;
}
GST_DEBUG_OBJECT (depayload, "assemble done");
......@@ -567,9 +572,9 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*
*/
while (payload_len > 2) {
guint16 length;
if (length == 0)
length = GST_READ_UINT16_BE (payload);
length = GST_READ_UINT16_BE (payload);
payload += 2;
payload_len -= 2;
......@@ -604,6 +609,8 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
payload += length;
payload_len -= length;
/* make sure to read next length */
length = 0;
ret = gst_rtp_base_depayload_push (depayload, outbuf);
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
", duration %" GST_TIME_FORMAT, size, GST_TIME_ARGS (duration));
if (G_UNLIKELY (size < 1 || size > 0xffff))
if (G_UNLIKELY (size < 1))
goto wrong_size;
/* find packet type */
......@@ -822,8 +822,7 @@ done:
wrong_size:
{
GST_ELEMENT_WARNING (rtpvorbispay, STREAM, DECODE,
("Invalid packet size (1 < %" G_GSIZE_FORMAT " <= 0xffff)", size),
(NULL));
("Invalid packet size (1 < %" G_GSIZE_FORMAT ")", size), (NULL));
gst_buffer_unmap (buffer, &map);
gst_buffer_unref (buffer);
return GST_FLOW_OK;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment