summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-09-10 18:18:45 +0200
committerCarl Hetherington <cth@carlh.net>2022-09-10 23:21:02 +0200
commit959034cec386965f41a781c3ae6929bf7b14318c (patch)
tree2289318e5664393a6ff41f86eb4f0a9df27e6c8a /src/lib
parentbd9098f7fa9f8415da12ac0f08a1087c68f6baf6 (diff)
Use atomic for _dcp_decode_reduction.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/player.cc17
-rw-r--r--src/lib/player.h2
2 files changed, 7 insertions, 12 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index a6cfd9367..c3fee45b4 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -1414,19 +1414,14 @@ Player::set_dcp_decode_reduction (optional<int> reduction)
{
Change (ChangeType::PENDING, PlayerProperty::DCP_DECODE_REDUCTION, false);
- {
- boost::mutex::scoped_lock lm (_mutex);
-
- if (reduction == _dcp_decode_reduction) {
- lm.unlock ();
- Change (ChangeType::CANCELLED, PlayerProperty::DCP_DECODE_REDUCTION, false);
- return;
- }
-
- _dcp_decode_reduction = reduction;
- setup_pieces_unlocked ();
+ if (reduction == _dcp_decode_reduction.load()) {
+ Change(ChangeType::CANCELLED, PlayerProperty::DCP_DECODE_REDUCTION, false);
+ return;
}
+ _dcp_decode_reduction = reduction;
+ setup_pieces();
+
Change (ChangeType::DONE, PlayerProperty::DCP_DECODE_REDUCTION, false);
}
diff --git a/src/lib/player.h b/src/lib/player.h
index d586622c4..ce8b7cc5a 100644
--- a/src/lib/player.h
+++ b/src/lib/player.h
@@ -196,7 +196,7 @@ private:
/** Time of the next audio that we will emit, or the time of the last accurate seek */
boost::optional<dcpomatic::DCPTime> _next_audio_time;
- boost::optional<int> _dcp_decode_reduction;
+ boost::atomic<boost::optional<int>> _dcp_decode_reduction;
typedef std::map<std::weak_ptr<Piece>, std::shared_ptr<PlayerVideo>, std::owner_less<std::weak_ptr<Piece>>> LastVideoMap;
LastVideoMap _last_video;