Posts: 2,752
Joined: Dec 2008
Reputation:
23
bobo1on1
cheapass Team-XBMC Developer
Posts: 2,752
If you turn on sync playback to display, you can see a sync and an error value when you press 'o' during playback, you want that sync value to remain stable.
However if you get a constantly drifting a/v sync without sync playback to display, then there's either a problem with the file you're playing or the soundcard is running at a slightly different speed than the system clock.
Posts: 2,752
Joined: Dec 2008
Reputation:
23
bobo1on1
cheapass Team-XBMC Developer
Posts: 2,752
2010-10-04, 17:14
(This post was last modified: 2010-10-04, 17:16 by bobo1on1.)
Don't worry about the missed vblanks, it automatically compensates for them.
It does indicate that your system could be under high cpu/gpu load.
Posts: 325
Joined: Sep 2010
Reputation:
17
I may buy a card for further testing in a different machine to isolate the cause of this.
Thanks for your help.
Could you please reply on the issue of passthrough though. I want to be sure whe using passthrough which modes of compensation are possible (As your comment prior has me worried that none will work).
Posts: 2,752
Joined: Dec 2008
Reputation:
23
bobo1on1
cheapass Team-XBMC Developer
Posts: 2,752
You can use audio clock or drop/dupe, but if the refreshrate differs too much from the video fps, you get jerks with audio clock and audio distortion with drop/dupe.
Posts: 325
Joined: Sep 2010
Reputation:
17
Assuming I can get a close match then issue becomes what does xbmc choose as its video/audio offset each time a movie is played. It seems every time I play I get a different starting sync value - which I assume implies a different offset between the two. This would mean up to 40ms swing in audio sync that would have to be adjusted manually each time movie is played. Am I wrong?
Posts: 2,752
Joined: Dec 2008
Reputation:
23
bobo1on1
cheapass Team-XBMC Developer
Posts: 2,752
Well the a/v sync in the codec info isn't entirely correct, dvdplayer does a good job of keeping things in sync, you don't have to look at that value every time and manually adjust the sync.
Posts: 325
Joined: Sep 2010
Reputation:
17
Well I have been trying to use this method now for a few hours and I am not getting anywhere. If I adjust the refresh rate of the card across 23.974->23.986Hz over many small iterations I always see the sync value drift downwards (ie -1 every period). At the 23.974 end I see the audio discontinuity appear as +10ms and at the 23.986 end I see this as -10ms. It seems though that adjusting the refresh rate also adjusts the audio clock (because they are the same card - hdmi), and thus does not really get me anywhere in this "sync to display mode". In this way all I am really doing I guess is trying to get source file frame rate to match the refresh rate - though it is not clear how to see this from anything xbmc presents in "o" code info panel. I am not sure that the measurerefreshrate settting in advancedsettings.xml is doing much to help though I can see it parses successfully.
I have not given up yet but I can see now why some people return to their settop boxes (PCH etc).
Posts: 325
Joined: Sep 2010
Reputation:
17
I assume this is used to get an accurate value to build the clock's scale? Any idea how I know this "measurerefreshrate" setting is working eg what message in the log file?
Currently no matter what refresh rate I tweak to, I seem to see in the log file that it thinks it is 23.976023 Hz.
Posts: 2,752
Joined: Dec 2008
Reputation:
23
bobo1on1
cheapass Team-XBMC Developer
Posts: 2,752
Measurerefreshrate is only useful if windows doesn't report the refreshrate correctly, and it will always round the measurement to the nearest integer, the adjustment of the clock speed based on video fps will cancel that out, so if your refreshrate is 23.976 hertz, xbmc will round that to 24, then on 23.976 fps video it will speed up the clock by 0.1%, so on every vblank interval the clock is updated by 1/24 * 1.001 second, which happens to be equal to 1/23.976 second.
Also, measuring the refreshrate is not very accurate because it doesn't measure for very long.
Posts: 325
Joined: Sep 2010
Reputation:
17
Oh so the measurerefreshrate is not going to help me. I have now gathered that the "sync" value is now based on the 24Hz mode as it likes to drift by 1ms every 40'ish seconds - and after a complete cycle of 100% it does not necessarily update the clock. This makes the value not at all useful in trying to fine tune the refresh rate. In addition it is not very intuitive (just like seeing the .1% adjust value), given that we are dealing here with 23.976 material. This should really be documented somewhere as it would save people the pain I have been through.
I am now close to getting a refreshrate that completely eliminates the audio correction debug lines (at least for my test case file [m2ts h.264 dd5.1, duration 105mins - copy from bluray]). Will post my results if there is interest.