Skip to content

Commit

Permalink
Add back in a Join on the analysis thread and decoder thread before c…
Browse files Browse the repository at this point in the history
…learing the packetqueue
  • Loading branch information
Isaac Connor committed Oct 26, 2024
1 parent f131f78 commit 2efacc6
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/zm_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3377,16 +3377,7 @@ int Monitor::PostCapture() const { return camera->PostCapture(); }
int Monitor::Pause() {

// Because the stream indexes may change we have to clear out the packetqueue
if (decoder) {
Debug(1, "Decoder stopping");
decoder->Stop();
Debug(1, "Decoder stopped");
}

if (convert_context) {
sws_freeContext(convert_context);
convert_context = nullptr;
}
if (decoder) decoder->Stop();

if (analysis_thread) {
analysis_thread->Stop();
Expand All @@ -3397,6 +3388,13 @@ int Monitor::Pause() {
// Wake everyone up
packetqueue.stop();

if (decoder) decoder->Join();
if (convert_context) {
sws_freeContext(convert_context);
convert_context = nullptr;
}
if (analysis_thread) analysis_thread->Join();

// Must close event before closing camera because it uses in_streams
if (close_event_thread.joinable()) {
Debug(1, "Joining event thread");
Expand Down

0 comments on commit 2efacc6

Please sign in to comment.