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

Unified Diff: webrtc/modules/audio_device/audio_device_buffer.cc

Issue 2350103002: Improves resolution when logging rate in the ADB class (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_device/audio_device_buffer.cc
diff --git a/webrtc/modules/audio_device/audio_device_buffer.cc b/webrtc/modules/audio_device/audio_device_buffer.cc
index 0c85fdaf833944b46aca88635eb5ad4f95620456..28d6a97e8b0bde5f81c195c51fcf88d0e36ce913 100644
--- a/webrtc/modules/audio_device/audio_device_buffer.cc
+++ b/webrtc/modules/audio_device/audio_device_buffer.cc
@@ -400,23 +400,23 @@ void AudioDeviceBuffer::LogStats() {
// after ~20 seconds.
if (++num_stat_reports_ > 1) {
hlundin-webrtc 2016/09/20 07:30:25 You should add && time_since_last > 0 to the if st
henrika_webrtc 2016/09/20 09:05:32 Thanks!
uint32_t diff_samples = rec_samples_ - last_rec_samples_;
- uint32_t rate = diff_samples / kTimerIntervalInSeconds;
+ float rate = diff_samples / (static_cast<float>(time_since_last) / 1000.0);
LOG(INFO) << "[REC : " << time_since_last << "msec, "
<< rec_sample_rate_ / 1000
<< "kHz] callbacks: " << rec_callbacks_ - last_rec_callbacks_
<< ", "
<< "samples: " << diff_samples << ", "
- << "rate: " << rate << ", "
+ << "rate: " << static_cast<int>(rate + 0.5) << ", "
<< "level: " << max_rec_level_;
diff_samples = play_samples_ - last_play_samples_;
- rate = diff_samples / kTimerIntervalInSeconds;
+ rate = diff_samples / (static_cast<float>(time_since_last) / 1000.0);
LOG(INFO) << "[PLAY: " << time_since_last << "msec, "
<< play_sample_rate_ / 1000
<< "kHz] callbacks: " << play_callbacks_ - last_play_callbacks_
<< ", "
<< "samples: " << diff_samples << ", "
- << "rate: " << rate << ", "
+ << "rate: " << static_cast<int>(rate + 0.5) << ", "
<< "level: " << max_play_level_;
}
« 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