Move waiting for decoding down into motion detection part, which is what needs it. Not sure why it was up so high. This should allow more ram freeing for people with analysis fps set to something.
This commit is contained in:
parent
0bfbdd6121
commit
3202db1b33
|
@ -1800,8 +1800,6 @@ void Monitor::UpdateAnalysisFPS() {
|
||||||
// If there is an event, the we should do our best to empty the queue.
|
// If there is an event, the we should do our best to empty the queue.
|
||||||
// If there isn't then we keep pre-event + alarm frames. = pre_event_count
|
// If there isn't then we keep pre-event + alarm frames. = pre_event_count
|
||||||
bool Monitor::Analyse() {
|
bool Monitor::Analyse() {
|
||||||
|
|
||||||
|
|
||||||
// if have event, send frames until we find a video packet, at which point do analysis. Adaptive skip should only affect which frames we do analysis on.
|
// if have event, send frames until we find a video packet, at which point do analysis. Adaptive skip should only affect which frames we do analysis on.
|
||||||
|
|
||||||
// get_analysis_packet will lock the packet and may wait if analysis_it is at the end
|
// get_analysis_packet will lock the packet and may wait if analysis_it is at the end
|
||||||
|
@ -1923,18 +1921,6 @@ bool Monitor::Analyse() {
|
||||||
noteSetMap[LINKED_CAUSE] = noteSet;
|
noteSetMap[LINKED_CAUSE] = noteSet;
|
||||||
} // end if linked_monitors
|
} // end if linked_monitors
|
||||||
|
|
||||||
if ( decoding_enabled ) {
|
|
||||||
while (!snap->image and !snap->decoded and !zm_terminate) {
|
|
||||||
// Need to wait for the decoder thread.
|
|
||||||
Debug(1, "Waiting for decode");
|
|
||||||
packet_lock->wait();
|
|
||||||
if (!snap->image and snap->decoded) {
|
|
||||||
Debug(1, "No image but was decoded, giving up");
|
|
||||||
delete packet_lock;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} // end while ! decoded
|
|
||||||
}
|
|
||||||
|
|
||||||
struct timeval *timestamp = snap->timestamp;
|
struct timeval *timestamp = snap->timestamp;
|
||||||
|
|
||||||
|
@ -1952,16 +1938,25 @@ bool Monitor::Analyse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(analysis_image_count % (motion_frame_skip+1))) {
|
if (!(analysis_image_count % (motion_frame_skip+1))) {
|
||||||
if (snap->image) {
|
if (decoding_enabled) {
|
||||||
|
while (!snap->image and !snap->decoded and !zm_terminate) {
|
||||||
|
// Need to wait for the decoder thread.
|
||||||
|
Debug(1, "Waiting for decode");
|
||||||
|
packet_lock->wait();
|
||||||
|
if (!snap->image and snap->decoded) {
|
||||||
|
Debug(1, "No image but was decoded, giving up");
|
||||||
|
delete packet_lock;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} // end while ! decoded
|
||||||
|
}
|
||||||
|
|
||||||
// Get new score.
|
// Get new score.
|
||||||
motion_score = DetectMotion(*(snap->image), zoneSet);
|
motion_score = DetectMotion(*(snap->image), zoneSet);
|
||||||
|
|
||||||
Debug(3, "After motion detection, score:%d last_motion_score(%d), new motion score(%d)",
|
Debug(3, "After motion detection, score:%d last_motion_score(%d), new motion score(%d)",
|
||||||
score, last_motion_score, motion_score);
|
score, last_motion_score, motion_score);
|
||||||
motion_frame_count += 1;
|
motion_frame_count += 1;
|
||||||
} else {
|
|
||||||
Debug(1, "No image in snap, codec likely not ready");
|
|
||||||
}
|
|
||||||
// Why are we updating the last_motion_score too?
|
// Why are we updating the last_motion_score too?
|
||||||
last_motion_score = motion_score;
|
last_motion_score = motion_score;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue