[MPlayer-G2-dev] a-v sync again
Arpi
arpi at thot.banki.hu
Fri May 9 01:22:46 CEST 2003
Hi,
I've introduced pts_bytes in dp (demux_packet struct), as the initializer
value for ds->pts_bytes, it solved vob's lpcm/ac3 pts delay problems.
Thanks to Vektor for tips :)
Anyway mpeg audio is still inaccurate, unless I delay PTS to the next
compelte audio header. And PTS is still for teh end of frame, not the start.
I think i can't avoid introducing some flags into ds struct, describing the
timing/PTS behaviour for teh given container/stream format.
It could solve such problems for long period.
(but gives some confitions which means more testing and less generic code :(()
Btw now that PTS calculation is abouut 100 times more precise, than in g1,
a new problem raised: waveing.
Now the correction loop works this way, done after each displayed frame:
AV_delay=a_pts-v_pts-delay;
x=AV_delay*0.1;
if(x<-max_pts_correction) x=-max_pts_correction; else
if(x> max_pts_correction) x= max_pts_correction;
delay+=x;
It worked fine in g1, but now, with accurate PTS values, it is waving,
when AV_delay!=0.0:
As AV_delay>0, x>0, delay is increased, it starts decreasing AV_delay but it
is decreased faster than should so it goes negative. then x<=0, resulting
AV_delay increasing again, and so on. in a few (10-20) secs it stabilizes
around 0, but this is not good. For big initial AV_delay (like 330ms for
some LCPM VOBs) it just keep waving for a minute.
I guess the silly (found by trial&error) x=AV_delay*0.1; eq. should be
replaced by something better, probably something using pow().
It could also help to do smaller corrections for small AV_delay and big
corrections (faster reaction) to big delay, and avoid waving at the same
time. Anyone with better math background, could suggest sth good? :)
A'rpi / Astral & ESP-team
--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu
More information about the MPlayer-G2-dev
mailing list