Skip to content

Commit

Permalink
Remove locking of freeFrame QSemaphore by replacing timeout to QThrea…
Browse files Browse the repository at this point in the history
…d::msleep
  • Loading branch information
daharoni committed Feb 26, 2020
1 parent c6980e0 commit 36e801c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/videostreamocv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ void VideoStreamOCV::startStream()
sendMessage("Error: " + m_deviceName + " frame buffer is full. Frames will be lost!");
}

if(freeFrames->tryAcquire(1,100)) {
if(!freeFrames->tryAcquire()) {
// Failed to acquire free frame
QThread::msleep(100);
}
else {
if (!cam->grab()) {
sendMessage("Warning: " + m_deviceName + " grab frame failed. Attempting to reconnect.");
if (cam->isOpened()) {
Expand Down

0 comments on commit 36e801c

Please sign in to comment.