]> git.sesse.net Git - bmusb/blobdiff - bmusb.cpp
Fix a crash during shutdown.
[bmusb] / bmusb.cpp
index 0582b99631b5d30de538adb5e50b12002504e66e..7e0864ee514b923a818d9c7956a965d70e9d43a0 100644 (file)
--- a/bmusb.cpp
+++ b/bmusb.cpp
@@ -159,6 +159,8 @@ void BMUSBCapture::dequeue_thread_func()
                unique_lock<mutex> lock(queue_lock);
                queues_not_empty.wait(lock, [this]{ return dequeue_thread_should_quit || (!pending_video_frames.empty() && !pending_audio_frames.empty()); });
 
+               if (dequeue_thread_should_quit) break;
+
                uint16_t video_timecode = pending_video_frames.front().timecode;
                uint16_t audio_timecode = pending_audio_frames.front().timecode;
                if (uint16_less_than_with_wraparound(video_timecode, audio_timecode)) {