[libav-tools] libav UDP stream and packet loss in mixed 100/1000 network

Christian Robottom Reis kiko at async.com.br
Wed Jul 8 00:09:33 CEST 2015


On Mon, Jul 06, 2015 at 06:28:07PM +0200, Luca Barbato wrote:
> > With tcpdump we can actually confirm that 30% of the packets being sent
> > never hit omxplayer. The question we've been unable to answer is where
> > are the packets being dropped -- neither ifconfig nor netstat -us can
> > match the actual number of lost packets, which we can tell by capturing
> > on both sender and receiver.
> 
> You need to tune your udp system buffers so packets do not end lost
> because either buffer can't keep up with them.
> 
> -buffer_size 2M should be enough to fix it.

I assume you're referring to the buffer_size argument to the udp://
specifier, but simply adding a ?buffer_size=2M to it did not make a
difference.

In fact, I had to do quite a few things to reduce the loss significantly:

    - Enabled RX/TX flow control on the switch port for the sender
        (I would have done the same for the receiver but I don't think
        the RPi's NIC does flow control)

    - Changed a few kernel networking parameters on the receiver side,
      including udp_rmem, udp_wmem and the netdev max_backlog.

    - Used a -crf of 35

I really think avconv should be pacing the data output to avoid
congestion, but perhaps I'm missing something obvious.
-- 
Christian Robottom Reis | [+55 16] 3376 0125   | http://async.com.br/~kiko
CEO, Async Open Source  | [+55 16] 9 9112 6430 | http://launchpad.net/~kiko


More information about the libav-tools mailing list