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

Unified Diff: webrtc/modules/audio_device/audio_device_buffer.h

Issue 2445363003: Improvements in how WebRTC.Audio.RecordedOnlyZeros is added as histogram (Closed)
Patch Set: cleanup Created 4 years, 2 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
Index: webrtc/modules/audio_device/audio_device_buffer.h
diff --git a/webrtc/modules/audio_device/audio_device_buffer.h b/webrtc/modules/audio_device/audio_device_buffer.h
index 6967ebd757147762b5291abd25d8c1a7940e0b0e..4841ffdd0c710211391d4b2fe5cbc6b89bd00da5 100644
--- a/webrtc/modules/audio_device/audio_device_buffer.h
+++ b/webrtc/modules/audio_device/audio_device_buffer.h
@@ -38,6 +38,10 @@ class AudioDeviceBuffer {
int32_t InitPlayout();
int32_t InitRecording();
+ void StartPlayout();
tommi 2016/10/25 16:43:23 we have the following three states: construct / d
henrika_webrtc 2016/10/26 12:42:41 Good point. Calls to init have been around for a l
+ void StartRecording();
+ void StopPlayout();
+ void StopRecording();
int32_t SetRecordingSampleRate(uint32_t fsHz);
int32_t SetPlayoutSampleRate(uint32_t fsHz);
@@ -76,6 +80,9 @@ class AudioDeviceBuffer {
// timer.
void StartTimer();
+ // Stops the timer by releasing the unique TaskQueue instance.
+ void StopTimer();
+
// Called periodically on the internal thread created by the TaskQueue.
void LogStats();
@@ -105,10 +112,13 @@ class AudioDeviceBuffer {
// Task queue used to invoke LogStats() periodically. Tasks are executed on a
// worker thread but it does not necessarily have to be the same thread for
// each task.
- rtc::TaskQueue task_queue_;
+ std::unique_ptr<rtc::TaskQueue> task_queue_;
- // Ensures that the timer is only started once.
- bool timer_has_started_;
+ // Keeps track of if playout/recording are active or not. A combination
+ // of these states are used to determine when to start and stop the timer.
+ // Only used on the creating thread and not used to control any media flow.
+ bool playing_;
+ bool recording_;
// Sample rate in Hertz.
uint32_t rec_sample_rate_;
@@ -196,18 +206,19 @@ class AudioDeviceBuffer {
// where a new measurement is done twice per second.
int16_t max_play_level_;
- // Counts number of times we detect "no audio" corresponding to a case where
- // all level measurements since the last log has been exactly zero.
- // In other words: this counter is incremented only if 20 measurements
- // (two per second) in a row equals zero. The member is only incremented on
- // the task queue and max once every 10th second.
- size_t num_rec_level_is_zero_;
-
// Counts number of audio callbacks modulo 50 to create a signal when
// a new storage of audio stats shall be done.
// Only updated on the OS-specific audio thread that drives audio.
int16_t rec_stat_count_;
int16_t play_stat_count_;
+
+ // Time stamps of when playout and recording starts.
+ uint64_t play_start_time_;
+ uint64_t rec_start_time_;
+
+ // Set to true at construction and modified to false as soon as one audio-
+ // level estimate larger than zero is detected.
+ bool only_silence_recorded_;
};
} // namespace webrtc
« no previous file with comments | « no previous file | webrtc/modules/audio_device/audio_device_buffer.cc » ('j') | webrtc/modules/audio_device/audio_device_buffer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698