Changed audio synchronization algorithm

Originally committed to SVN as r170.
This commit is contained in:
Rodrigo Braz Monteiro 2006-02-25 07:14:39 +00:00
parent a94f17d2c4
commit 93b35641a4
2 changed files with 7 additions and 2 deletions

View File

@ -168,6 +168,10 @@ AudioProvider *AudioProvider::GetAudioProvider(wxString filename, AudioDisplay *
provider = new AvisynthAudioProvider(filename);
#endif
#ifdef USE_LAVC
//if (!provider) provider = new LAVCAudioProvider(filename);
#endif
// No provider found
if (!provider) {
throw _T("Could not initialize any audio provider.");

View File

@ -885,9 +885,10 @@ void VideoDisplay::OnPlayTimer(wxTimerEvent &event) {
JumpToFrame(nextFrame);
// Sync audio
if (nextFrame % 25 == 0) {
if (nextFrame % 10 == 0) {
__int64 audPos = audio->GetSampleAtMS(VFR_Output.GetTimeAtFrame(nextFrame));
audio->provider->SetCurrentPosition(audPos);
__int64 curPos = audio->provider->GetCurrentPosition();
if (abs(int(audPos-curPos)) > audio->provider->GetSampleRate() / 10) audio->provider->SetCurrentPosition(audPos);
}
}