Skip to content

rtpjpegpay: fix image corruption when compiled with MSVC on Windows

On Windows with MSVC, jpeg_header_size would end up 2 bytes larger than it should be. This then leads to the first 2 bytes of the actual jpeg image data to be dropped, because we think those belong to the header, which results in an undecodable image when reconstructed in the depayloader.

What happens is that when the compiler evaluates

jpeg_header_size = mem.offset + read_u16_and_inc_offset_by_2(&mem);

it actually uses the mem.offset value after it has been increased by the function call on the right hand size of the equation.

I don't even. C, I guess.

Fixes #889 (closed)

Merge request reports