rtp: don't use memblocks for non-audio data
authorTanu Kaskinen <tanuk@iki.fi>
Tue, 20 Sep 2016 09:59:04 +0000 (12:59 +0300)
committerTanu Kaskinen <tanuk@iki.fi>
Mon, 19 Dec 2016 23:13:48 +0000 (01:13 +0200)
commit3e52972c610f0609c11e592c761379ea6ab8803f
tree64ef9b229d5dcdde3a7ac4a10f21ee8349c3c110
parent509cfd9138c59802ece75e8ebd43b0b07c28c6d0
rtp: don't use memblocks for non-audio data

pa_memblockq_push() expects all memchunks to be aligned to PCM frame
boundaries, and that means both the index and length fields of
pa_memchunk. pa_rtp_recv(), however, used a memblock for storing both
the RTP packet metadata and the actual audio data. The metadata was
"removed" from the audio data by setting the memchunk index
appropriately, so the metadata stayed in the memblock, but it was not
played back. The metadata length is not necessarily divisible by the PCM
frame size, which caused pa_memblock_push() to crash in an assertion
with some sample specs, because the memchunk index was not properly
aligned. In my tests the metadata length was 12, so it was compatible
with many configurations, but eight-channel audio didn't work.

This patch adds a separate buffer for receiving the RTP packets. As a
result, an extra memcpy is needed for moving the audio data from the
receive buffer to the memblock buffer.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=96612
src/modules/rtp/rtp.c
src/modules/rtp/rtp.h