Posts: 2,752
Joined: Dec 2008
Reputation:
23
bobo1on1
cheapass Team-XBMC Developer
Posts: 2,752
2010-11-04, 20:35
(This post was last modified: 2010-11-04, 21:54 by bobo1on1.)
I would expect the averaging to take care of that though.
You could interpolate the time in CVideoReferenceClock::GetTime by using the difference between the last vblank time and the system time, but since there is jitter in the vblank signal that might not be a very good solution, I'd would rather see that CDVDPlayerAudio can handle the clock jitter.
Posts: 2,752
Joined: Dec 2008
Reputation:
23
bobo1on1
cheapass Team-XBMC Developer
Posts: 2,752
Ah right, nice catch, I'll look into that.
Posts: 325
Joined: Sep 2010
Reputation:
17
2010-11-05, 03:04
(This post was last modified: 2010-11-05, 15:36 by TheSwissKnife.)
I am finding other problems while analysing what might be a better method.
The DVDClock.SetSpeed setting of m_startClock from DVDPlayer thread appears to conflict with the audio thread as it spots a discontinuity upon resume from pause. Also it seems the expression used in SetSpeed to adjust based on the playback speed seems like it might need some casting - I am not sure until I can rule out other threads corrupting the data - but the results are certainly bogus and when I casted they seemed better.
EDIT: I have now added a break statement in CDVDClock:: Discontinuity CLOCK_DISC_NORMAL case if m_pauseClock is set. I could be wrong but it seems to help with un-pausing.
EDIT2: I have subsequently adjusted the HandleSyncError() calls to Discontinuity() by passing the negated error value as the delay parameter, and changing Discontinuity() function so that is does not first set m_startClock to the reference clock GetTime() - though it still adjusts by the delay parameter as before. Finally I change GetClock() to not include m_iDisc in its result. Hey presto I am now moving the start clock position by the averaged error value rather than moving it to the current reference time when a discontinuity occurs. This appears to work well so far - but I will test more thoroughly. I will then attempt to tweak GetClock to provide values in between reference clock ticks to completely remove the frame duration related swings which should make averaging super accurate and tracking the drift very easy...
Posts: 2,752
Joined: Dec 2008
Reputation:
23
bobo1on1
cheapass Team-XBMC Developer
Posts: 2,752
No, you have to adjust for the clock speed.
I guess you could add a method to CVideoReferenceClock to return vblank time or the interpolated time.