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

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: dalecurtis comments. 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/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 params.set_channels_for_discrete(output_channels);
678 return params;
678 } 679 }
679 680
680 void AudioManagerMac::InitializeOnAudioThread() { 681 void AudioManagerMac::InitializeOnAudioThread() {
681 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); 682 DCHECK(GetTaskRunner()->BelongsToCurrentThread());
682 power_observer_.reset(new AudioPowerObserver()); 683 power_observer_.reset(new AudioPowerObserver());
683 } 684 }
684 685
685 void AudioManagerMac::ShutdownOnAudioThread() { 686 void AudioManagerMac::ShutdownOnAudioThread() {
686 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); 687 DCHECK(GetTaskRunner()->BelongsToCurrentThread());
687 output_device_listener_.reset(); 688 output_device_listener_.reset();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 basic_input_streams_.erase(stream_it); 826 basic_input_streams_.erase(stream_it);
826 827
827 AudioManagerBase::ReleaseInputStream(stream); 828 AudioManagerBase::ReleaseInputStream(stream);
828 } 829 }
829 830
830 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { 831 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) {
831 return new AudioManagerMac(audio_log_factory); 832 return new AudioManagerMac(audio_log_factory);
832 } 833 }
833 834
834 } // namespace media 835 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698