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

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: Fixes in AVRT wrapper based on review by tommi 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 // Use Core Audio (WASAPI) on Vista and higher. Use Wave for XP and lower.
scherkus (not reviewing) 2011/10/18 21:12:30 shouldn't this comment go in the windows code?
henrika (OOO until Aug 14) 2011/10/19 15:42:43 Done.
35 VLOG(1) << "Using AUDIO_PCM_LOW_LATENCY as input mode on Windows.";
36 audio_parameters_.format = AudioParameters::AUDIO_PCM_LOW_LATENCY;
33 #else 37 #else
38 // TODO(henrika): add support for AUDIO_PCM_LOW_LATENCY on Linux as well.
34 audio_parameters_.format = AudioParameters::AUDIO_PCM_LINEAR; 39 audio_parameters_.format = AudioParameters::AUDIO_PCM_LINEAR;
35 #endif 40 #endif
36 audio_parameters_.channels = channels; 41 audio_parameters_.channels = channels;
37 audio_parameters_.sample_rate = static_cast<int>(sample_rate); 42 audio_parameters_.sample_rate = static_cast<int>(sample_rate);
38 audio_parameters_.bits_per_sample = 16; 43 audio_parameters_.bits_per_sample = 16;
39 audio_parameters_.samples_per_packet = buffer_size; 44 audio_parameters_.samples_per_packet = buffer_size;
40 for (int i = 0; i < channels; ++i) { 45 for (int i = 0; i < channels; ++i) {
41 float* channel_data = new float[buffer_size]; 46 float* channel_data = new float[buffer_size];
42 audio_data_.push_back(channel_data); 47 audio_data_.push_back(channel_data);
43 } 48 }
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 bytes_per_sample, 320 bytes_per_sample,
316 number_of_frames); 321 number_of_frames);
317 } 322 }
318 323
319 // Deliver captured data to the client in floating point format 324 // Deliver captured data to the client in floating point format
320 // and update the audio-delay measurement. 325 // and update the audio-delay measurement.
321 callback_->Capture(audio_data_, 326 callback_->Capture(audio_data_,
322 number_of_frames, 327 number_of_frames,
323 audio_delay_milliseconds_); 328 audio_delay_milliseconds_);
324 } 329 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698