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

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

Issue 1304973005: Refactor AudioParameters member setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cross-platform fixes. Created 5 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
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_manager_base.h" 5 #include "media/audio/audio_manager_base.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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // output device based on the input parameters. This may happen if the OS 256 // output device based on the input parameters. This may happen if the OS
257 // provided us junk values for the hardware configuration. 257 // provided us junk values for the hardware configuration.
258 LOG(ERROR) << "Invalid audio output parameters received; using fake " 258 LOG(ERROR) << "Invalid audio output parameters received; using fake "
259 << "audio path. Channels: " << output_params.channels() << ", " 259 << "audio path. Channels: " << output_params.channels() << ", "
260 << "Sample Rate: " << output_params.sample_rate() << ", " 260 << "Sample Rate: " << output_params.sample_rate() << ", "
261 << "Bits Per Sample: " << output_params.bits_per_sample() 261 << "Bits Per Sample: " << output_params.bits_per_sample()
262 << ", Frames Per Buffer: " 262 << ", Frames Per Buffer: "
263 << output_params.frames_per_buffer(); 263 << output_params.frames_per_buffer();
264 264
265 // Tell the AudioManager to create a fake output device. 265 // Tell the AudioManager to create a fake output device.
266 output_params = AudioParameters( 266 output_params = params;
267 AudioParameters::AUDIO_FAKE, params.channel_layout(), 267 output_params.set_format(AudioParameters::AUDIO_FAKE);
268 params.sample_rate(), params.bits_per_sample(),
269 params.frames_per_buffer(), params.effects());
270 } else if (params.effects() != output_params.effects()) { 268 } else if (params.effects() != output_params.effects()) {
271 // Turn off effects that weren't requested. 269 // Turn off effects that weren't requested.
272 output_params = AudioParameters( 270 output_params.set_effects(params.effects() & output_params.effects());
273 output_params.format(), output_params.channel_layout(),
274 output_params.channels(), output_params.sample_rate(),
275 output_params.bits_per_sample(), output_params.frames_per_buffer(),
276 params.effects() & output_params.effects());
277 } 271 }
278 } 272 }
279 273
280 DispatcherParams* dispatcher_params = 274 DispatcherParams* dispatcher_params =
281 new DispatcherParams(params, output_params, output_device_id); 275 new DispatcherParams(params, output_params, output_device_id);
282 276
283 AudioOutputDispatchers::iterator it = 277 AudioOutputDispatchers::iterator it =
284 std::find_if(output_dispatchers_.begin(), output_dispatchers_.end(), 278 std::find_if(output_dispatchers_.begin(), output_dispatchers_.end(),
285 CompareByParams(dispatcher_params)); 279 CompareByParams(dispatcher_params));
286 if (it != output_dispatchers_.end()) { 280 if (it != output_dispatchers_.end()) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog( 407 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog(
414 AudioLogFactory::AudioComponent component) { 408 AudioLogFactory::AudioComponent component) {
415 return audio_log_factory_->CreateAudioLog(component); 409 return audio_log_factory_->CreateAudioLog(component);
416 } 410 }
417 411
418 void AudioManagerBase::SetHasKeyboardMic() { 412 void AudioManagerBase::SetHasKeyboardMic() {
419 NOTREACHED(); 413 NOTREACHED();
420 } 414 }
421 415
422 } // namespace media 416 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/android/audio_manager_android.cc ('k') | media/audio/audio_output_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698