Added locking when getting echo likelihood stats.

Currently no lock is taken when returning echo likelihood stats, which causes a race condition between the thread getting the stats and the thread running the echo detector. This CL resolves the issue by adding locking.

BUG=webrtc:7346

Review-Url: https://codereview.webrtc.org/2749973003
Cr-Commit-Position: refs/heads/master@{#17270}
This commit is contained in:
ivoc
2017-03-16 04:22:14 -07:00
committed by Commit bot
parent f13b54867f
commit 9c192b2b06

View File

@ -1616,10 +1616,14 @@ AudioProcessing::AudioProcessingStatistics AudioProcessingImpl::GetStatistics()
metrics.echo_return_loss_enhancement);
stats.residual_echo_return_loss.Set(metrics.residual_echo_return_loss);
}
stats.residual_echo_likelihood =
private_submodules_->residual_echo_detector->echo_likelihood();
stats.residual_echo_likelihood_recent_max =
private_submodules_->residual_echo_detector->echo_likelihood_recent_max();
{
rtc::CritScope cs_capture(&crit_capture_);
stats.residual_echo_likelihood =
private_submodules_->residual_echo_detector->echo_likelihood();
stats.residual_echo_likelihood_recent_max =
private_submodules_->residual_echo_detector
->echo_likelihood_recent_max();
}
public_submodules_->echo_cancellation->GetDelayMetrics(
&stats.delay_median, &stats.delay_standard_deviation,
&stats.fraction_poor_delays);