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

Unified Diff: content/renderer/media/webrtc_audio_capturer.cc

Issue 229573003: Adds more logging for audio input issues. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
Index: content/renderer/media/webrtc_audio_capturer.cc
diff --git a/content/renderer/media/webrtc_audio_capturer.cc b/content/renderer/media/webrtc_audio_capturer.cc
index 7318cba1ba5e32b5c89f6aacfc41fa94f2106f9e..482d25f1114b2479baabcda0d4fb930c4e5ba944 100644
--- a/content/renderer/media/webrtc_audio_capturer.cc
+++ b/content/renderer/media/webrtc_audio_capturer.cc
@@ -38,6 +38,13 @@ const int kValidInputRates[] = {48000, 44100};
const int kValidInputRates[] = {44100};
#endif
+// Time constant for AudioPowerMonitor. See AudioPowerMonitor ctor comments
+// for semantics. This value was arbitrarily chosen, but seems to work well.
+const int kPowerMonitorTimeConstantMs = 10;
+
+// The time between two audio power level samples.
+const int kPowerMonitorLogIntervalSeconds = 10;
+
} // namespace
// Reference counted container of WebRtcLocalAudioTrack delegate.
@@ -222,7 +229,10 @@ WebRtcAudioCapturer::WebRtcAudioCapturer(
peer_connection_mode_(false),
key_pressed_(false),
need_audio_processing_(false),
- audio_device_(audio_device) {
+ audio_device_(audio_device),
+ audio_power_monitor_(
+ device_info_.device.input.sample_rate,
+ base::TimeDelta::FromMilliseconds(kPowerMonitorTimeConstantMs)) {
DVLOG(1) << "WebRtcAudioCapturer::WebRtcAudioCapturer()";
}
@@ -483,6 +493,20 @@ void WebRtcAudioCapturer::Capture(media::AudioBus* audio_source,
(*it)->SetAudioProcessor(audio_processor_);
}
+ if ((base::TimeTicks::Now() - last_audio_level_log_time_).InSeconds() >
+ kPowerMonitorLogIntervalSeconds) {
+ audio_power_monitor_.Scan(*audio_source, audio_source->frames());
+
+ last_audio_level_log_time_ = base::TimeTicks::Now();
+
+ std::pair<float, bool> result =
+ audio_power_monitor_.ReadCurrentPowerAndClip();
+ WebRtcLogMessage(base::StringPrintf(
+ "WAC::Capture: current_audio_power=%.2fdBFS.", result.first));
+
+ audio_power_monitor_.Reset();
+ }
+
// Push the data to the processor for processing.
audio_processor_->PushCaptureData(audio_source);

Powered by Google App Engine
This is Rietveld 408576698