forked from mia/Aegisub
Changed audio synchronization algorithm
Originally committed to SVN as r170.
This commit is contained in:
parent
a94f17d2c4
commit
93b35641a4
2 changed files with 7 additions and 2 deletions
|
@ -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.");
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue