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

Side by Side Diff: media/audio/audio_input_controller.cc

Issue 510913005: Add native log and uma stat when all input shared memory buffers are full (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added unittest and addressed comments. Created 6 years, 3 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/audio_input_controller.h" 5 #include "media/audio/audio_input_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 if (user_input_monitor_) { 467 if (user_input_monitor_) {
468 size_t current_count = user_input_monitor_->GetKeyPressCount(); 468 size_t current_count = user_input_monitor_->GetKeyPressCount();
469 key_pressed = current_count != prev_key_down_count_; 469 key_pressed = current_count != prev_key_down_count_;
470 prev_key_down_count_ = current_count; 470 prev_key_down_count_ = current_count;
471 DVLOG_IF(6, key_pressed) << "Detected keypress."; 471 DVLOG_IF(6, key_pressed) << "Detected keypress.";
472 } 472 }
473 473
474 // Use SharedMemory and SyncSocket if the client has created a SyncWriter. 474 // Use SharedMemory and SyncSocket if the client has created a SyncWriter.
475 // Used by all low-latency clients except WebSpeech. 475 // Used by all low-latency clients except WebSpeech.
476 if (SharedMemoryAndSyncSocketMode()) { 476 if (SharedMemoryAndSyncSocketMode()) {
477 sync_writer_->Write(source, volume, key_pressed); 477 sync_writer_->Write(source, volume, key_pressed, hardware_delay_bytes);
478 sync_writer_->UpdateRecordedBytes(hardware_delay_bytes);
479 478
480 #if defined(AUDIO_POWER_MONITORING) 479 #if defined(AUDIO_POWER_MONITORING)
481 // Only do power-level measurements if an AudioPowerMonitor object has 480 // Only do power-level measurements if an AudioPowerMonitor object has
482 // been created. Done in DoCreate() but not DoCreateForStream(), hence 481 // been created. Done in DoCreate() but not DoCreateForStream(), hence
483 // logging will mainly be done for WebRTC and WebSpeech clients. 482 // logging will mainly be done for WebRTC and WebSpeech clients.
484 if (!audio_level_) 483 if (!audio_level_)
485 return; 484 return;
486 485
487 // Perform periodic audio (power) level measurements. 486 // Perform periodic audio (power) level measurements.
488 if ((base::TimeTicks::Now() - last_audio_level_log_time_).InSeconds() > 487 if ((base::TimeTicks::Now() - last_audio_level_log_time_).InSeconds() >
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 } 601 }
603 602
604 void AudioInputController::LogSilenceState(SilenceState value) { 603 void AudioInputController::LogSilenceState(SilenceState value) {
605 UMA_HISTOGRAM_ENUMERATION("Media.AudioInputControllerSessionSilenceReport", 604 UMA_HISTOGRAM_ENUMERATION("Media.AudioInputControllerSessionSilenceReport",
606 value, 605 value,
607 SILENCE_STATE_MAX + 1); 606 SILENCE_STATE_MAX + 1);
608 } 607 }
609 #endif 608 #endif
610 609
611 } // namespace media 610 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698