Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: webrtc/modules/audio_processing/aec3/render_delay_controller.cc

Issue 2782423003: Major updates to the echo removal functionality in AEC3 (Closed)
Patch Set: Added initialization of uninitialized vector Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 #include "webrtc/modules/audio_processing/aec3/render_delay_controller.h" 10 #include "webrtc/modules/audio_processing/aec3/render_delay_controller.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 ++align_call_counter_; 104 ++align_call_counter_;
105 rtc::Optional<size_t> echo_path_delay_samples = 105 rtc::Optional<size_t> echo_path_delay_samples =
106 delay_estimator_.EstimateDelay(render_buffer, capture); 106 delay_estimator_.EstimateDelay(render_buffer, capture);
107 if (echo_path_delay_samples) { 107 if (echo_path_delay_samples) {
108 echo_path_delay_samples_ = *echo_path_delay_samples; 108 echo_path_delay_samples_ = *echo_path_delay_samples;
109 109
110 // Compute and set new render delay buffer delay. 110 // Compute and set new render delay buffer delay.
111 const size_t new_delay = 111 const size_t new_delay =
112 ComputeNewBufferDelay(delay_, echo_path_delay_samples_); 112 ComputeNewBufferDelay(delay_, echo_path_delay_samples_);
113 if (new_delay != delay_ && align_call_counter_ > 250) { 113 if (new_delay != delay_ && align_call_counter_ > kNumBlocksPerSecond) {
114 delay_ = new_delay; 114 delay_ = new_delay;
115 } 115 }
116 116
117 // Update render delay buffer headroom. 117 // Update render delay buffer headroom.
118 blocks_since_last_delay_estimate_ = 0; 118 blocks_since_last_delay_estimate_ = 0;
119 const int headroom = echo_path_delay_samples_ - delay_ * kBlockSize; 119 const int headroom = echo_path_delay_samples_ - delay_ * kBlockSize;
120 RTC_DCHECK_LE(0, headroom); 120 RTC_DCHECK_LE(0, headroom);
121 headroom_samples_ = rtc::Optional<size_t>(headroom); 121 headroom_samples_ = rtc::Optional<size_t>(headroom);
122 } else if (++blocks_since_last_delay_estimate_ > 250 * 20) { 122 } else if (++blocks_since_last_delay_estimate_ > 20 * kNumBlocksPerSecond) {
123 headroom_samples_ = rtc::Optional<size_t>(); 123 headroom_samples_ = rtc::Optional<size_t>();
124 } 124 }
125 125
126 metrics_.Update(echo_path_delay_samples, delay_); 126 metrics_.Update(echo_path_delay_samples, delay_);
127 127
128 data_dumper_->DumpRaw("aec3_render_delay_controller_delay", 1, 128 data_dumper_->DumpRaw("aec3_render_delay_controller_delay", 1,
129 &echo_path_delay_samples_); 129 &echo_path_delay_samples_);
130 data_dumper_->DumpRaw("aec3_render_delay_controller_buffer_delay", delay_); 130 data_dumper_->DumpRaw("aec3_render_delay_controller_buffer_delay", delay_);
131 131
132 return delay_; 132 return delay_;
133 } 133 }
134 134
135 } // namespace 135 } // namespace
136 136
137 RenderDelayController* RenderDelayController::Create(int sample_rate_hz) { 137 RenderDelayController* RenderDelayController::Create(int sample_rate_hz) {
138 return new RenderDelayControllerImpl(sample_rate_hz); 138 return new RenderDelayControllerImpl(sample_rate_hz);
139 } 139 }
140 140
141 } // namespace webrtc 141 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698