[Live-devel] Zero-copy RTP server?

Ross Finlayson finlayson at live555.com
Wed May 28 01:11:57 PDT 2008


>I have not looked at the livemedia code in depth but my impression 
>is that it is not easy to do a true zero-copy RTP server on linux. 
>I have a zero copy stack for raw UDP using an ethernet controller 
>with h/w checksum and scatter-gather DMA (transmit gathers the 
>header and the payload separately from different addresses) but I am 
>assuming that the live libraries have at least one copy to combine 
>the RTP header and the payload.  Is this impression correct?

I think so.  Our RTP sending implementation - "MultiFramedRTPSink" - 
works (like all "MediaSink" subclasses) by passing a buffer (pointer) 
to the data source object, which will then write its data into that 
buffer.  I suppose you could call that a 'copy', although there's no 
reason why the data source object (e.g., encapsulating an encoding 
card) couldn't just place its encoded data directly into the buffer 
that was provided to it (if, of course, the encoding is taking place 
no faster than the transmitting).

Note also that "MultiFramedRTPSink" leaves space at the front of the 
buffer for the RTP header (plus any payload-format-specific special 
header), so there's no extra copying involved in adding the RTP 
header.

Our code transmits the RTP packets using the standard "sendto()" 
operation (on a datagram socket).

What we could *not* support (at least, not without extensive 
rewriting of the code) is a mechanism whereby the data source 
provides its own buffer (filled in with encoded data), we provide the 
RTP header(s) (in a separate buffer), and then those are combined 
inside the kernel (e.g., using scatter-gather DMA) into a single 
outgoing packet.
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list