[MPlayer-dev-eng] [PATCH] Better way to calculate current audio pts

Uoti Urpala uoti.urpala at pp1.inet.fi
Tue Apr 11 20:12:03 CEST 2006


MPlayer calculates current audio pts by taking the last known pts in
packets read by the audio decoder and adding bytes read after that
divided by decoder input bitrate. This method is inaccurate by design
because the input bitrate need not be constant, and even when it is
constant the correct value is not always known. This patch adds a more
accurate method where the audio decoder updates the last known pts value
and decoded bytes written after the pts position, and adds support for
this method to the libvorbis, faad and ffmpeg audio decoders. Combined
with the earlier patches I've posted this finally makes the av sync
calculations accurate enough; on my system the sync value shown on the
status line mostly stays below 2 ms.

The patch assumes my earlier patches have already been applied. As
mentioned in the comments the definitions of MP_NOPTS_VALUE should come
from a header file, but as noted by Michael when he added the definition
to libmpcodecs/vf.h there currently doesn't seem to be a good header for
miscellaneous defines that should be visible in most other files.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: audiopts.diff
Type: text/x-patch
Size: 8028 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20060411/e0b58ec6/attachment.bin>


More information about the MPlayer-dev-eng mailing list