From: Steinar H. Gunderson Date: Thu, 13 Dec 2018 19:38:15 +0000 (+0100) Subject: Fix another shutdown hang. X-Git-Tag: 1.8.0~26 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=ef2446c7768549827aed6cd2b635a514366c2025 Fix another shutdown hang. --- diff --git a/futatabi/video_stream.cpp b/futatabi/video_stream.cpp index ef56ee4..8593936 100644 --- a/futatabi/video_stream.cpp +++ b/futatabi/video_stream.cpp @@ -269,6 +269,7 @@ void VideoStream::start() void VideoStream::stop() { should_quit = true; + queue_changed.notify_all(); clear_queue(); encode_thread.join(); } @@ -560,8 +561,11 @@ void VideoStream::encode_thread_func() // Wait until we have a frame to play. queue_changed.wait(lock, [this]{ - return !frame_queue.empty(); + return !frame_queue.empty() || should_quit; }); + if (should_quit) { + break; + } steady_clock::time_point frame_start = frame_queue.front().local_pts; // Now sleep until the frame is supposed to start (the usual case),