| 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 |
| 677 return AudioParameters( | 687 return AudioParameters( |
| 678 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, output_channels, | 688 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, output_channels, |
| 679 hardware_sample_rate, 16, buffer_size, AudioParameters::NO_EFFECTS); | 689 input_channels, hardware_sample_rate, 16, buffer_size, |
| 690 AudioParameters::NO_EFFECTS); |
| 680 } | 691 } |
| 681 | 692 |
| 682 void AudioManagerMac::InitializeOnAudioThread() { | 693 void AudioManagerMac::InitializeOnAudioThread() { |
| 683 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 694 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
| 684 power_observer_.reset(new AudioPowerObserver()); | 695 power_observer_.reset(new AudioPowerObserver()); |
| 685 } | 696 } |
| 686 | 697 |
| 687 void AudioManagerMac::ShutdownOnAudioThread() { | 698 void AudioManagerMac::ShutdownOnAudioThread() { |
| 688 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 699 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
| 689 output_device_listener_.reset(); | 700 output_device_listener_.reset(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 void AudioManagerMac::ReleaseInputStream(AudioInputStream* stream) { | 758 void AudioManagerMac::ReleaseInputStream(AudioInputStream* stream) { |
| 748 input_streams_.remove(stream); | 759 input_streams_.remove(stream); |
| 749 AudioManagerBase::ReleaseInputStream(stream); | 760 AudioManagerBase::ReleaseInputStream(stream); |
| 750 } | 761 } |
| 751 | 762 |
| 752 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { | 763 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { |
| 753 return new AudioManagerMac(audio_log_factory); | 764 return new AudioManagerMac(audio_log_factory); |
| 754 } | 765 } |
| 755 | 766 |
| 756 } // namespace media | 767 } // namespace media |
| OLD | NEW |