summaryrefslogtreecommitdiff
path: root/src/lib/player.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-08-02 23:22:49 +0100
committerCarl Hetherington <cth@carlh.net>2018-08-02 23:22:49 +0100
commit4fe1a062eb31d680b8b4ac0191b9e2fc2d6aaec3 (patch)
treed86a1f778545f238e0b226a80419c066033b4d6e /src/lib/player.cc
parente82a4c81fe8bb3c3c6b68c667bda2f32fed4e68d (diff)
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.
Diffstat (limited to 'src/lib/player.cc')
-rw-r--r--src/lib/player.cc20
1 files changed, 17 insertions, 3 deletions
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<Content> 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;
}