Replace a DCHECK with static_assert

This requires marking a bunch of compile-time constants "constexpr"
instead of just "const".

Review-Url: https://codereview.webrtc.org/2335483003
Cr-Commit-Position: refs/heads/master@{#14199}
This commit is contained in:
kwiberg
2016-09-13 07:49:33 -07:00
committed by Commit bot
parent ba56b6c7d2
commit d59d3bb117
2 changed files with 17 additions and 16 deletions

View File

@ -513,9 +513,15 @@ class AudioProcessing {
kSampleRate48kHz = 48000
};
static const int kNativeSampleRatesHz[];
static const size_t kNumNativeSampleRates;
static const int kMaxNativeSampleRateHz;
// TODO(kwiberg): We currently need to support a compiler (Visual C++) that
// complains if we don't explicitly state the size of the array here. Remove
// the size when that's no longer the case.
static constexpr int kNativeSampleRatesHz[4] = {
kSampleRate8kHz, kSampleRate16kHz, kSampleRate32kHz, kSampleRate48kHz};
static constexpr size_t kNumNativeSampleRates =
arraysize(kNativeSampleRatesHz);
static constexpr int kMaxNativeSampleRateHz =
kNativeSampleRatesHz[kNumNativeSampleRates - 1];
static const int kChunkSizeMs = 10;
};