| 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/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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 if (user_input_monitor_) { | 445 if (user_input_monitor_) { |
| 446 size_t current_count = user_input_monitor_->GetKeyPressCount(); | 446 size_t current_count = user_input_monitor_->GetKeyPressCount(); |
| 447 key_pressed = current_count != prev_key_down_count_; | 447 key_pressed = current_count != prev_key_down_count_; |
| 448 prev_key_down_count_ = current_count; | 448 prev_key_down_count_ = current_count; |
| 449 DVLOG_IF(6, key_pressed) << "Detected keypress."; | 449 DVLOG_IF(6, key_pressed) << "Detected keypress."; |
| 450 } | 450 } |
| 451 | 451 |
| 452 // Use SharedMemory and SyncSocket if the client has created a SyncWriter. | 452 // Use SharedMemory and SyncSocket if the client has created a SyncWriter. |
| 453 // Used by all low-latency clients except WebSpeech. | 453 // Used by all low-latency clients except WebSpeech. |
| 454 if (SharedMemoryAndSyncSocketMode()) { | 454 if (SharedMemoryAndSyncSocketMode()) { |
| 455 sync_writer_->Write(source, volume, key_pressed); | 455 sync_writer_->Write(source, volume, key_pressed, hardware_delay_bytes); |
| 456 sync_writer_->UpdateRecordedBytes(hardware_delay_bytes); | |
| 457 | 456 |
| 458 #if defined(AUDIO_POWER_MONITORING) | 457 #if defined(AUDIO_POWER_MONITORING) |
| 459 // Only do power-level measurements if an AudioPowerMonitor object has | 458 // Only do power-level measurements if an AudioPowerMonitor object has |
| 460 // been created. Done in DoCreate() but not DoCreateForStream(), hence | 459 // been created. Done in DoCreate() but not DoCreateForStream(), hence |
| 461 // logging will mainly be done for WebRTC and WebSpeech clients. | 460 // logging will mainly be done for WebRTC and WebSpeech clients. |
| 462 if (!audio_level_) | 461 if (!audio_level_) |
| 463 return; | 462 return; |
| 464 | 463 |
| 465 // Perform periodic audio (power) level measurements. | 464 // Perform periodic audio (power) level measurements. |
| 466 if ((base::TimeTicks::Now() - last_audio_level_log_time_).InSeconds() > | 465 if ((base::TimeTicks::Now() - last_audio_level_log_time_).InSeconds() > |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 } | 579 } |
| 581 | 580 |
| 582 void AudioInputController::LogSilenceState(SilenceState value) { | 581 void AudioInputController::LogSilenceState(SilenceState value) { |
| 583 UMA_HISTOGRAM_ENUMERATION("Media.AudioInputControllerSessionSilenceReport", | 582 UMA_HISTOGRAM_ENUMERATION("Media.AudioInputControllerSessionSilenceReport", |
| 584 value, | 583 value, |
| 585 SILENCE_STATE_MAX + 1); | 584 SILENCE_STATE_MAX + 1); |
| 586 } | 585 } |
| 587 #endif | 586 #endif |
| 588 | 587 |
| 589 } // namespace media | 588 } // namespace media |
| OLD | NEW |