| 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 this, | 552 this, |
| 553 average_power_dbfs, | 553 average_power_dbfs, |
| 554 mic_volume_percent)); | 554 mic_volume_percent)); |
| 555 | 555 |
| 556 last_audio_level_log_time_ = base::TimeTicks::Now(); | 556 last_audio_level_log_time_ = base::TimeTicks::Now(); |
| 557 } | 557 } |
| 558 #endif | 558 #endif |
| 559 return; | 559 return; |
| 560 } | 560 } |
| 561 | 561 |
| 562 DVLOG(1) << "AIC::OnData: " << source->frames(); |
| 563 |
| 562 // TODO(henrika): Investigate if we can avoid the extra copy here. | 564 // TODO(henrika): Investigate if we can avoid the extra copy here. |
| 563 // (see http://crbug.com/249316 for details). AFAIK, this scope is only | 565 // (see http://crbug.com/249316 for details). AFAIK, this scope is only |
| 564 // active for WebSpeech clients. | 566 // active for WebSpeech clients. |
| 565 scoped_ptr<AudioBus> audio_data = | 567 scoped_ptr<AudioBus> audio_data = |
| 566 AudioBus::Create(source->channels(), source->frames()); | 568 AudioBus::Create(source->channels(), source->frames()); |
| 567 source->CopyTo(audio_data.get()); | 569 source->CopyTo(audio_data.get()); |
| 568 | 570 |
| 569 // Ownership of the audio buffer will be with the callback until it is run, | 571 // Ownership of the audio buffer will be with the callback until it is run, |
| 570 // when ownership is passed to the callback function. | 572 // when ownership is passed to the callback function. |
| 571 task_runner_->PostTask( | 573 task_runner_->PostTask( |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 } | 672 } |
| 671 | 673 |
| 672 void AudioInputController::LogSilenceState(SilenceState value) { | 674 void AudioInputController::LogSilenceState(SilenceState value) { |
| 673 UMA_HISTOGRAM_ENUMERATION("Media.AudioInputControllerSessionSilenceReport", | 675 UMA_HISTOGRAM_ENUMERATION("Media.AudioInputControllerSessionSilenceReport", |
| 674 value, | 676 value, |
| 675 SILENCE_STATE_MAX + 1); | 677 SILENCE_STATE_MAX + 1); |
| 676 } | 678 } |
| 677 #endif | 679 #endif |
| 678 | 680 |
| 679 } // namespace media | 681 } // namespace media |
| OLD | NEW |