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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 // Restart the timer to ensure that we check the flag again in | 500 // Restart the timer to ensure that we check the flag again in |
501 // |kTimerResetIntervalSeconds|. | 501 // |kTimerResetIntervalSeconds|. |
502 no_data_timer_->Start( | 502 no_data_timer_->Start( |
503 FROM_HERE, base::TimeDelta::FromSeconds(kTimerResetIntervalSeconds), | 503 FROM_HERE, base::TimeDelta::FromSeconds(kTimerResetIntervalSeconds), |
504 base::Bind(&AudioInputController::DoCheckForNoData, | 504 base::Bind(&AudioInputController::DoCheckForNoData, |
505 base::Unretained(this))); | 505 base::Unretained(this))); |
506 } | 506 } |
507 | 507 |
508 void AudioInputController::OnData(AudioInputStream* stream, | 508 void AudioInputController::OnData(AudioInputStream* stream, |
509 const AudioBus* source, | 509 const AudioBus* source, |
510 uint32 hardware_delay_bytes, | 510 uint32_t hardware_delay_bytes, |
511 double volume) { | 511 double volume) { |
512 // |input_writer_| should only be accessed on the audio thread, but as a means | 512 // |input_writer_| should only be accessed on the audio thread, but as a means |
513 // to avoid copying data and posting on the audio thread, we just check for | 513 // to avoid copying data and posting on the audio thread, we just check for |
514 // non-null here. | 514 // non-null here. |
515 if (input_writer_) { | 515 if (input_writer_) { |
516 scoped_ptr<AudioBus> source_copy = | 516 scoped_ptr<AudioBus> source_copy = |
517 AudioBus::Create(source->channels(), source->frames()); | 517 AudioBus::Create(source->channels(), source->frames()); |
518 source->CopyTo(source_copy.get()); | 518 source->CopyTo(source_copy.get()); |
519 task_runner_->PostTask( | 519 task_runner_->PostTask( |
520 FROM_HERE, | 520 FROM_HERE, |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 } | 727 } |
728 | 728 |
729 void AudioInputController::WriteInputDataForDebugging( | 729 void AudioInputController::WriteInputDataForDebugging( |
730 scoped_ptr<AudioBus> data) { | 730 scoped_ptr<AudioBus> data) { |
731 DCHECK(task_runner_->BelongsToCurrentThread()); | 731 DCHECK(task_runner_->BelongsToCurrentThread()); |
732 if (input_writer_) | 732 if (input_writer_) |
733 input_writer_->Write(data.Pass()); | 733 input_writer_->Write(data.Pass()); |
734 } | 734 } |
735 | 735 |
736 } // namespace media | 736 } // namespace media |
OLD | NEW |