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

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

Issue 10830268: Allow audio system to handle synchronized low-latency audio I/O (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/audio_device_thread.h ('k') | media/audio/audio_input_device.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/audio_device_thread.h" 5 #include "media/audio/audio_device_thread.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 base::AutoLock auto_lock(callback_lock_); 170 base::AutoLock auto_lock(callback_lock_);
171 if (callback_) 171 if (callback_)
172 callback_->Process(pending_data); 172 callback_->Process(pending_data);
173 } 173 }
174 } 174 }
175 175
176 // AudioDeviceThread::Callback implementation 176 // AudioDeviceThread::Callback implementation
177 177
178 AudioDeviceThread::Callback::Callback( 178 AudioDeviceThread::Callback::Callback(
179 const AudioParameters& audio_parameters, 179 const AudioParameters& audio_parameters,
180 int input_channels,
180 base::SharedMemoryHandle memory, int memory_length) 181 base::SharedMemoryHandle memory, int memory_length)
181 : audio_parameters_(audio_parameters), 182 : audio_parameters_(audio_parameters),
183 input_channels_(input_channels),
182 samples_per_ms_(audio_parameters.sample_rate() / 1000), 184 samples_per_ms_(audio_parameters.sample_rate() / 1000),
183 bytes_per_ms_(audio_parameters.channels() * 185 bytes_per_ms_(audio_parameters.channels() *
184 (audio_parameters_.bits_per_sample() / 8) * 186 (audio_parameters_.bits_per_sample() / 8) *
185 samples_per_ms_), 187 samples_per_ms_),
186 shared_memory_(memory, false), 188 shared_memory_(memory, false),
187 memory_length_(memory_length) { 189 memory_length_(memory_length) {
188 CHECK_NE(bytes_per_ms_, 0); // Catch division by zero early. 190 CHECK_NE(bytes_per_ms_, 0); // Catch division by zero early.
189 CHECK_NE(samples_per_ms_, 0); 191 CHECK_NE(samples_per_ms_, 0);
190 } 192 }
191 193
192 AudioDeviceThread::Callback::~Callback() {} 194 AudioDeviceThread::Callback::~Callback() {}
193 195
194 void AudioDeviceThread::Callback::InitializeOnAudioThread() { 196 void AudioDeviceThread::Callback::InitializeOnAudioThread() {
195 MapSharedMemory(); 197 MapSharedMemory();
196 DCHECK(shared_memory_.memory() != NULL); 198 DCHECK(shared_memory_.memory() != NULL);
197 } 199 }
198 200
199 } // namespace media. 201 } // namespace media.
OLDNEW
« no previous file with comments | « media/audio/audio_device_thread.h ('k') | media/audio/audio_input_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698