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

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

Issue 2496543002: Ensures that AudioDeviceBuffer::StopPeriodicLogging works as intended (Closed)
Patch Set: Feedback from kwiberg@ Created 4 years, 1 month 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 | « webrtc/modules/audio_device/audio_device_buffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_device/audio_device_buffer.cc
diff --git a/webrtc/modules/audio_device/audio_device_buffer.cc b/webrtc/modules/audio_device/audio_device_buffer.cc
index 4102a610d10c18a1074f44aa76872b2d4d2de2de..d40b05e70a4df158f7099505bb5eef0b474c1023 100644
--- a/webrtc/modules/audio_device/audio_device_buffer.cc
+++ b/webrtc/modules/audio_device/audio_device_buffer.cc
@@ -68,7 +68,8 @@ AudioDeviceBuffer::AudioDeviceBuffer()
play_stat_count_(0),
play_start_time_(0),
rec_start_time_(0),
- only_silence_recorded_(true) {
+ only_silence_recorded_(true),
+ log_stats_(false) {
LOG(INFO) << "AudioDeviceBuffer::ctor";
playout_thread_checker_.DetachFromThread();
recording_thread_checker_.DetachFromThread();
@@ -429,16 +430,23 @@ void AudioDeviceBuffer::StopPeriodicLogging() {
void AudioDeviceBuffer::LogStats(LogState state) {
RTC_DCHECK_RUN_ON(&task_queue_);
int64_t now_time = rtc::TimeMillis();
+
if (state == AudioDeviceBuffer::LOG_START) {
// Reset counters at start. We will not add any logging in this state but
// the timer will started by posting a new (delayed) task.
num_stat_reports_ = 0;
last_timer_task_time_ = now_time;
+ log_stats_ = true;
} else if (state == AudioDeviceBuffer::LOG_STOP) {
// Stop logging and posting new tasks.
- return;
+ log_stats_ = false;
} else if (state == AudioDeviceBuffer::LOG_ACTIVE) {
- // Default state. Just keep on logging.
+ // Keep logging unless logging was disabled while task was posted.
+ }
+
+ // Avoid adding more logs since we are in STOP mode.
+ if (!log_stats_) {
+ return;
}
int64_t next_callback_time = now_time + kTimerIntervalInMilliseconds;
« no previous file with comments | « webrtc/modules/audio_device/audio_device_buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698