[Live-devel] Is memmove() necessary when using blocking call?
Ross Finlayson
finlayson at live555.com
Mon May 11 02:41:18 PDT 2020
> On May 11, 2020, at 9:19 PM, Avramoni, Sorin <sorin.avramoni at intel.com> wrote:
>
> I am wonder since I have a blocking mechanism it is possible to not use memmove() and just use a reference to my buffers?
Generally speaking, no, because the data in your buffer is not the only data that gets sent in a RTP packet. There is also the RTP header, which the LIVE555 library puts in each outgoing UDP packet, before your payload data. Therefore it would not be possible to send a RTP packet by just passing a pointer to your payload data, without copying the data.
Things get even more complicated if your payload data is too large to fit in an outgoing UDP packet. In that case, the LIVE555 library has to construct a RTP header (and perhaps an extra ‘fragmentation header’, depending on the RTP payload type) for each outgoing packet. Your payload data will end up being split among multiple outgoing RTP packets.
(Yes, it might be possible to avoid some data copying using a ‘scatter-gather’ I/O interface (e.g., using “sendmmsg()”), but that would require a major (and non-backward-compatible) overhaul of LIVE555’s buffering mechanism - something that’s not likely to happen anytime soon.)
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the live-devel
mailing list