Use constexpr to avoid a static initializer

Floating-point calculations are not guaranteed to happen at compile time
unless you force the issue with constexpr. This initializer was found
by running tools\win\static_initializers on a canary build
chrome_child.dll. constexpr was added to kSilenceRms for consistency.

BUG=chromium:341941

Review-Url: https://codereview.webrtc.org/2943833002
Cr-Commit-Position: refs/heads/master@{#18684}
This commit is contained in:
brucedawson 2017-06-20 10:57:09 -07:00 committed by Commit Bot
parent 26b16f7d52
commit fde2116288

View File

@ -33,9 +33,9 @@ namespace webrtc {
struct VadAudioProc::PitchAnalysisStruct : public ::PitchAnalysisStruct {};
struct VadAudioProc::PreFiltBankstr : public ::PreFiltBankstr {};
static const float kFrequencyResolution =
static constexpr float kFrequencyResolution =
kSampleRateHz / static_cast<float>(VadAudioProc::kDftSize);
static const int kSilenceRms = 5;
static constexpr int kSilenceRms = 5;
// TODO(turajs): Make a Create or Init for VadAudioProc.
VadAudioProc::VadAudioProc()