Fix logic on clearing frame queue

This commit is contained in:
Isaac Connor 2021-03-01 16:44:56 -05:00
parent 495e2a4827
commit d33540c962
1 changed files with 2 additions and 1 deletions

View File

@ -233,7 +233,8 @@ int ZoneMinderFifoSource::getNextFrame() {
pthread_mutex_lock(&m_mutex); pthread_mutex_lock(&m_mutex);
if (m_captureQueue.size() > 25) { // 1 sec at 25 fps if (m_captureQueue.size() > 25) { // 1 sec at 25 fps
NAL_Frame * f = m_captureQueue.front(); NAL_Frame * f = m_captureQueue.front();
while (m_captureQueue.size() and ((f->m_timestamp.tv_sec - tv.tv_sec) > 2)) { while (m_captureQueue.size() and ((tv.tv_sec - f->m_timestamp.tv_sec) > 2)) {
Debug(1, "Deleting Front NAL is %d seconds old", (tv.tv_sec - f->m_timestamp.tv_sec));
m_captureQueue.pop_front(); m_captureQueue.pop_front();
delete f; delete f;
f = m_captureQueue.front(); f = m_captureQueue.front();