| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 RTC_DCHECK_LT(read_index, render_power_.size()); | 99 RTC_DCHECK_LT(read_index, render_power_.size()); |
| 100 covariances_[delay].Update(capture_power, capture_mean, | 100 covariances_[delay].Update(capture_power, capture_mean, |
| 101 capture_std_deviation, render_power_[read_index], | 101 capture_std_deviation, render_power_[read_index], |
| 102 render_power_mean_[read_index], | 102 render_power_mean_[read_index], |
| 103 render_power_std_dev_[read_index]); | 103 render_power_std_dev_[read_index]); |
| 104 echo_likelihood_ = std::max( | 104 echo_likelihood_ = std::max( |
| 105 echo_likelihood_, covariances_[delay].normalized_cross_correlation()); | 105 echo_likelihood_, covariances_[delay].normalized_cross_correlation()); |
| 106 } | 106 } |
| 107 reliability_ = (1.0f - kAlpha) * reliability_ + kAlpha * 1.0f; | 107 reliability_ = (1.0f - kAlpha) * reliability_ + kAlpha * 1.0f; |
| 108 echo_likelihood_ *= reliability_; | 108 echo_likelihood_ *= reliability_; |
| 109 // This is a temporary fix to prevent echo likelihood values > 1.0. |
| 110 // TODO(ivoc): Find the root cause of this issue and fix it. |
| 111 echo_likelihood_ = std::min(echo_likelihood_, 1.0f); |
| 109 int echo_percentage = static_cast<int>(echo_likelihood_ * 100); | 112 int echo_percentage = static_cast<int>(echo_likelihood_ * 100); |
| 110 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.ResidualEchoDetector.EchoLikelihood", | 113 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.ResidualEchoDetector.EchoLikelihood", |
| 111 echo_percentage, 0, 100, 100 /* number of bins */); | 114 echo_percentage, 0, 100, 100 /* number of bins */); |
| 112 | 115 |
| 113 // Update the buffer of recent likelihood values. | 116 // Update the buffer of recent likelihood values. |
| 114 recent_likelihood_max_.Update(echo_likelihood_); | 117 recent_likelihood_max_.Update(echo_likelihood_); |
| 115 | 118 |
| 116 // Update the next insertion index. | 119 // Update the next insertion index. |
| 117 ++next_insertion_index_; | 120 ++next_insertion_index_; |
| 118 next_insertion_index_ %= kLookbackFrames; | 121 next_insertion_index_ %= kLookbackFrames; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 140 RTC_DCHECK_GE(160, audio->num_frames_per_band()); | 143 RTC_DCHECK_GE(160, audio->num_frames_per_band()); |
| 141 | 144 |
| 142 packed_buffer->clear(); | 145 packed_buffer->clear(); |
| 143 packed_buffer->insert(packed_buffer->end(), | 146 packed_buffer->insert(packed_buffer->end(), |
| 144 audio->split_bands_const_f(0)[kBand0To8kHz], | 147 audio->split_bands_const_f(0)[kBand0To8kHz], |
| 145 (audio->split_bands_const_f(0)[kBand0To8kHz] + | 148 (audio->split_bands_const_f(0)[kBand0To8kHz] + |
| 146 audio->num_frames_per_band())); | 149 audio->num_frames_per_band())); |
| 147 } | 150 } |
| 148 | 151 |
| 149 } // namespace webrtc | 152 } // namespace webrtc |
| OLD | NEW |