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

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

Issue 23466008: Wire up the output device id and provide an implementation on Windows. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update comments Created 7 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
« no previous file with comments | « media/audio/audio_output_resampler.h ('k') | media/audio/win/audio_low_latency_output_win.h » ('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_output_resampler.h" 5 #include "media/audio/audio_output_resampler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 return AudioParameters( 140 return AudioParameters(
141 AudioParameters::AUDIO_PCM_LINEAR, input_params.channel_layout(), 141 AudioParameters::AUDIO_PCM_LINEAR, input_params.channel_layout(),
142 input_params.sample_rate(), input_params.bits_per_sample(), 142 input_params.sample_rate(), input_params.bits_per_sample(),
143 frames_per_buffer); 143 frames_per_buffer);
144 } 144 }
145 #endif 145 #endif
146 146
147 AudioOutputResampler::AudioOutputResampler(AudioManager* audio_manager, 147 AudioOutputResampler::AudioOutputResampler(AudioManager* audio_manager,
148 const AudioParameters& input_params, 148 const AudioParameters& input_params,
149 const AudioParameters& output_params, 149 const AudioParameters& output_params,
150 const std::string& output_device_id,
150 const std::string& input_device_id, 151 const std::string& input_device_id,
151 const base::TimeDelta& close_delay) 152 const base::TimeDelta& close_delay)
152 : AudioOutputDispatcher(audio_manager, input_params, input_device_id), 153 : AudioOutputDispatcher(audio_manager, input_params, output_device_id,
154 input_device_id),
153 close_delay_(close_delay), 155 close_delay_(close_delay),
154 output_params_(output_params), 156 output_params_(output_params),
155 input_device_id_(input_device_id),
156 streams_opened_(false) { 157 streams_opened_(false) {
157 DCHECK(input_params.IsValid()); 158 DCHECK(input_params.IsValid());
158 DCHECK(output_params.IsValid()); 159 DCHECK(output_params.IsValid());
159 DCHECK_EQ(output_params_.format(), AudioParameters::AUDIO_PCM_LOW_LATENCY); 160 DCHECK_EQ(output_params_.format(), AudioParameters::AUDIO_PCM_LOW_LATENCY);
160 161
161 // Record UMA statistics for the hardware configuration. 162 // Record UMA statistics for the hardware configuration.
162 RecordStats(output_params); 163 RecordStats(output_params);
163 164
164 Initialize(); 165 Initialize();
165 } 166 }
166 167
167 AudioOutputResampler::~AudioOutputResampler() { 168 AudioOutputResampler::~AudioOutputResampler() {
168 DCHECK(callbacks_.empty()); 169 DCHECK(callbacks_.empty());
169 } 170 }
170 171
171 void AudioOutputResampler::Initialize() { 172 void AudioOutputResampler::Initialize() {
172 DCHECK(!streams_opened_); 173 DCHECK(!streams_opened_);
173 DCHECK(callbacks_.empty()); 174 DCHECK(callbacks_.empty());
174 dispatcher_ = new AudioOutputDispatcherImpl( 175 dispatcher_ = new AudioOutputDispatcherImpl(
175 audio_manager_, output_params_, input_device_id_, close_delay_); 176 audio_manager_, output_params_, output_device_id_, input_device_id_,
177 close_delay_);
176 } 178 }
177 179
178 bool AudioOutputResampler::OpenStream() { 180 bool AudioOutputResampler::OpenStream() {
179 DCHECK_EQ(base::MessageLoop::current(), message_loop_); 181 DCHECK_EQ(base::MessageLoop::current(), message_loop_);
180 182
181 if (dispatcher_->OpenStream()) { 183 if (dispatcher_->OpenStream()) {
182 // Only record the UMA statistic if we didn't fallback during construction 184 // Only record the UMA statistic if we didn't fallback during construction
183 // and only for the first stream we open. 185 // and only for the first stream we open.
184 if (!streams_opened_ && 186 if (!streams_opened_ &&
185 output_params_.format() == AudioParameters::AUDIO_PCM_LOW_LATENCY) { 187 output_params_.format() == AudioParameters::AUDIO_PCM_LOW_LATENCY) {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 return frames > 0 ? 1 : 0; 388 return frames > 0 ? 1 : 0;
387 } 389 }
388 390
389 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { 391 void OnMoreDataConverter::OnError(AudioOutputStream* stream) {
390 base::AutoLock auto_lock(source_lock_); 392 base::AutoLock auto_lock(source_lock_);
391 if (source_callback_) 393 if (source_callback_)
392 source_callback_->OnError(stream); 394 source_callback_->OnError(stream);
393 } 395 }
394 396
395 } // namespace media 397 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_output_resampler.h ('k') | media/audio/win/audio_low_latency_output_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698