Skip to content

Commit

Permalink
Update SpoutFrameCount.cpp
Browse files Browse the repository at this point in the history
Reset timers in EnableFrameCount
  • Loading branch information
leadedge committed Feb 4, 2021
1 parent f9b40da commit 3928c91
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions SPOUTSDK/SpoutGL/SpoutFrameCount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
// 14.12.10 - independent std::chrono timing for sender frame count and HoldFps
// Testing and code optimization
// 18.12.20 - Add SetFrameCount for registry setting
// 04.02.21 - Reset timers in EnableFrameCount
//
// ====================================================================================
//
Expand Down Expand Up @@ -195,6 +196,20 @@ void spoutFrameCount::EnableFrameCount(const char* SenderName)
m_FrameTimeNumber = 0.0;
m_SenderFps = GetRefreshRate();

// Reset timers
m_millisForFrame = 0.0;
#ifdef USE_CHRONO
// Start std::chrono microsec counting
m_FrameStartPtr = new std::chrono::steady_clock::time_point;
m_FrameEndPtr = new std::chrono::steady_clock::time_point;
m_FramePtr = new std::chrono::steady_clock::time_point;
#else
// Initialize PC msec frequency counter
PCFreq = 0.0;
CounterStart = 0;
StartCounter();
#endif

// Return if already enabled for this sender
if (m_hCountSemaphore && strcmp(SenderName, m_SenderName) == 0) {
SpoutLogNotice("SpoutFrameCount::EnableFrameCount already enabled [%s]", SenderName);
Expand Down

0 comments on commit 3928c91

Please sign in to comment.