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 | 667 |
668 if (input_channels > 0) { | 668 if (input_channels > 0) { |
669 // TODO(xians): given the limitations of the AudioOutputStream | 669 // TODO(xians): given the limitations of the AudioOutputStream |
670 // back-ends used with synchronized I/O, we hard-code to stereo. | 670 // back-ends used with synchronized I/O, we hard-code to stereo. |
671 // Specifically, this is a limitation of AudioSynchronizedStream which | 671 // Specifically, this is a limitation of AudioSynchronizedStream which |
672 // can be removed as part of the work to consolidate these back-ends. | 672 // can be removed as part of the work to consolidate these back-ends. |
673 channel_layout = CHANNEL_LAYOUT_STEREO; | 673 channel_layout = CHANNEL_LAYOUT_STEREO; |
674 } | 674 } |
675 } | 675 } |
676 | 676 |
| 677 if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) |
| 678 channel_layout = CHANNEL_LAYOUT_DISCRETE; |
| 679 else |
| 680 hardware_channels = ChannelLayoutToChannelCount(channel_layout); |
| 681 |
677 AudioParameters params( | 682 AudioParameters params( |
678 AudioParameters::AUDIO_PCM_LOW_LATENCY, | 683 AudioParameters::AUDIO_PCM_LOW_LATENCY, |
679 channel_layout, | 684 channel_layout, |
| 685 hardware_channels, |
680 input_channels, | 686 input_channels, |
681 hardware_sample_rate, | 687 hardware_sample_rate, |
682 16, | 688 16, |
683 buffer_size); | 689 buffer_size, |
684 | 690 AudioParameters::NO_EFFECTS); |
685 if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) | |
686 params.SetDiscreteChannels(hardware_channels); | |
687 | 691 |
688 return params; | 692 return params; |
689 } | 693 } |
690 | 694 |
691 void AudioManagerMac::CreateDeviceListener() { | 695 void AudioManagerMac::CreateDeviceListener() { |
692 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); | 696 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); |
693 | 697 |
694 // Get a baseline for the sample-rate and current device, | 698 // Get a baseline for the sample-rate and current device, |
695 // so we can intelligently handle device notifications only when necessary. | 699 // so we can intelligently handle device notifications only when necessary. |
696 current_sample_rate_ = HardwareSampleRate(); | 700 current_sample_rate_ = HardwareSampleRate(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 } | 745 } |
742 | 746 |
743 return buffer_size; | 747 return buffer_size; |
744 } | 748 } |
745 | 749 |
746 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { | 750 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { |
747 return new AudioManagerMac(audio_log_factory); | 751 return new AudioManagerMac(audio_log_factory); |
748 } | 752 } |
749 | 753 |
750 } // namespace media | 754 } // namespace media |
OLD | NEW |