Skip to content

rtp: fix 'size mismatch' on BSD style operating systems

redfast00 requested to merge redfast00/pulseaudio:master into master

At our hackerspace, we had to replace our Linux media server, the new media server has FreeBSD installed on it. We could not get RTP to work and would see sap.c: recvmsg() failed: size mismatch in the logs. After some debugging with Wireshark and some printf's, we found the root cause:

On FreeBSD (and probably other BSDs as well), the FIONREAD ioctl on UDP sockets does not return the size of the next datagram (like it does on Linux), but returns the size of the output buffer: this count contain multiple datagrams and also contains the headers.

We fixed this by taking the result of the FIONREAD as lower bound for the size, adding an upper bound and then removing the check that the sizes should be exactly the same.

Merge request reports