OLD | NEW |
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 #include <CoreAudio/AudioHardware.h> | 7 #include <CoreAudio/AudioHardware.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 // work correctly. | 667 // work correctly. |
668 int output_channels = input_params.channels(); | 668 int output_channels = input_params.channels(); |
669 ChannelLayout channel_layout = input_params.channel_layout(); | 669 ChannelLayout channel_layout = input_params.channel_layout(); |
670 if (!has_valid_input_params || output_channels > hardware_channels) { | 670 if (!has_valid_input_params || output_channels > hardware_channels) { |
671 output_channels = hardware_channels; | 671 output_channels = hardware_channels; |
672 channel_layout = GuessChannelLayout(output_channels); | 672 channel_layout = GuessChannelLayout(output_channels); |
673 if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) | 673 if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) |
674 channel_layout = CHANNEL_LAYOUT_DISCRETE; | 674 channel_layout = CHANNEL_LAYOUT_DISCRETE; |
675 } | 675 } |
676 | 676 |
677 const int input_channels = | |
678 has_valid_input_params ? input_params.input_channels() : 0; | |
679 if (input_channels > 0) { | |
680 // TODO(xians): given the limitations of the AudioOutputStream | |
681 // back-ends used with synchronized I/O, we hard-code to stereo. | |
682 // Specifically, this is a limitation of AudioSynchronizedStream which | |
683 // can be removed as part of the work to consolidate these back-ends. | |
684 channel_layout = CHANNEL_LAYOUT_STEREO; | |
685 } | |
686 | |
687 return AudioParameters( | 677 return AudioParameters( |
688 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, output_channels, | 678 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, output_channels, |
689 input_channels, hardware_sample_rate, 16, buffer_size, | 679 hardware_sample_rate, 16, buffer_size, AudioParameters::NO_EFFECTS); |
690 AudioParameters::NO_EFFECTS); | |
691 } | 680 } |
692 | 681 |
693 void AudioManagerMac::InitializeOnAudioThread() { | 682 void AudioManagerMac::InitializeOnAudioThread() { |
694 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 683 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
695 power_observer_.reset(new AudioPowerObserver()); | 684 power_observer_.reset(new AudioPowerObserver()); |
696 } | 685 } |
697 | 686 |
698 void AudioManagerMac::ShutdownOnAudioThread() { | 687 void AudioManagerMac::ShutdownOnAudioThread() { |
699 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 688 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
700 output_device_listener_.reset(); | 689 output_device_listener_.reset(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 void AudioManagerMac::ReleaseInputStream(AudioInputStream* stream) { | 747 void AudioManagerMac::ReleaseInputStream(AudioInputStream* stream) { |
759 input_streams_.remove(stream); | 748 input_streams_.remove(stream); |
760 AudioManagerBase::ReleaseInputStream(stream); | 749 AudioManagerBase::ReleaseInputStream(stream); |
761 } | 750 } |
762 | 751 |
763 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { | 752 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { |
764 return new AudioManagerMac(audio_log_factory); | 753 return new AudioManagerMac(audio_log_factory); |
765 } | 754 } |
766 | 755 |
767 } // namespace media | 756 } // namespace media |
OLD | NEW |