OLD | NEW |
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/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 if (user_input_monitor_) { | 519 if (user_input_monitor_) { |
520 size_t current_count = user_input_monitor_->GetKeyPressCount(); | 520 size_t current_count = user_input_monitor_->GetKeyPressCount(); |
521 key_pressed = current_count != prev_key_down_count_; | 521 key_pressed = current_count != prev_key_down_count_; |
522 prev_key_down_count_ = current_count; | 522 prev_key_down_count_ = current_count; |
523 DVLOG_IF(6, key_pressed) << "Detected keypress."; | 523 DVLOG_IF(6, key_pressed) << "Detected keypress."; |
524 } | 524 } |
525 | 525 |
526 // Use SharedMemory and SyncSocket if the client has created a SyncWriter. | 526 // Use SharedMemory and SyncSocket if the client has created a SyncWriter. |
527 // Used by all low-latency clients except WebSpeech. | 527 // Used by all low-latency clients except WebSpeech. |
528 if (SharedMemoryAndSyncSocketMode()) { | 528 if (SharedMemoryAndSyncSocketMode()) { |
529 sync_writer_->Write(source, volume, key_pressed); | 529 sync_writer_->Write(source, volume, key_pressed, hardware_delay_bytes); |
530 sync_writer_->UpdateRecordedBytes(hardware_delay_bytes); | |
531 | 530 |
532 #if defined(AUDIO_POWER_MONITORING) | 531 #if defined(AUDIO_POWER_MONITORING) |
533 // Only do power-level measurements if DoCreate() has been called. It will | 532 // Only do power-level measurements if DoCreate() has been called. It will |
534 // ensure that logging will mainly be done for WebRTC and WebSpeech | 533 // ensure that logging will mainly be done for WebRTC and WebSpeech |
535 // clients. | 534 // clients. |
536 if (!power_measurement_is_enabled_) | 535 if (!power_measurement_is_enabled_) |
537 return; | 536 return; |
538 | 537 |
539 // Perform periodic audio (power) level measurements. | 538 // Perform periodic audio (power) level measurements. |
540 if ((base::TimeTicks::Now() - last_audio_level_log_time_).InSeconds() > | 539 if ((base::TimeTicks::Now() - last_audio_level_log_time_).InSeconds() > |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 } | 669 } |
671 | 670 |
672 void AudioInputController::LogSilenceState(SilenceState value) { | 671 void AudioInputController::LogSilenceState(SilenceState value) { |
673 UMA_HISTOGRAM_ENUMERATION("Media.AudioInputControllerSessionSilenceReport", | 672 UMA_HISTOGRAM_ENUMERATION("Media.AudioInputControllerSessionSilenceReport", |
674 value, | 673 value, |
675 SILENCE_STATE_MAX + 1); | 674 SILENCE_STATE_MAX + 1); |
676 } | 675 } |
677 #endif | 676 #endif |
678 | 677 |
679 } // namespace media | 678 } // namespace media |
OLD | NEW |