2011-11-30, 12:18
After digging inside the code a bit I saw that there are lots of GetDelay() functions. My guess is that there are small delays used for syncing the audio and the video inside every frame and a big delay that is stored in the m_AudioDelay variable.
So the timing is based on the m_AudioDelay (based on the setting) -/+ GetDelay(for micro adjustments).
The above are my guesses. Perhaps if there was a better explanation somewhere we could sort it out.
Also I found in the https://github.com/xbmc/xbmc/blob/master...lication.h a declaration of int GetAudioDelay() const; (line 172) and in https://github.com/xbmc/xbmc/blob/master...cation.cpp (line 5018) the function int CApplication::GetAudioDelay() const.
This is the only place where the m_AudioDelay variable is mentioned and I can't find any other place.
In order to have a second delay we could add a new line in Application.h
int GetAudioDelay2() const;
and in Application.cpp
int CApplication::GetAudioDelay2() const
{ // converts delay2 to a percentage return int(((float)(g_settings.m_currentVideoSettings.m_AudioDelay2 + g_advancedSettings.m_videoAudioDelayRange)) / (2 * g_advancedSettings.m_videoAudioDelayRange)*100.0f + 0.5f);
}
this would use the m_AudioDelay2 as mentioned before.
The last step would be to find where the second audio object is used and make any getdelay calls to be routed to a getdelay2 function that would use the m_AudioDelay2 variable.
So the timing is based on the m_AudioDelay (based on the setting) -/+ GetDelay(for micro adjustments).
The above are my guesses. Perhaps if there was a better explanation somewhere we could sort it out.
Also I found in the https://github.com/xbmc/xbmc/blob/master...lication.h a declaration of int GetAudioDelay() const; (line 172) and in https://github.com/xbmc/xbmc/blob/master...cation.cpp (line 5018) the function int CApplication::GetAudioDelay() const.
This is the only place where the m_AudioDelay variable is mentioned and I can't find any other place.
In order to have a second delay we could add a new line in Application.h
int GetAudioDelay2() const;
and in Application.cpp
int CApplication::GetAudioDelay2() const
{ // converts delay2 to a percentage return int(((float)(g_settings.m_currentVideoSettings.m_AudioDelay2 + g_advancedSettings.m_videoAudioDelayRange)) / (2 * g_advancedSettings.m_videoAudioDelayRange)*100.0f + 0.5f);
}
this would use the m_AudioDelay2 as mentioned before.
The last step would be to find where the second audio object is used and make any getdelay calls to be routed to a getdelay2 function that would use the m_AudioDelay2 variable.