| 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/virtual_audio_input_stream.h" | 5 #include "media/audio/virtual_audio_input_stream.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 DCHECK_LE(0, num_attached_output_streams_); | 132 DCHECK_LE(0, num_attached_output_streams_); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void VirtualAudioInputStream::PumpAudio(AudioBus* audio_bus) { | 135 void VirtualAudioInputStream::PumpAudio(AudioBus* audio_bus) { |
| 136 DCHECK(worker_task_runner_->BelongsToCurrentThread()); | 136 DCHECK(worker_task_runner_->BelongsToCurrentThread()); |
| 137 | 137 |
| 138 { | 138 { |
| 139 base::AutoLock scoped_lock(converter_network_lock_); | 139 base::AutoLock scoped_lock(converter_network_lock_); |
| 140 mixer_.Convert(audio_bus); | 140 mixer_.Convert(audio_bus); |
| 141 } | 141 } |
| 142 audio_bus->ToInterleaved(params_.frames_per_buffer(), | |
| 143 params_.bits_per_sample() / 8, | |
| 144 buffer_.get()); | |
| 145 callback_->OnData(this, | 142 callback_->OnData(this, |
| 146 buffer_.get(), | 143 audio_bus, |
| 147 params_.GetBytesPerBuffer(), | |
| 148 params_.GetBytesPerBuffer(), | 144 params_.GetBytesPerBuffer(), |
| 149 1.0); | 145 1.0); |
| 150 } | 146 } |
| 151 | 147 |
| 152 void VirtualAudioInputStream::Close() { | 148 void VirtualAudioInputStream::Close() { |
| 153 DCHECK(thread_checker_.CalledOnValidThread()); | 149 DCHECK(thread_checker_.CalledOnValidThread()); |
| 154 | 150 |
| 155 Stop(); // Make sure callback_ is no longer being used. | 151 Stop(); // Make sure callback_ is no longer being used. |
| 156 | 152 |
| 157 // If a non-null AfterCloseCallback was provided to the constructor, invoke it | 153 // If a non-null AfterCloseCallback was provided to the constructor, invoke it |
| (...skipping 16 matching lines...) Expand all Loading... |
| 174 return 1.0; | 170 return 1.0; |
| 175 } | 171 } |
| 176 | 172 |
| 177 void VirtualAudioInputStream::SetAutomaticGainControl(bool enabled) {} | 173 void VirtualAudioInputStream::SetAutomaticGainControl(bool enabled) {} |
| 178 | 174 |
| 179 bool VirtualAudioInputStream::GetAutomaticGainControl() { | 175 bool VirtualAudioInputStream::GetAutomaticGainControl() { |
| 180 return false; | 176 return false; |
| 181 } | 177 } |
| 182 | 178 |
| 183 } // namespace media | 179 } // namespace media |
| OLD | NEW |