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

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

Issue 8283032: Low-latency AudioInputStream implementation based on WASAPI for Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Now uses ScopedCoMem in base/win Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_input_device.h" 5 #include "content/renderer/media/audio_input_device.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "content/common/child_process.h" 10 #include "content/common/child_process.h"
(...skipping 12 matching lines...) Expand all
23 audio_delay_milliseconds_(0), 23 audio_delay_milliseconds_(0),
24 volume_(1.0), 24 volume_(1.0),
25 stream_id_(0), 25 stream_id_(0),
26 session_id_(0), 26 session_id_(0),
27 pending_device_ready_(false) { 27 pending_device_ready_(false) {
28 filter_ = RenderThreadImpl::current()->audio_input_message_filter(); 28 filter_ = RenderThreadImpl::current()->audio_input_message_filter();
29 audio_data_.reserve(channels); 29 audio_data_.reserve(channels);
30 #if defined(OS_MACOSX) 30 #if defined(OS_MACOSX)
31 VLOG(1) << "Using AUDIO_PCM_LOW_LATENCY as input mode on Mac OS X."; 31 VLOG(1) << "Using AUDIO_PCM_LOW_LATENCY as input mode on Mac OS X.";
32 audio_parameters_.format = AudioParameters::AUDIO_PCM_LOW_LATENCY; 32 audio_parameters_.format = AudioParameters::AUDIO_PCM_LOW_LATENCY;
33 #elif defined(OS_WIN)
34 VLOG(1) << "Using AUDIO_PCM_LOW_LATENCY as input mode on Windows.";
35 audio_parameters_.format = AudioParameters::AUDIO_PCM_LOW_LATENCY;
33 #else 36 #else
37 // TODO(henrika): add support for AUDIO_PCM_LOW_LATENCY on Linux as well.
34 audio_parameters_.format = AudioParameters::AUDIO_PCM_LINEAR; 38 audio_parameters_.format = AudioParameters::AUDIO_PCM_LINEAR;
35 #endif 39 #endif
36 audio_parameters_.channels = channels; 40 audio_parameters_.channels = channels;
37 audio_parameters_.sample_rate = static_cast<int>(sample_rate); 41 audio_parameters_.sample_rate = static_cast<int>(sample_rate);
38 audio_parameters_.bits_per_sample = 16; 42 audio_parameters_.bits_per_sample = 16;
39 audio_parameters_.samples_per_packet = buffer_size; 43 audio_parameters_.samples_per_packet = buffer_size;
40 for (int i = 0; i < channels; ++i) { 44 for (int i = 0; i < channels; ++i) {
41 float* channel_data = new float[buffer_size]; 45 float* channel_data = new float[buffer_size];
42 audio_data_.push_back(channel_data); 46 audio_data_.push_back(channel_data);
43 } 47 }
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 bytes_per_sample, 319 bytes_per_sample,
316 number_of_frames); 320 number_of_frames);
317 } 321 }
318 322
319 // Deliver captured data to the client in floating point format 323 // Deliver captured data to the client in floating point format
320 // and update the audio-delay measurement. 324 // and update the audio-delay measurement.
321 callback_->Capture(audio_data_, 325 callback_->Capture(audio_data_,
322 number_of_frames, 326 number_of_frames,
323 audio_delay_milliseconds_); 327 audio_delay_milliseconds_);
324 } 328 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698