Merge more code from master fixing up when to clearPackets, don't delete image data if we have an event etc.
parent
e4e20ab52f
commit
391f5dbf98
|
@ -2176,24 +2176,6 @@ bool Monitor::Analyse() {
|
|||
shared_data->state = state = IDLE;
|
||||
} // 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);
|
||||
|
||||
if (snap->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
|
@ -2203,9 +2185,34 @@ bool Monitor::Analyse() {
|
|||
if (function == MODECT or function == MOCORD)
|
||||
UpdateAnalysisFPS();
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
// Free up the decoded frame as well, we won't be using it for anything at this time.
|
||||
if (snap->out_frame) av_frame_free(&snap->out_frame);
|
||||
if (snap->buffer) av_freep(&snap->buffer);
|
||||
|
||||
delete packet_lock;
|
||||
}
|
||||
} // end scope for event_lock
|
||||
|
||||
packetqueue.increment_it(analysis_it);
|
||||
shared_data->last_read_time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue