Index: media/audio/audio_input_controller.cc |
diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc |
index 72239f0d9c30efbdc80290988e787cee57e1b531..e76aff9bbdc5e40fb75d928561aa95c1050251c3 100644 |
--- a/media/audio/audio_input_controller.cc |
+++ b/media/audio/audio_input_controller.cc |
@@ -583,7 +583,24 @@ void AudioInputController::DoLogAudioLevels(float level_dbfs, |
if (!handler_) |
return; |
- std::string log_string = base::StringPrintf( |
+ std::string log_string; |
tommi (sloooow) - chröme
2014/10/15 17:00:48
nit: move this down to where you need it (where pr
henrika (OOO until Aug 14)
2014/10/16 09:58:00
Done.
|
+ |
+ // Detect if the user has enabled hardware mute by pressing the mute |
+ // button in audio settings for the selected microphone. |
+ const bool microphone_is_muted = stream_->IsMuted(); |
+ if (microphone_is_muted) { |
tommi (sloooow) - chröme
2014/10/15 17:00:48
nit: you don't really need this variable.
henrika (OOO until Aug 14)
2014/10/16 09:58:00
Done.
|
+ LogMicrophoneMuteResult(MICROPHONE_IS_MUTED); |
+ log_string = base::StringPrintf( |
tommi (sloooow) - chröme
2014/10/15 17:00:48
no need for StringPrintf
henrika (OOO until Aug 14)
2014/10/16 09:58:00
Done.
|
+ "AIC::OnData: microphone is muted!"); |
+ handler_->OnLog(this, log_string); |
+ // Return early if microphone is muted. No idea adding logs and UMA stats |
tommi (sloooow) - chröme
2014/10/15 17:00:48
nit: "No idea" -> "No need to" (etc)
henrika (OOO until Aug 14)
2014/10/16 09:58:00
Done.
|
+ // of audio levels if we know that the micropone is muted. |
+ return; |
+ } else { |
tommi (sloooow) - chröme
2014/10/15 17:00:48
nit: no need for else since there's an early retur
henrika (OOO until Aug 14)
2014/10/16 09:58:00
Done.
|
+ LogMicrophoneMuteResult(MICROPHONE_IS_NOT_MUTED); |
+ } |
+ |
+ log_string = base::StringPrintf( |
"AIC::OnData: average audio level=%.2f dBFS", level_dbfs); |
static const float kSilenceThresholdDBFS = -72.24719896f; |
if (level_dbfs < kSilenceThresholdDBFS) |
@@ -598,20 +615,6 @@ void AudioInputController::DoLogAudioLevels(float level_dbfs, |
if (microphone_volume_percent < kLowLevelMicrophoneLevelPercent) |
log_string += " <=> low microphone level!"; |
handler_->OnLog(this, log_string); |
- |
- // Try to detect if the user has enabled hardware mute by pressing the mute |
- // button in audio settings for the selected microphone. The idea here is to |
- // detect when all input samples are zeros but the actual volume slider is |
- // larger than zero. It should correspond to a hardware mute state. |
- if (level_dbfs == -std::numeric_limits<float>::infinity() && |
- microphone_volume_percent > 0) { |
- LogMicrophoneMuteResult(MICROPHONE_IS_MUTED); |
- log_string = base::StringPrintf( |
- "AIC::OnData: microphone is muted!"); |
- handler_->OnLog(this, log_string); |
- } else { |
- LogMicrophoneMuteResult(MICROPHONE_IS_NOT_MUTED); |
- } |
#endif |
} |