From 4fe1a062eb31d680b8b4ac0191b9e2fc2d6aaec3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 2 Aug 2018 23:22:49 +0100 Subject: A variety of changes to improve (but not entirely fix) behaviour when moving content (or otherwise changing the playlist) while playing. This commit refills the butler when things change in certain ways, and improves locking to cope with Player methods being called from the GUI and butler threads at the same time. --- src/lib/player.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/lib/player.cc') diff --git a/src/lib/player.cc b/src/lib/player.cc index bb0aef458..408e791cd 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -239,7 +239,11 @@ Player::playlist_content_changed (weak_ptr w, int property, bool freque property == FFmpegContentProperty::FILTERS ) { - _have_valid_pieces = false; + { + boost::mutex::scoped_lock lm (_mutex); + _have_valid_pieces = false; + } + Changed (property, frequent); } else if ( @@ -287,7 +291,11 @@ Player::set_video_container_size (dcp::Size s) void Player::playlist_changed () { - _have_valid_pieces = false; + { + boost::mutex::scoped_lock lm (_mutex); + _have_valid_pieces = false; + } + Changed (PlayerProperty::PLAYLIST, false); } @@ -305,13 +313,18 @@ Player::film_changed (Film::Property p) /* Pieces contain a FrameRateChange which contains the DCP frame rate, so we need new pieces here. */ - _have_valid_pieces = false; + { + boost::mutex::scoped_lock lm (_mutex); + _have_valid_pieces = false; + } Changed (PlayerProperty::FILM_VIDEO_FRAME_RATE, false); } else if (p == Film::AUDIO_PROCESSOR) { if (_film->audio_processor ()) { + boost::mutex::scoped_lock lm (_mutex); _audio_processor = _film->audio_processor()->clone (_film->audio_frame_rate ()); } } else if (p == Film::AUDIO_CHANNELS) { + boost::mutex::scoped_lock lm (_mutex); _audio_merger.clear (); } } @@ -460,6 +473,7 @@ Player::set_ignore_video () void Player::set_ignore_audio () { + boost::mutex::scoped_lock lm (_mutex); _ignore_audio = true; _have_valid_pieces = false; } -- cgit v1.2.3