Commit c0d5bd20 authored by Max Kellermann's avatar Max Kellermann

decoder/Thread: move code to DecoderControl::LockIsReplayGainEnabled()

parent 666e5d79
......@@ -257,6 +257,12 @@ public:
return HasFailed();
}
[[gnu::pure]]
bool LockIsReplayGainEnabled() const noexcept {
const std::scoped_lock<Mutex> protect(mutex);
return replay_gain_mode != ReplayGainMode::OFF;
}
/**
* Transition this obejct from DecoderState::START to
* DecoderState::DECODE.
......
......@@ -261,12 +261,9 @@ LoadReplayGain(DecoderClient &client, InputStream &is)
static void
MaybeLoadReplayGain(DecoderBridge &bridge, InputStream &is)
{
{
const std::scoped_lock<Mutex> protect(bridge.dc.mutex);
if (bridge.dc.replay_gain_mode == ReplayGainMode::OFF)
/* ReplayGain is disabled */
return;
}
if (!bridge.dc.LockIsReplayGainEnabled())
/* ReplayGain is disabled */
return;
LoadReplayGain(bridge, is);
}
......
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