From ec2ed287e7271f81fb7cce5170fbce62cac79e82 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 27 Oct 2018 19:07:03 +0200 Subject: [PATCH] Fix a deadlock in the new queueing logic. --- player.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/player.cpp b/player.cpp index 0d85938..1432f04 100644 --- a/player.cpp +++ b/player.cpp @@ -194,6 +194,7 @@ got_clip: if (new_clip_ready) { if (video_stream != nullptr) { video_stream->clear_queue(); + num_queued_frames = 0; } goto wait_for_clip; } @@ -210,6 +211,7 @@ got_clip: unique_lock lock(queue_state_mu); assert(num_queued_frames > 0); --num_queued_frames; + new_clip_changed.notify_all(); }; if (video_stream == nullptr) { display_func(); @@ -239,6 +241,7 @@ got_clip: unique_lock lock(queue_state_mu); assert(num_queued_frames > 0); --num_queued_frames; + new_clip_changed.notify_all(); }; if (video_stream == nullptr) { display_func(); @@ -279,6 +282,7 @@ got_clip: destination->setFrame(primary_stream_idx, pts, /*interpolated=*/true, secondary_stream_idx, secondary_pts, fade_alpha); assert(num_queued_frames > 0); --num_queued_frames; + new_clip_changed.notify_all(); }; bool ok = video_stream->schedule_interpolated_frame(next_frame_start, pts, display_func, primary_stream_idx, in_pts_lower, in_pts_upper, alpha, secondary_stream_idx, secondary_pts, fade_alpha); unique_lock lock(queue_state_mu); -- 2.39.2