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 callback_->OnData(this, audio_bus, params_.GetBytesPerBuffer(), 1.0); | 142 audio_bus->ToInterleaved(params_.frames_per_buffer(), |
| 143 params_.bits_per_sample() / 8, |
| 144 buffer_.get()); |
| 145 callback_->OnData(this, |
| 146 buffer_.get(), |
| 147 params_.GetBytesPerBuffer(), |
| 148 params_.GetBytesPerBuffer(), |
| 149 1.0); |
143 } | 150 } |
144 | 151 |
145 void VirtualAudioInputStream::Close() { | 152 void VirtualAudioInputStream::Close() { |
146 DCHECK(thread_checker_.CalledOnValidThread()); | 153 DCHECK(thread_checker_.CalledOnValidThread()); |
147 | 154 |
148 Stop(); // Make sure callback_ is no longer being used. | 155 Stop(); // Make sure callback_ is no longer being used. |
149 | 156 |
150 // If a non-null AfterCloseCallback was provided to the constructor, invoke it | 157 // If a non-null AfterCloseCallback was provided to the constructor, invoke it |
151 // here. The callback is moved to a stack-local first since |this| could be | 158 // here. The callback is moved to a stack-local first since |this| could be |
152 // destroyed during Run(). | 159 // destroyed during Run(). |
(...skipping 14 matching lines...) Expand all Loading... |
167 return 1.0; | 174 return 1.0; |
168 } | 175 } |
169 | 176 |
170 void VirtualAudioInputStream::SetAutomaticGainControl(bool enabled) {} | 177 void VirtualAudioInputStream::SetAutomaticGainControl(bool enabled) {} |
171 | 178 |
172 bool VirtualAudioInputStream::GetAutomaticGainControl() { | 179 bool VirtualAudioInputStream::GetAutomaticGainControl() { |
173 return false; | 180 return false; |
174 } | 181 } |
175 | 182 |
176 } // namespace media | 183 } // namespace media |
OLD | NEW |