Revise watchdog

This commit is contained in:
Mr-Dave
2022-07-18 22:23:39 -06:00
parent d4a46ddc1b
commit a86cf9601f
6 changed files with 99 additions and 121 deletions

View File

@@ -736,36 +736,15 @@ static int mlp_init(struct ctx_cam *cam)
/** clean up all memory etc. from motion init */
void mlp_cleanup(struct ctx_cam *cam)
{
/* When the watchdog counter is less than zero we
* only do the minimal necessary to free the memory variables
* rather than finish off any event processing
*/
if (cam->watchdog > 0) {
event(cam, EVENT_TLAPSE_END, NULL, NULL, NULL, NULL);
if (cam->event_nr == cam->prev_event) {
mlp_ring_process(cam);
if (cam->imgs.image_preview.diffs) {
event(cam, EVENT_IMAGE_PREVIEW, NULL, NULL, NULL, &cam->current_image->imgts);
cam->imgs.image_preview.diffs = 0;
}
event(cam, EVENT_END, NULL, NULL, NULL, &cam->current_image->imgts);
dbse_exec(cam, NULL, 0, &cam->current_image->imgts, "event_end");
}
} else {
movie_free(cam->movie_norm);
cam->movie_norm = NULL;
movie_free(cam->movie_motion);
cam->movie_motion = NULL;
movie_free(cam->movie_timelapse);
cam->movie_timelapse = NULL;
if (cam->dbsemp != NULL) {
cam->dbsemp->database_sqlite3 = NULL;
event(cam, EVENT_TLAPSE_END, NULL, NULL, NULL, NULL);
if (cam->event_nr == cam->prev_event) {
mlp_ring_process(cam);
if (cam->imgs.image_preview.diffs) {
event(cam, EVENT_IMAGE_PREVIEW, NULL, NULL, NULL, &cam->current_image->imgts);
cam->imgs.image_preview.diffs = 0;
}
event(cam, EVENT_END, NULL, NULL, NULL, &cam->current_image->imgts);
dbse_exec(cam, NULL, 0, &cam->current_image->imgts, "event_end");
}
webu_stream_deinit(cam);