From e941ab2b02cf01ab15427e47124b7dd32425095c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 18 Feb 2018 01:26:03 +0000 Subject: Hold lock for the whole of Butler::video(). Fixes jumpy nudge-seek when playing DCPs. Before, the lock was only held to check _pending_seek_position. With that arrangement, this sequence was possible: 1. video arrives, check _pending_seek_position, decide it's ok, release lock 2. Butler::seek called, sets _pending_seek_position, clears _video 3. video that arrived in #1 is put into _video by ::video() 4. that video is given to an awaiting get_video() call. This clearly subverts the attempts not to accept new video data while a seek is pending. --- src/lib/butler.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/lib/butler.cc b/src/lib/butler.cc index 623a17c2f..5a40af128 100644 --- a/src/lib/butler.cc +++ b/src/lib/butler.cc @@ -211,12 +211,10 @@ Butler::prepare (weak_ptr weak_video) const void Butler::video (shared_ptr video, DCPTime time) { - { - boost::mutex::scoped_lock lm (_mutex); - if (_pending_seek_position) { - /* Don't store any video while a seek is pending */ - return; - } + boost::mutex::scoped_lock lm (_mutex); + if (_pending_seek_position) { + /* Don't store any video while a seek is pending */ + return; } _prepare_service.post (bind (&Butler::prepare, this, weak_ptr(video))); -- cgit v1.2.3