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

Side by Side Diff: webrtc/modules/audio_processing/audio_processing_impl.cc

Issue 2749973003: Added locking when getting echo likelihood stats. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) 317 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
318 capture_(false, 318 capture_(false,
319 #else 319 #else
320 capture_(config.Get<ExperimentalNs>().enabled, 320 capture_(config.Get<ExperimentalNs>().enabled,
321 #endif 321 #endif
322 config.Get<Beamforming>().array_geometry, 322 config.Get<Beamforming>().array_geometry,
323 config.Get<Beamforming>().target_direction), 323 config.Get<Beamforming>().target_direction),
324 capture_nonlocked_(config.Get<Beamforming>().enabled, 324 capture_nonlocked_(config.Get<Beamforming>().enabled,
325 config.Get<Intelligibility>().enabled) { 325 config.Get<Intelligibility>().enabled) {
326 { 326 {
327 rtc::CritScope cs_render(&crit_render_); 327 rtc::CritScope cs_render(&crit_render_);
tommi 2017/03/15 16:14:45 ... any idea why we're grabbing these locks in the
ivoc 2017/03/15 17:14:15 Good question. I didn't write this code, so I'm no
tommi 2017/03/15 17:27:59 OK, thanks. I didn't mean to derail the review :)
ivoc 2017/03/15 19:30:44 I agree that this looks fishy. I'm sure that when
328 rtc::CritScope cs_capture(&crit_capture_); 328 rtc::CritScope cs_capture(&crit_capture_);
329 329
330 public_submodules_->echo_cancellation.reset( 330 public_submodules_->echo_cancellation.reset(
331 new EchoCancellationImpl(&crit_render_, &crit_capture_)); 331 new EchoCancellationImpl(&crit_render_, &crit_capture_));
332 public_submodules_->echo_control_mobile.reset( 332 public_submodules_->echo_control_mobile.reset(
333 new EchoControlMobileImpl(&crit_render_, &crit_capture_)); 333 new EchoControlMobileImpl(&crit_render_, &crit_capture_));
334 public_submodules_->gain_control.reset( 334 public_submodules_->gain_control.reset(
335 new GainControlImpl(&crit_capture_, &crit_capture_)); 335 new GainControlImpl(&crit_capture_, &crit_capture_));
336 public_submodules_->level_estimator.reset( 336 public_submodules_->level_estimator.reset(
337 new LevelEstimatorImpl(&crit_capture_)); 337 new LevelEstimatorImpl(&crit_capture_));
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 EchoCancellation::Metrics metrics; 1609 EchoCancellation::Metrics metrics;
1610 int success = public_submodules_->echo_cancellation->GetMetrics(&metrics); 1610 int success = public_submodules_->echo_cancellation->GetMetrics(&metrics);
1611 if (success == Error::kNoError) { 1611 if (success == Error::kNoError) {
1612 stats.a_nlp.Set(metrics.a_nlp); 1612 stats.a_nlp.Set(metrics.a_nlp);
1613 stats.divergent_filter_fraction = metrics.divergent_filter_fraction; 1613 stats.divergent_filter_fraction = metrics.divergent_filter_fraction;
1614 stats.echo_return_loss.Set(metrics.echo_return_loss); 1614 stats.echo_return_loss.Set(metrics.echo_return_loss);
1615 stats.echo_return_loss_enhancement.Set( 1615 stats.echo_return_loss_enhancement.Set(
1616 metrics.echo_return_loss_enhancement); 1616 metrics.echo_return_loss_enhancement);
1617 stats.residual_echo_return_loss.Set(metrics.residual_echo_return_loss); 1617 stats.residual_echo_return_loss.Set(metrics.residual_echo_return_loss);
1618 } 1618 }
1619 stats.residual_echo_likelihood = 1619 {
1620 private_submodules_->residual_echo_detector->echo_likelihood(); 1620 rtc::CritScope cs_capture(&crit_capture_);
1621 stats.residual_echo_likelihood_recent_max = 1621 stats.residual_echo_likelihood =
1622 private_submodules_->residual_echo_detector->echo_likelihood_recent_max(); 1622 private_submodules_->residual_echo_detector->echo_likelihood();
tommi 2017/03/15 16:14:45 could we instead make sure that either these stats
ivoc 2017/03/15 17:14:15 This function is called from a Chromium thread (I
tommi 2017/03/15 17:27:59 From what I can tell, it's actually called from ou
ivoc 2017/03/15 19:30:43 Yes, that's one place this is called from. Another
1623 stats.residual_echo_likelihood_recent_max =
1624 private_submodules_->residual_echo_detector
1625 ->echo_likelihood_recent_max();
1626 }
1623 public_submodules_->echo_cancellation->GetDelayMetrics( 1627 public_submodules_->echo_cancellation->GetDelayMetrics(
1624 &stats.delay_median, &stats.delay_standard_deviation, 1628 &stats.delay_median, &stats.delay_standard_deviation,
1625 &stats.fraction_poor_delays); 1629 &stats.fraction_poor_delays);
1626 return stats; 1630 return stats;
1627 } 1631 }
1628 1632
1629 EchoCancellation* AudioProcessingImpl::echo_cancellation() const { 1633 EchoCancellation* AudioProcessingImpl::echo_cancellation() const {
1630 return public_submodules_->echo_cancellation.get(); 1634 return public_submodules_->echo_cancellation.get();
1631 } 1635 }
1632 1636
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 capture_processing_format(kSampleRate16kHz), 1989 capture_processing_format(kSampleRate16kHz),
1986 split_rate(kSampleRate16kHz) {} 1990 split_rate(kSampleRate16kHz) {}
1987 1991
1988 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; 1992 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default;
1989 1993
1990 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; 1994 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default;
1991 1995
1992 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; 1996 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default;
1993 1997
1994 } // namespace webrtc 1998 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698