[MPlayer-dev-eng] [PATCH] reduce latency for ao_pulse

Dan Oscarsson Dan.Oscarsson at tieto.com
Mon Jul 12 18:38:27 CEST 2010


mplayer uses a call get_delay to the ao when calculation the playing
pts. When trying to get good pts values I found that when using ao pulse
the call get_delay returned wrong answers a short while after a pause or
a seek. My analysis showed that pulseaudio calculates latency in, from
what I can see, wrong way - especially just after a pause or a seek. The
only way, I have found out, to reduce the bad values are to request
pulseaudio to reduce its latency.

The attached patch requests pulseaudio to reduce latency to around 10
ms. Quite often I get a bit more but the results are still better than
without the patch.

You can often see the problem by running mplayer with -ao pulse and the
press blank to pause, blank again to start and see how much a-v sync
gets out of sync. With my patch you mplayer normally gets less out of
sync.

Pulseaudio calculates latency with "sinc latency" + "buffer latency" +
"network latency". The problem is that "sinc latency" changes after a
pause or in the case of a seek (which does a clear all audio data), it
does not go down to zero immediately. My patch reduces the "sink
latency" to a smaller value to reduce its effect on the total latency.

   Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ao_pulse-latency.diff
Type: text/x-patch
Size: 1774 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20100712/b1d3f1b0/attachment.bin>


More information about the MPlayer-dev-eng mailing list