rtpvorbispay: in packed headers, properly flag multibyte lengths.
In the sequence of header lengths, for headers >127 bytes, we use multiple bytes to encode the length. Bytes other than the last must have the top (flag) bit set.
This commit is contained in:
parent
9b7c9208c3
commit
5f9d9e2243
@ -338,6 +338,7 @@ gst_rtp_vorbis_pay_finish_headers (GstBaseRTPPayload * basepayload)
|
|||||||
for (walk = rtpvorbispay->headers; walk; walk = g_list_next (walk)) {
|
for (walk = rtpvorbispay->headers; walk; walk = g_list_next (walk)) {
|
||||||
GstBuffer *buf = GST_BUFFER_CAST (walk->data);
|
GstBuffer *buf = GST_BUFFER_CAST (walk->data);
|
||||||
guint bsize, size, temp;
|
guint bsize, size, temp;
|
||||||
|
guint flag;
|
||||||
|
|
||||||
/* only need to store the length when it's not the last header */
|
/* only need to store the length when it's not the last header */
|
||||||
if (!g_list_next (walk))
|
if (!g_list_next (walk))
|
||||||
@ -355,10 +356,12 @@ gst_rtp_vorbis_pay_finish_headers (GstBaseRTPPayload * basepayload)
|
|||||||
|
|
||||||
bsize = GST_BUFFER_SIZE (buf);
|
bsize = GST_BUFFER_SIZE (buf);
|
||||||
/* write the size backwards */
|
/* write the size backwards */
|
||||||
|
flag = 0;
|
||||||
while (size) {
|
while (size) {
|
||||||
size--;
|
size--;
|
||||||
data[size] = bsize & 0x7f;
|
data[size] = (bsize & 0x7f) | flag;
|
||||||
bsize >>= 7;
|
bsize >>= 7;
|
||||||
|
flag = 0x80; /* Flag bit on all bytes of the length except the last */
|
||||||
}
|
}
|
||||||
data += temp;
|
data += temp;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user