Don't free image data if we added the packet to an event. The lock moves to the event so it's not safe
This commit is contained in:
parent
b00ca5ce91
commit
6b8cc14723
|
@ -2270,8 +2270,17 @@ bool Monitor::Analyse() {
|
||||||
shared_data->state = state = IDLE;
|
shared_data->state = state = IDLE;
|
||||||
} // end if ( trigger_data->trigger_state != TRIGGER_OFF )
|
} // end if ( trigger_data->trigger_state != TRIGGER_OFF )
|
||||||
|
|
||||||
if (event) event->AddPacket(packet_lock);
|
packetqueue.clearPackets(snap);
|
||||||
|
|
||||||
|
if (snap->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||||
|
// Only do these if it's a video packet.
|
||||||
|
shared_data->last_read_index = snap->image_index;
|
||||||
|
analysis_image_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event) {
|
||||||
|
event->AddPacket(packet_lock);
|
||||||
|
} else {
|
||||||
// In the case where people have pre-alarm frames, the web ui will generate the frame images
|
// In the case where people have pre-alarm frames, the web ui will generate the frame images
|
||||||
// from the mp4. So no one will notice anyways.
|
// from the mp4. So no one will notice anyways.
|
||||||
if (snap->image and (videowriter == PASSTHROUGH)) {
|
if (snap->image and (videowriter == PASSTHROUGH)) {
|
||||||
|
@ -2287,17 +2296,11 @@ bool Monitor::Analyse() {
|
||||||
snap->analysis_image = nullptr;
|
snap->analysis_image = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete packet_lock;
|
||||||
packetqueue.clearPackets(snap);
|
|
||||||
|
|
||||||
if (snap->codec_type == AVMEDIA_TYPE_VIDEO) {
|
|
||||||
// Only do these if it's a video packet.
|
|
||||||
shared_data->last_read_index = snap->image_index;
|
|
||||||
analysis_image_count++;
|
|
||||||
}
|
}
|
||||||
packetqueue.increment_it(analysis_it);
|
|
||||||
if (!event) delete packet_lock;
|
|
||||||
} // end scope for event_lock
|
} // end scope for event_lock
|
||||||
|
|
||||||
|
packetqueue.increment_it(analysis_it);
|
||||||
//packetqueue.unlock(packet_lock);
|
//packetqueue.unlock(packet_lock);
|
||||||
shared_data->last_read_time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
shared_data->last_read_time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue