OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1088 public_submodules_->echo_cancellation->stream_drift_samples()); | 1088 public_submodules_->echo_cancellation->stream_drift_samples()); |
1089 msg->set_level(gain_control()->stream_analog_level()); | 1089 msg->set_level(gain_control()->stream_analog_level()); |
1090 msg->set_keypress(capture_.key_pressed); | 1090 msg->set_keypress(capture_.key_pressed); |
1091 } | 1091 } |
1092 #endif | 1092 #endif |
1093 | 1093 |
1094 MaybeUpdateHistograms(); | 1094 MaybeUpdateHistograms(); |
1095 | 1095 |
1096 AudioBuffer* capture_buffer = capture_.capture_audio.get(); // For brevity. | 1096 AudioBuffer* capture_buffer = capture_.capture_audio.get(); // For brevity. |
1097 | 1097 |
1098 rms_.Analyze(rtc::ArrayView<const int16_t>( | 1098 capture_input_rms_.Analyze(rtc::ArrayView<const int16_t>( |
1099 capture_buffer->channels_const()[0], | 1099 capture_buffer->channels_const()[0], |
1100 capture_nonlocked_.capture_processing_format.num_frames())); | 1100 capture_nonlocked_.capture_processing_format.num_frames())); |
1101 if (++rms_interval_counter_ >= 1000) { | 1101 if (capture_rms_interval_counter_ >= 1000) { |
1102 rms_interval_counter_ = 0; | 1102 RmsLevel::Levels levels = capture_input_rms_.AverageAndPeak(); |
1103 RmsLevel::Levels levels = rms_.AverageAndPeak(); | |
1104 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.ApmCaptureInputLevelAverage", | 1103 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.ApmCaptureInputLevelAverage", |
1105 levels.average, 1, RmsLevel::kMinLevelDb, 100); | 1104 levels.average, 1, RmsLevel::kMinLevelDb, 100); |
1106 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.ApmCaptureInputLevelPeak", levels.peak, | 1105 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.ApmCaptureInputLevelPeak", levels.peak, |
1107 1, RmsLevel::kMinLevelDb, 100); | 1106 1, RmsLevel::kMinLevelDb, 100); |
1108 } | 1107 } |
1109 | 1108 |
1110 if (constants_.use_experimental_agc && | 1109 if (constants_.use_experimental_agc && |
1111 public_submodules_->gain_control->is_enabled()) { | 1110 public_submodules_->gain_control->is_enabled()) { |
1112 private_submodules_->agc_manager->AnalyzePreProcess( | 1111 private_submodules_->agc_manager->AnalyzePreProcess( |
1113 capture_buffer->channels()[0], capture_buffer->num_channels(), | 1112 capture_buffer->channels()[0], capture_buffer->num_channels(), |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1221 capture_.key_pressed); | 1220 capture_.key_pressed); |
1222 } | 1221 } |
1223 | 1222 |
1224 if (capture_nonlocked_.level_controller_enabled) { | 1223 if (capture_nonlocked_.level_controller_enabled) { |
1225 private_submodules_->level_controller->Process(capture_buffer); | 1224 private_submodules_->level_controller->Process(capture_buffer); |
1226 } | 1225 } |
1227 | 1226 |
1228 // The level estimator operates on the recombined data. | 1227 // The level estimator operates on the recombined data. |
1229 public_submodules_->level_estimator->ProcessStream(capture_buffer); | 1228 public_submodules_->level_estimator->ProcessStream(capture_buffer); |
1230 | 1229 |
1230 capture_output_rms_.Analyze(rtc::ArrayView<const int16_t>( | |
1231 capture_buffer->channels_const()[0], | |
1232 capture_nonlocked_.capture_processing_format.num_frames())); | |
1233 if (++capture_rms_interval_counter_ >= 1000) { | |
1234 capture_rms_interval_counter_ = 0; | |
1235 RmsLevel::Levels levels = capture_output_rms_.AverageAndPeak(); | |
1236 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.ApmCaptureOutputLevelAverage", | |
hlundin-webrtc
2016/12/06 16:07:10
Did you not want this to be RTC_HISTOGRAM_COUNTS_L
peah-webrtc
2016/12/20 14:02:39
Fully true! Thanks! I also changed the ranges to m
| |
1237 levels.average, 1, RmsLevel::kMinLevelDb, 100); | |
1238 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.ApmCaptureOutputLevelPeak", levels.peak, | |
hlundin-webrtc
2016/12/06 16:07:10
And this?
peah-webrtc
2016/12/20 14:02:39
Done.
| |
1239 1, RmsLevel::kMinLevelDb, 100); | |
1240 } | |
1241 | |
1231 capture_.was_stream_delay_set = false; | 1242 capture_.was_stream_delay_set = false; |
1232 return kNoError; | 1243 return kNoError; |
1233 } | 1244 } |
1234 | 1245 |
1235 int AudioProcessingImpl::AnalyzeReverseStream(const float* const* data, | 1246 int AudioProcessingImpl::AnalyzeReverseStream(const float* const* data, |
1236 size_t samples_per_channel, | 1247 size_t samples_per_channel, |
1237 int sample_rate_hz, | 1248 int sample_rate_hz, |
1238 ChannelLayout layout) { | 1249 ChannelLayout layout) { |
1239 TRACE_EVENT0("webrtc", "AudioProcessing::AnalyzeReverseStream_ChannelLayout"); | 1250 TRACE_EVENT0("webrtc", "AudioProcessing::AnalyzeReverseStream_ChannelLayout"); |
1240 rtc::CritScope cs(&crit_render_); | 1251 rtc::CritScope cs(&crit_render_); |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1891 capture_processing_format(kSampleRate16kHz), | 1902 capture_processing_format(kSampleRate16kHz), |
1892 split_rate(kSampleRate16kHz) {} | 1903 split_rate(kSampleRate16kHz) {} |
1893 | 1904 |
1894 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; | 1905 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; |
1895 | 1906 |
1896 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; | 1907 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; |
1897 | 1908 |
1898 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; | 1909 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; |
1899 | 1910 |
1900 } // namespace webrtc | 1911 } // namespace webrtc |
OLD | NEW |