summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2013-11-21 11:32:15 +0100
committerWim Taymans <wtaymans@redhat.com>2013-11-21 11:32:15 +0100
commit3a1199c2f774450608061c7c70317cd60fa071cb (patch)
tree8c57bc9e4b26f60a3b949af3098d7593afe7cdb3
parent43e9b561223f1da28c21235b4e2cef3b4a0471d8 (diff)
rtpvorbisdepay: handle packets > 0xffff
Handle input packet sizes larger than 16 bits in the depayloader. Remove size restrictions on the payloader.
-rw-r--r--gst/rtp/gstrtpvorbisdepay.c17
-rw-r--r--gst/rtp/gstrtpvorbispay.c5
2 files changed, 14 insertions, 8 deletions
diff --git a/gst/rtp/gstrtpvorbisdepay.c b/gst/rtp/gstrtpvorbisdepay.c
index 77097510d..313a6edf6 100644
--- a/gst/rtp/gstrtpvorbisdepay.c
+++ b/gst/rtp/gstrtpvorbisdepay.c
@@ -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)
diff --git a/gst/rtp/gstrtpvorbispay.c b/gst/rtp/gstrtpvorbispay.c
index b7ff2ccf2..7272e127d 100644
--- a/gst/rtp/gstrtpvorbispay.c
+++ b/gst/rtp/gstrtpvorbispay.c
@@ -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;