decoder/Thread: move code to DecoderControl::LockIsReplayGainEnabled()
This commit is contained in:
parent
666e5d7904
commit
c0d5bd2048
|
@ -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)
|
||||||
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);
|
/* ReplayGain is disabled */
|
||||||
if (bridge.dc.replay_gain_mode == ReplayGainMode::OFF)
|
return;
|
||||||
/* ReplayGain is disabled */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadReplayGain(bridge, is);
|
LoadReplayGain(bridge, is);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue