Commit c0d5bd20 authored by Max Kellermann's avatar Max Kellermann

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

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