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

Side by Side Diff: media/audio/mac/audio_manager_mac.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
« no previous file with comments | « media/audio/fake_audio_manager.cc ('k') | media/audio/pulse/audio_manager_pulse.cc » ('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/mac/audio_manager_mac.h" 5 #include "media/audio/mac/audio_manager_mac.h"
6 6
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/mac/mac_logging.h" 10 #include "base/mac/mac_logging.h"
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 // work correctly. 665 // work correctly.
666 int output_channels = input_params.channels(); 666 int output_channels = input_params.channels();
667 ChannelLayout channel_layout = input_params.channel_layout(); 667 ChannelLayout channel_layout = input_params.channel_layout();
668 if (!has_valid_input_params || output_channels > hardware_channels) { 668 if (!has_valid_input_params || output_channels > hardware_channels) {
669 output_channels = hardware_channels; 669 output_channels = hardware_channels;
670 channel_layout = GuessChannelLayout(output_channels); 670 channel_layout = GuessChannelLayout(output_channels);
671 if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) 671 if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED)
672 channel_layout = CHANNEL_LAYOUT_DISCRETE; 672 channel_layout = CHANNEL_LAYOUT_DISCRETE;
673 } 673 }
674 674
675 return AudioParameters( 675 AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
676 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, output_channels, 676 hardware_sample_rate, 16, buffer_size,
677 hardware_sample_rate, 16, buffer_size, AudioParameters::NO_EFFECTS); 677 AudioParameters::NO_EFFECTS);
678 params.set_channels_for_discrete(output_channels);
679 return params;
678 } 680 }
679 681
680 void AudioManagerMac::InitializeOnAudioThread() { 682 void AudioManagerMac::InitializeOnAudioThread() {
681 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); 683 DCHECK(GetTaskRunner()->BelongsToCurrentThread());
682 power_observer_.reset(new AudioPowerObserver()); 684 power_observer_.reset(new AudioPowerObserver());
683 } 685 }
684 686
685 void AudioManagerMac::ShutdownOnAudioThread() { 687 void AudioManagerMac::ShutdownOnAudioThread() {
686 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); 688 DCHECK(GetTaskRunner()->BelongsToCurrentThread());
687 output_device_listener_.reset(); 689 output_device_listener_.reset();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 basic_input_streams_.erase(stream_it); 827 basic_input_streams_.erase(stream_it);
826 828
827 AudioManagerBase::ReleaseInputStream(stream); 829 AudioManagerBase::ReleaseInputStream(stream);
828 } 830 }
829 831
830 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { 832 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) {
831 return new AudioManagerMac(audio_log_factory); 833 return new AudioManagerMac(audio_log_factory);
832 } 834 }
833 835
834 } // namespace media 836 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/fake_audio_manager.cc ('k') | media/audio/pulse/audio_manager_pulse.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698