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

Corey Hickey bugfood-ml at fatooh.org
Fri Apr 14 08:02:54 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.

I see a marked improvement on many files, including ones where the audio 
is decoded by liba52 or mp3lame. Do those decoders not need patching?

The only unimproved files I've found so far are dumpstreams of a DVD; 
oddly enough, the DVD itself is improved, and I'm at a loss as to why.

I don't have time to comprehend your patch right now, but it does look 
interesting and I hope somebody else reviews it. Seeing an 
almost-continuous 0.000s sync value is very nice.

By the way, you've sent several patches recently that haven't gotten 
much attention. If they get ignored for a while, politely make some 
noise and hopefully they'll get reviewed.

-Corey




More information about the MPlayer-dev-eng mailing list