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

Unified Diff: webrtc/voice_engine/audio_level.h

Issue 2984473002: Move total audio energy and duration tracking to AudioLevel and protect with existing critial secti… (Closed)
Patch Set: rebase Created 3 years, 5 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 | « no previous file | webrtc/voice_engine/audio_level.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/voice_engine/audio_level.h
diff --git a/webrtc/voice_engine/audio_level.h b/webrtc/voice_engine/audio_level.h
index 3bcb0d9b4542d85ca336a7b30f7ca8c106c000f0..caecf40689ea27f9dbceeabafde5c7d761da7772 100644
--- a/webrtc/voice_engine/audio_level.h
+++ b/webrtc/voice_engine/audio_level.h
@@ -29,11 +29,15 @@ class AudioLevel {
int8_t Level() const;
int16_t LevelFullRange() const;
void Clear();
+ // See the description for "totalAudioEnergy" in the WebRTC stats spec
+ // (https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-totalaudioenergy)
+ double TotalEnergy() const;
+ double TotalDuration() const;
// Called on a native capture audio thread (platform dependent) from the
// AudioTransport::RecordedDataIsAvailable() callback.
// In Chrome, this method is called on the AudioInputDevice thread.
- void ComputeLevel(const AudioFrame& audioFrame);
+ void ComputeLevel(const AudioFrame& audioFrame, double duration);
private:
enum { kUpdateFrequency = 10 };
@@ -44,6 +48,9 @@ class AudioLevel {
int16_t count_;
int8_t current_level_;
int16_t current_level_full_range_;
+
+ double total_energy_ = 0.0;
+ double total_duration_ = 0.0;
};
} // namespace voe
« no previous file with comments | « no previous file | webrtc/voice_engine/audio_level.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698