From e14062090087a483db617a5b01dabf0e8af95472 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 14 Sep 2021 13:38:55 -0400 Subject: [PATCH] notify anyone waiting in packetqueue before waiting on a packet in motion detection. Should fix decode lockup --- src/zm_monitor.cpp | 1 + src/zm_packetqueue.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 44e032979..5a2c646ab 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1846,6 +1846,7 @@ bool Monitor::Analyse() { while (!snap->decoded and !zm_terminate and !analysis_thread->Stopped()) { // Need to wait for the decoder thread. Debug(1, "Waiting for decode"); + packetqueue.notify_all(); // decode might be waiting packet_lock->wait(); if (!snap->image and snap->decoded) { Debug(1, "No image but was decoded, giving up"); diff --git a/src/zm_packetqueue.h b/src/zm_packetqueue.h index 7e2f367fc..2fc29ea33 100644 --- a/src/zm_packetqueue.h +++ b/src/zm_packetqueue.h @@ -81,6 +81,7 @@ class PacketQueue { ); bool is_there_an_iterator_pointing_to_packet(const std::shared_ptr &zm_packet); void unlock(ZMLockedPacket *lp); + void notify_all() { condition.notify_all(); }; }; #endif /* ZM_PACKETQUEUE_H */