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

Side by Side Diff: content/renderer/media/audio_device_thread.cc

Issue 9805001: Move media/audio files into media namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 "content/renderer/media/audio_device_thread.h" 5 #include "content/renderer/media/audio_device_thread.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 164
165 base::AutoLock auto_lock(callback_lock_); 165 base::AutoLock auto_lock(callback_lock_);
166 if (callback_) 166 if (callback_)
167 callback_->Process(pending_data); 167 callback_->Process(pending_data);
168 } 168 }
169 } 169 }
170 170
171 // AudioDeviceThread::Callback implementation 171 // AudioDeviceThread::Callback implementation
172 172
173 AudioDeviceThread::Callback::Callback(const AudioParameters& audio_parameters, 173 AudioDeviceThread::Callback::Callback(
174 base::SharedMemoryHandle memory, 174 const media::AudioParameters& audio_parameters,
175 int memory_length) 175 base::SharedMemoryHandle memory, int memory_length)
176 : audio_parameters_(audio_parameters), 176 : audio_parameters_(audio_parameters),
177 samples_per_ms_(audio_parameters.sample_rate() / 1000), 177 samples_per_ms_(audio_parameters.sample_rate() / 1000),
178 bytes_per_ms_(audio_parameters.channels() * 178 bytes_per_ms_(audio_parameters.channels() *
179 (audio_parameters_.bits_per_sample() / 8) * 179 (audio_parameters_.bits_per_sample() / 8) *
180 samples_per_ms_), 180 samples_per_ms_),
181 shared_memory_(memory, false), 181 shared_memory_(memory, false),
182 memory_length_(memory_length) { 182 memory_length_(memory_length) {
183 } 183 }
184 184
185 AudioDeviceThread::Callback::~Callback() { 185 AudioDeviceThread::Callback::~Callback() {
186 for (size_t i = 0; i < audio_data_.size(); ++i) 186 for (size_t i = 0; i < audio_data_.size(); ++i)
187 delete [] audio_data_[i]; 187 delete [] audio_data_[i];
188 } 188 }
189 189
190 void AudioDeviceThread::Callback::InitializeOnAudioThread() { 190 void AudioDeviceThread::Callback::InitializeOnAudioThread() {
191 DCHECK(audio_data_.empty()); 191 DCHECK(audio_data_.empty());
192 192
193 MapSharedMemory(); 193 MapSharedMemory();
194 DCHECK(shared_memory_.memory() != NULL); 194 DCHECK(shared_memory_.memory() != NULL);
195 195
196 audio_data_.reserve(audio_parameters_.channels()); 196 audio_data_.reserve(audio_parameters_.channels());
197 for (int i = 0; i < audio_parameters_.channels(); ++i) { 197 for (int i = 0; i < audio_parameters_.channels(); ++i) {
198 float* channel_data = new float[audio_parameters_.frames_per_buffer()]; 198 float* channel_data = new float[audio_parameters_.frames_per_buffer()];
199 audio_data_.push_back(channel_data); 199 audio_data_.push_back(channel_data);
200 } 200 }
201 } 201 }
OLDNEW
« no previous file with comments | « content/renderer/media/audio_device_thread.h ('k') | content/renderer/media/audio_input_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698