Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: trunk/src/media/audio/virtual_audio_input_stream.cc

Issue 335343004: Revert 277794 "Modifies AudioInputCallback::OnData and use media..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « trunk/src/media/audio/pulse/pulse_output.cc ('k') | trunk/src/media/audio/virtual_audio_input_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698