Commit 910496ce authored by Max Kellermann's avatar Max Kellermann

decoder/Control: caller must lock mutex for Start()

parent 739e1da2
...@@ -94,8 +94,6 @@ DecoderControl::Start(std::unique_ptr<DetachedSong> _song, ...@@ -94,8 +94,6 @@ DecoderControl::Start(std::unique_ptr<DetachedSong> _song,
SongTime _start_time, SongTime _end_time, SongTime _start_time, SongTime _end_time,
MusicBuffer &_buffer, MusicPipe &_pipe) noexcept MusicBuffer &_buffer, MusicPipe &_pipe) noexcept
{ {
const std::lock_guard<Mutex> protect(mutex);
assert(_song != nullptr); assert(_song != nullptr);
assert(_pipe.IsEmpty()); assert(_pipe.IsEmpty());
......
...@@ -372,6 +372,8 @@ public: ...@@ -372,6 +372,8 @@ public:
/** /**
* Start the decoder. * Start the decoder.
* *
* Caller must lock the object.
*
* @param song the song to be decoded; the given instance will be * @param song the song to be decoded; the given instance will be
* owned and freed by the decoder * owned and freed by the decoder
* @param start_time see #DecoderControl * @param start_time see #DecoderControl
......
...@@ -361,11 +361,10 @@ Player::StartDecoder(MusicPipe &_pipe) noexcept ...@@ -361,11 +361,10 @@ Player::StartDecoder(MusicPipe &_pipe) noexcept
assert(queued || pc.command == PlayerCommand::SEEK); assert(queued || pc.command == PlayerCommand::SEEK);
assert(pc.next_song != nullptr); assert(pc.next_song != nullptr);
{ const std::lock_guard<Mutex> protect(pc.mutex);
/* copy ReplayGain parameters to the decoder */
const std::lock_guard<Mutex> protect(pc.mutex); /* copy ReplayGain parameters to the decoder */
dc.replay_gain_mode = pc.replay_gain_mode; dc.replay_gain_mode = pc.replay_gain_mode;
}
SongTime start_time = pc.next_song->GetStartTime() + pc.seek_time; SongTime start_time = pc.next_song->GetStartTime() + pc.seek_time;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment