notify anyone waiting in packetqueue before waiting on a packet in motion detection. Should fix decode lockup

This commit is contained in:
Isaac Connor 2021-09-14 13:38:55 -04:00
parent 4bc522e273
commit 31a6ab2224
2 changed files with 2 additions and 0 deletions

View File

@ -1858,6 +1858,7 @@ bool Monitor::Analyse() {
while (!snap->decoded and !zm_terminate and !analysis_thread->Stopped()) { while (!snap->decoded and !zm_terminate and !analysis_thread->Stopped()) {
// Need to wait for the decoder thread. // Need to wait for the decoder thread.
Debug(1, "Waiting for decode"); Debug(1, "Waiting for decode");
packetqueue.notify_all(); // decode might be waiting
packet_lock->wait(); packet_lock->wait();
if (!snap->image and snap->decoded) { if (!snap->image and snap->decoded) {
Debug(1, "No image but was decoded, giving up"); Debug(1, "No image but was decoded, giving up");

View File

@ -81,6 +81,7 @@ class PacketQueue {
); );
bool is_there_an_iterator_pointing_to_packet(const std::shared_ptr<ZMPacket> &zm_packet); bool is_there_an_iterator_pointing_to_packet(const std::shared_ptr<ZMPacket> &zm_packet);
void unlock(ZMLockedPacket *lp); void unlock(ZMLockedPacket *lp);
void notify_all() { condition.notify_all(); };
}; };
#endif /* ZM_PACKETQUEUE_H */ #endif /* ZM_PACKETQUEUE_H */