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

Side by Side Diff: content/renderer/media/media_stream_audio_level_calculator.h

Issue 178223013: Calculate the signal level on the media stream local audio track (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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_LEVEL_CALCULATOR_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_LEVEL_CALCULATOR_H_
7
8 #include "base/threading/non_thread_safe.h"
9
10 namespace content {
11
12 // This class is used by the WebRtcLocalAudioTrack to calculate the level of
13 // the audio signal. And the audio level will be eventually used by the volume
14 // animation UI.
15 // The algorithm used by this class is the same as how it is done in
16 // third_party/webrtc/voice_engine/level_indicator.cc.
17 class MediaStreamAudioLevelCalculator : public base::NonThreadSafe {
no longer working on chromium 2014/03/01 11:34:28 I can't use the NonThreadSafe here since the objec
tommi (sloooow) - chröme 2014/03/01 11:49:33 Can you document that then instead?
no longer working on chromium 2014/03/01 12:37:00 Done with adding comment above the thread_check_ m
18 public:
19 MediaStreamAudioLevelCalculator();
20 ~MediaStreamAudioLevelCalculator();
21
22 // Calculates the signal level of the audio data.
23 // Returns the level of bars that the volume animation UI uses for
24 // presenting the energy level of the audio data.
25 int Calculate(const int16* audio_data, int number_of_channels,
26 int number_of_frames);
27
28 private:
29 int counter_;
30 int max_amplitude_;
31 int level_;
32 };
33
34 } // namespace content
35
36 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_LEVEL_CALCULATOR_H_
OLDNEW
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/media/media_stream_audio_level_calculator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698