Index: content/browser/speech/endpointer/energy_endpointer.cc |
diff --git a/content/browser/speech/endpointer/energy_endpointer.cc b/content/browser/speech/endpointer/energy_endpointer.cc |
index c806aedd0b5c79eb96b8d349725d9e9e60348593..c7a7ccbeee15d4e7a7fc93bae36825c6c29876cf 100644 |
--- a/content/browser/speech/endpointer/energy_endpointer.cc |
+++ b/content/browser/speech/endpointer/energy_endpointer.cc |
@@ -327,12 +327,19 @@ void EnergyEndpointer::ProcessAudioFrame(int64 time_us, |
++frame_counter_; |
if (rms_out) { |
- *rms_out = -120.0; |
- if ((noise_level_ > 0.0) && ((rms / noise_level_ ) > 0.000001)) |
- *rms_out = static_cast<float>(20.0 * log10(rms / noise_level_)); |
+ *rms_out = -2000.0; |
+ if (rms > 1.0e-100) |
bulach
2011/03/01 17:39:04
again, it may be nicer to define these magic const
|
+ *rms_out = 20 * log10(rms); |
} |
} |
+float EnergyEndpointer::GetNoiseLevelDB() const { |
+ float levelDB = -2000.0; |
+ if (noise_level_ > 1.0e-100) |
+ levelDB = 20 * log10(noise_level_); |
+ return levelDB; |
bulach
2011/03/01 17:39:04
ditto, dB and named constants..
|
+} |
+ |
void EnergyEndpointer::UpdateLevels(float rms) { |
// Update quickly initially. We assume this is noise and that |
// speech is 6dB above the noise. |