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