Comments in FixedDigitalLevelEstimator.
Changes in response to comments. Comments were not addressed in
https://webrtc-review.googlesource.com/c/src/+/52381
NOTRY=TRUE
TBR=saza@webrtc.org
Bug: webrt:7949
Change-Id: Id1ae2097d24159a8046ff85ea41959540bc48c4b
Reviewed-on: https://webrtc-review.googlesource.com/54500
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22056}
diff --git a/modules/audio_processing/agc2/fixed_digital_level_estimator.h b/modules/audio_processing/agc2/fixed_digital_level_estimator.h
index 7266c15..b0e7a6d 100644
--- a/modules/audio_processing/agc2/fixed_digital_level_estimator.h
+++ b/modules/audio_processing/agc2/fixed_digital_level_estimator.h
@@ -26,13 +26,18 @@
// filtering.
class FixedDigitalLevelEstimator {
public:
+ // Sample rates are allowed if the number of samples in a frame
+ // (sample_rate_hz * kFrameDurationMs / 1000) is divisible by
+ // kSubFramesInSample. For kFrameDurationMs=10 and
+ // kSubFramesInSample=20, this means that sample_rate_hz has to be
+ // divisible by 2000.
FixedDigitalLevelEstimator(size_t sample_rate_hz,
ApmDataDumper* apm_data_dumper);
// The input is assumed to be in FloatS16 format. Scaled input will
- // produce similarly scaled output. A frame of
- // length kFrameDurationMs=10 ms produces kSubFramesInFrame=20 level
- // estimates in the same scale.
+ // produce similarly scaled output. A frame of with kFrameDurationMs
+ // ms of audio produces a level estimates in the same scale. The
+ // level estimate contains kSubFramesInFrame values.
std::array<float, kSubFramesInFrame> ComputeLevel(
const AudioFrameView<const float>& float_frame);
@@ -43,7 +48,7 @@
private:
void CheckParameterCombination();
- ApmDataDumper* const apm_data_dumper_;
+ ApmDataDumper* const apm_data_dumper_ = nullptr;
float filter_state_level_ = 0.f;
size_t samples_in_frame_;
size_t samples_in_sub_frame_;
diff --git a/modules/audio_processing/audio_frame_view_unittest.cc b/modules/audio_processing/audio_frame_view_unittest.cc
index 5bd51ce..cf30496 100644
--- a/modules/audio_processing/audio_frame_view_unittest.cc
+++ b/modules/audio_processing/audio_frame_view_unittest.cc
@@ -39,7 +39,7 @@
AudioFrameView<const float> other_const_view = non_const_view;
static_cast<void>(other_const_view);
- // But not the other way.
+ // But not the other way. The following will fail:
// non_const_view = other_const_view;
AudioFrameView<int16_t> non_const_int16_view(