Skip to content

Commit

Permalink
limit grab frames
Browse files Browse the repository at this point in the history
  • Loading branch information
Timocop committed Apr 6, 2022
1 parent bedb8c5 commit 926593a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/psmoveservice/PSMoveTracker/PSEye/PSEyeVideoCapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,14 @@ class PSEYECaptureCAM_VIRTUAL : public cv::IVideoCapture

bool grabFrame()
{
const std::chrono::time_point<std::chrono::high_resolution_clock> now = std::chrono::high_resolution_clock::now();
const std::chrono::duration<double, std::milli> timeSinceLast = now - m_lastRequest;
if (timeSinceLast.count() < 2.f)
{
return true;
}

m_lastRequest = now;

if (capturePipe == INVALID_HANDLE_VALUE)
{
Expand Down Expand Up @@ -715,6 +723,7 @@ class PSEYECaptureCAM_VIRTUAL : public cv::IVideoCapture
HANDLE capturePipe;
char pipeBuffer[VRIT_BUFF_SIZE];
cv::Mat capFrame;
std::chrono::time_point<std::chrono::high_resolution_clock> m_lastRequest;
};

static bool usingCLEyeDriver()
Expand Down

0 comments on commit 926593a

Please sign in to comment.