Stop the packetque first before stopping threads that may be in it. Only call clearPackets for video packets
parent
3c8b590925
commit
aeca49d427
|
@ -2215,9 +2215,9 @@ 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 )
|
||||||
|
|
||||||
packetqueue.clearPackets(snap);
|
|
||||||
|
|
||||||
if (snap->codec_type == AVMEDIA_TYPE_VIDEO) {
|
if (snap->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||||
|
packetqueue.clearPackets(snap);
|
||||||
// Only do these if it's a video packet.
|
// Only do these if it's a video packet.
|
||||||
shared_data->last_read_index = snap->image_index;
|
shared_data->last_read_index = snap->image_index;
|
||||||
analysis_image_count++;
|
analysis_image_count++;
|
||||||
|
@ -3144,8 +3144,14 @@ int Monitor::PrimeCapture() {
|
||||||
int Monitor::PreCapture() const { return camera->PreCapture(); }
|
int Monitor::PreCapture() const { return camera->PreCapture(); }
|
||||||
int Monitor::PostCapture() const { return camera->PostCapture(); }
|
int Monitor::PostCapture() const { return camera->PostCapture(); }
|
||||||
int Monitor::Close() {
|
int Monitor::Close() {
|
||||||
|
Debug(1, "Stopping packetqueue");
|
||||||
|
// Wake everyone up
|
||||||
|
packetqueue.stop();
|
||||||
|
Debug(1, "Stopped packetqueue");
|
||||||
|
|
||||||
// Because the stream indexes may change we have to clear out the packetqueue
|
// Because the stream indexes may change we have to clear out the packetqueue
|
||||||
if (decoder) {
|
if (decoder) {
|
||||||
|
Debug(1, "Decoder stopping");
|
||||||
decoder->Stop();
|
decoder->Stop();
|
||||||
Debug(1, "Decoder stopped");
|
Debug(1, "Decoder stopped");
|
||||||
}
|
}
|
||||||
|
@ -3187,10 +3193,6 @@ int Monitor::Close() {
|
||||||
video_fifo = nullptr;
|
video_fifo = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug(1, "Stopping packetqueue");
|
|
||||||
// Wake everyone up
|
|
||||||
packetqueue.stop();
|
|
||||||
Debug(1, "Stopped packetqueue");
|
|
||||||
|
|
||||||
if (close_event_thread.joinable()) {
|
if (close_event_thread.joinable()) {
|
||||||
Debug(1, "Joining event thread");
|
Debug(1, "Joining event thread");
|
||||||
|
|
Loading…
Reference in New Issue