summaryrefslogtreecommitdiff
path: root/src/lib/butler.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-05-26 20:04:33 +0200
committerCarl Hetherington <cth@carlh.net>2022-05-26 20:04:33 +0200
commit8987f133295e352c44e05ef338eacc801c61a629 (patch)
tree6325c00b2c1097bb483568ddad8b545e0e40f717 /src/lib/butler.cc
parentb6fb82e5df5551497b823f20a75c7ff94ffd1b3e (diff)
Fix race between the Butler thread starting and audio (perhaps) being disabled.
This could cause Butler::audio to be called with _audio_channels = 0 and _disable_audio = false, causing an exception in AudioBuffers when remap() tried to make an AudioBuffers object with a channel count of 0.
Diffstat (limited to 'src/lib/butler.cc')
-rw-r--r--src/lib/butler.cc13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/lib/butler.cc b/src/lib/butler.cc
index 27b39ba4f..ce35b1f39 100644
--- a/src/lib/butler.cc
+++ b/src/lib/butler.cc
@@ -69,7 +69,8 @@ Butler::Butler (
VideoRange video_range,
Image::Alignment alignment,
bool fast,
- bool prepare_only_proxy
+ bool prepare_only_proxy,
+ Audio audio
)
: _film (film)
, _player (player)
@@ -81,7 +82,7 @@ Butler::Butler (
, _stop_thread (false)
, _audio_mapping (audio_mapping)
, _audio_channels (audio_channels)
- , _disable_audio (false)
+ , _disable_audio (audio == Audio::DISABLED)
, _pixel_format (pixel_format)
, _video_range (video_range)
, _alignment (alignment)
@@ -394,14 +395,6 @@ Butler::get_audio (Behaviour behaviour, float* out, Frame frames)
}
-void
-Butler::disable_audio ()
-{
- boost::mutex::scoped_lock lm (_mutex);
- _disable_audio = true;
-}
-
-
pair<size_t, string>
Butler::memory_used () const
{