mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
solve sync between video and audio by magic number
This commit is contained in:
parent
99df692e00
commit
99f6b66fbd
|
@ -287,7 +287,7 @@ static void Mix(short *pFinalOut, unsigned Frames)
|
|||
#if defined(CONF_VIDEORECORDER)
|
||||
if (IVideo::Current())
|
||||
{
|
||||
if(m_LastBreak <= IVideo::Current()->GetBreak()+0.005)
|
||||
if(m_LastBreak <= IVideo::Current()->GetBreak())
|
||||
{
|
||||
IVideo::Current()->nextAudioFrame(pFinalOut);
|
||||
m_LastBreak += 1;
|
||||
|
|
|
@ -25,7 +25,8 @@ public:
|
|||
static void SetLocalStartTime(int64 LocalStartTime) { ms_LocalStartTime = LocalStartTime; }
|
||||
static void SetFPS(int fps) { ms_TickTime = time_freq() / fps; }
|
||||
|
||||
void SetBreak(double Speed) { m_Break += 4.0/Speed; } // I think this 4 is related to `Len/2/2` in `Mix` function of /expand/teeworlds/demo/video_3/src/engine/client/sound.cpp
|
||||
void SetBreak(double Speed) { m_Break += 3.75/Speed; } // I think this 4 is related to `Len/2/2` in `Mix` function of /expand/teeworlds/demo/video_3/src/engine/client/sound.cpp
|
||||
// and for sync video and audio, it was changed to 3.75 as a magic number, hope someone can make it work without such magic number
|
||||
double GetBreak() { return m_Break; }
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in a new issue