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

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

Issue 344583002: Modifies AudioInputCallback::OnData and use media::AudioBus instead of plain byte vector (Relanding) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added extra non-pure OnData API 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
« no previous file with comments | « media/audio/pulse/pulse_output.cc ('k') | media/audio/virtual_audio_input_stream_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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
OLDNEW
« no previous file with comments | « media/audio/pulse/pulse_output.cc ('k') | media/audio/virtual_audio_input_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698