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

Side by Side Diff: webrtc/audio/audio_send_stream.cc

Issue 2463813002: Make use of new APM statistics interface. (Closed)
Patch Set: Remove DCHECKs on values of stats. Created 4 years, 1 month 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 | « webrtc/audio/DEPS ('k') | webrtc/audio/audio_send_stream_unittest.cc » ('j') | 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 190 }
191 191
192 // Local speech level. 192 // Local speech level.
193 { 193 {
194 unsigned int level = 0; 194 unsigned int level = 0;
195 int error = volume->GetSpeechInputLevelFullRange(level); 195 int error = volume->GetSpeechInputLevelFullRange(level);
196 RTC_DCHECK_EQ(0, error); 196 RTC_DCHECK_EQ(0, error);
197 stats.audio_level = static_cast<int32_t>(level); 197 stats.audio_level = static_cast<int32_t>(level);
198 } 198 }
199 199
200 bool echo_metrics_on = false; 200 ScopedVoEInterface<VoEBase> base(voice_engine());
201 int error = processing->GetEcMetricsStatus(echo_metrics_on); 201 RTC_DCHECK(base->audio_processing());
202 RTC_DCHECK_EQ(0, error); 202 auto audio_processing_stats = base->audio_processing()->GetStatistics();
203 if (echo_metrics_on) { 203 stats.echo_delay_median_ms = audio_processing_stats.delay_median;
204 // These can also be negative, but in practice -1 is only used to signal 204 stats.echo_delay_std_ms = audio_processing_stats.delay_standard_deviation;
205 // insufficient data, since the resolution is limited to multiples of 4 ms. 205 stats.echo_return_loss = audio_processing_stats.echo_return_loss.instant();
206 int median = -1; 206 stats.echo_return_loss_enhancement =
207 int std = -1; 207 audio_processing_stats.echo_return_loss_enhancement.instant();
208 float dummy = 0.0f; 208 stats.residual_echo_likelihood =
209 error = processing->GetEcDelayMetrics(median, std, dummy); 209 audio_processing_stats.residual_echo_likelihood;
210 RTC_DCHECK_EQ(0, error);
211 stats.echo_delay_median_ms = median;
212 stats.echo_delay_std_ms = std;
213
214 // These can take on valid negative values, so use the lowest possible level
215 // as default rather than -1.
216 int erl = -100;
217 int erle = -100;
218 int dummy1 = 0;
219 int dummy2 = 0;
220 error = processing->GetEchoMetrics(erl, erle, dummy1, dummy2);
221 RTC_DCHECK_EQ(0, error);
222 stats.echo_return_loss = erl;
223 stats.echo_return_loss_enhancement = erle;
224 }
225
226 // TODO(ivoc): Hook this up to the residual echo detector.
227 stats.residual_echo_likelihood = 0.0f;
228 210
229 internal::AudioState* audio_state = 211 internal::AudioState* audio_state =
230 static_cast<internal::AudioState*>(audio_state_.get()); 212 static_cast<internal::AudioState*>(audio_state_.get());
231 stats.typing_noise_detected = audio_state->typing_noise_detected(); 213 stats.typing_noise_detected = audio_state->typing_noise_detected();
232 214
233 return stats; 215 return stats;
234 } 216 }
235 217
236 void AudioSendStream::SignalNetworkState(NetworkState state) { 218 void AudioSendStream::SignalNetworkState(NetworkState state) {
237 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 219 RTC_DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 LOG(LS_WARNING) << "SetVADStatus() failed: " << base->LastError(); 368 LOG(LS_WARNING) << "SetVADStatus() failed: " << base->LastError();
387 return false; 369 return false;
388 } 370 }
389 } 371 }
390 } 372 }
391 return true; 373 return true;
392 } 374 }
393 375
394 } // namespace internal 376 } // namespace internal
395 } // namespace webrtc 377 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/DEPS ('k') | webrtc/audio/audio_send_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698