mpegtsdemux: Fix wrong usage of '<<' operator

Detected by GCC 7.

Add comments for clarity

https://bugzilla.gnome.org/show_bug.cgi?id=779333
This commit is contained in:
Edward Hervey 2017-02-28 09:26:25 +01:00 committed by Edward Hervey
parent 266324b97a
commit fcf87ef2bf

View file

@ -314,14 +314,23 @@ mpegts_parse_pes_header (const guint8 * data, gsize length, PESHeader * res)
}
if (flags & 0x10) {
/* P-STD */
/* P-STD
* '01' : 2 bits
* P-STD_buffer_scale : 1 bit
* P-STD_buffer_size : 13 bits
* */
if (G_UNLIKELY (length < 2))
goto need_more_data;
val8 = *data;
if (G_UNLIKELY ((val8 & 0xc0) != 0x40))
goto bad_P_STD_marker;
/* If P-STD_buffer_scale is 0
* multiply by 128 (i.e. << 7),
* else
* multiply by 1024 (i.e. << 10)
*/
res->P_STD_buffer_size =
(GST_READ_UINT16_BE (data) & 0x1fff) << (val8 & 0x20) ? 10 : 7;
(GST_READ_UINT16_BE (data) & 0x1fff) << ((val8 & 0x20) ? 10 : 7);
GST_LOG ("P_STD_buffer_size : %d", res->P_STD_buffer_size);
data += 2;
length -= 2;