[MPlayer-users] Some questions about the synchronization code
Luca Abeni
luca at cse.ogi.edu
Fri Jan 18 23:43:02 CET 2002
Hi all,
I am currently trying to study the mplayer A/V synchronization code, but
there are some things in it that I don't understand very well; I hope
that someone here can explain them to me.
First of all, this is my understanding: the sh_video->timer and
sh_audio->timer values are used to decide when to play a video frame, in
order to synchronize it with the audio (sleeping until the correct
time).
If I understand well, sh_video->timer is something like a value that is
increased by 1/fps at each video frame, and I imagine that
sh_audio->timer is a similar value for the audio.
Is this understanding correct (or not too incorrect)?
Based on this, I can understand the block of code marked by the comment
/* Arpi's AV-sync */
however, I don't understand how the code commented as /* DaP's AV-sync
*/ works (BTW: if I use this ``dapsync'' mode, mplayer always drops some
frame at the beginning - and I have a very fast CPU)
Now, I have some other questions regarding the block of code commented
as
A-V TIMESTAMP CORRECTION
how does it work? I see that it computes the A/V delay based on the
audio and video timestamps (are these timestamps the one encoded in the
stream?) and uses it to ``correct'' the sh_audio->timer value...
But I don't understand the meaning of this... Why is this correction
needed?
Moreover, it seems to me that the sh_video->timer and sh_audio->timer
are similar to the d_video->pts and d_audio->pts values... Is this
understanding correct? If yes, which is the difference? Why are the
*->timer values used for A/V synchronization, instead of the *->pts
values?
I am sorry if some (or possibly all) of these questions are stupid... I
am just beginning to understand the code, and I hope that someone could
help me.
Does some document explaining this A/V synchronization stuff exist? If
yes, where can I find it?
Thanks in advance,
Luca
More information about the MPlayer-users
mailing list