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

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

Issue 216773003: Use the absolute magnitude instead of the bar level as the level of the input signal (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 9 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 | « content/renderer/media/media_stream_audio_level_calculator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/media_stream_audio_level_calculator.cc
diff --git a/content/renderer/media/media_stream_audio_level_calculator.cc b/content/renderer/media/media_stream_audio_level_calculator.cc
index 29b7faef1755c33ef9a26f01c36e7ff185b27e65..a136e32ae1009dbe87139f04a687a3a038d4ac69 100644
--- a/content/renderer/media/media_stream_audio_level_calculator.cc
+++ b/content/renderer/media/media_stream_audio_level_calculator.cc
@@ -42,12 +42,6 @@ int MediaStreamAudioLevelCalculator::Calculate(const int16* audio_data,
int number_of_channels,
int number_of_frames) {
DCHECK(thread_checker_.CalledOnValidThread());
- // Permutation of bars that reprents the amplitude level of the audio signal.
- // The number of elements is 33 because we are indexing them in the range of
- // [0, 32].
- static const int kPermutation[33] =
no longer working on chromium 2014/03/28 10:30:34 Tommi, it turns out that libjingle uses _currentLe
tommi (sloooow) - chröme 2014/03/28 11:57:02 great :)
- {0,1,2,3,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,9,9,9,9,9,9,9,9,9,9,9};
-
// |level_| is updated every 10 callbacks. For the case where callback comes
// every 10ms, |level_| will be updated approximately every 100ms.
static const int kUpdateFrequency = 10;
@@ -56,18 +50,7 @@ int MediaStreamAudioLevelCalculator::Calculate(const int16* audio_data,
max_amplitude_ = std::max(max_amplitude_, max);
if (counter_++ == kUpdateFrequency) {
- // Divide the max amplitude (32768) by 1000 to get in the range of [0,32]
- // which is the range of the permutation array.
- int index = static_cast<int>(max_amplitude_ / 1000);
-
- // Make it less likely that the bar stays at position 0. I.e. only if
- // its in the range 0-250 (instead of 0-1000)
- if (index == 0 && max_amplitude_ > 250)
- index = 1;
-
- // |level_| will be the value in the permutation array that the |index| is
- // pointing to.
- level_ = kPermutation[index];
+ level_ = max_amplitude_;
// Decay the absolute maximum amplitude by 1/4.
max_amplitude_ >>= 2;
« no previous file with comments | « content/renderer/media/media_stream_audio_level_calculator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698