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,24 +2270,6 @@ 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);
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
if (snap->image and (videowriter == PASSTHROUGH)) {
|
|
||||||
if (!savejpegs) {
|
|
||||||
Debug(1, "Deleting image data for %d", snap->image_index);
|
|
||||||
// Don't need raw images anymore
|
|
||||||
delete snap->image;
|
|
||||||
snap->image = nullptr;
|
|
||||||
}
|
|
||||||
if (snap->analysis_image and !(savejpegs & 2)) {
|
|
||||||
Debug(1, "Deleting analysis image data for %d", snap->image_index);
|
|
||||||
delete snap->analysis_image;
|
|
||||||
snap->analysis_image = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
packetqueue.clearPackets(snap);
|
packetqueue.clearPackets(snap);
|
||||||
|
|
||||||
if (snap->codec_type == AVMEDIA_TYPE_VIDEO) {
|
if (snap->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||||
|
@ -2295,9 +2277,30 @@ bool Monitor::Analyse() {
|
||||||
shared_data->last_read_index = snap->image_index;
|
shared_data->last_read_index = snap->image_index;
|
||||||
analysis_image_count++;
|
analysis_image_count++;
|
||||||
}
|
}
|
||||||
packetqueue.increment_it(analysis_it);
|
|
||||||
if (!event) delete packet_lock;
|
if (event) {
|
||||||
|
event->AddPacket(packet_lock);
|
||||||
|
} else {
|
||||||
|
// 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.
|
||||||
|
if (snap->image and (videowriter == PASSTHROUGH)) {
|
||||||
|
if (!savejpegs) {
|
||||||
|
Debug(1, "Deleting image data for %d", snap->image_index);
|
||||||
|
// Don't need raw images anymore
|
||||||
|
delete snap->image;
|
||||||
|
snap->image = nullptr;
|
||||||
|
}
|
||||||
|
if (snap->analysis_image and !(savejpegs & 2)) {
|
||||||
|
Debug(1, "Deleting analysis image data for %d", snap->image_index);
|
||||||
|
delete snap->analysis_image;
|
||||||
|
snap->analysis_image = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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