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

Corey Hickey bugfood-ml at fatooh.org
Tue Apr 11 23:45:56 CEST 2006


Uoti Urpala wrote:
> 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.

I can't comment on the code, but I'll test your patches when I have time 
(on the order of a few days) unless somebody else beats me to it.

Thanks for looking into this stuff.

-Corey




More information about the MPlayer-dev-eng mailing list