| 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 | |
| 682 AudioParameters params( | 677 AudioParameters params( |
| 683 AudioParameters::AUDIO_PCM_LOW_LATENCY, | 678 AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 684 channel_layout, | 679 channel_layout, |
| 685 hardware_channels, | |
| 686 input_channels, | 680 input_channels, |
| 687 hardware_sample_rate, | 681 hardware_sample_rate, |
| 688 16, | 682 16, |
| 689 buffer_size, | 683 buffer_size); |
| 690 AudioParameters::NO_EFFECTS); | 684 |
| 685 if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) |
| 686 params.SetDiscreteChannels(hardware_channels); |
| 691 | 687 |
| 692 return params; | 688 return params; |
| 693 } | 689 } |
| 694 | 690 |
| 695 void AudioManagerMac::CreateDeviceListener() { | 691 void AudioManagerMac::CreateDeviceListener() { |
| 696 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); | 692 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); |
| 697 | 693 |
| 698 // Get a baseline for the sample-rate and current device, | 694 // Get a baseline for the sample-rate and current device, |
| 699 // so we can intelligently handle device notifications only when necessary. | 695 // so we can intelligently handle device notifications only when necessary. |
| 700 current_sample_rate_ = HardwareSampleRate(); | 696 current_sample_rate_ = HardwareSampleRate(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 } | 741 } |
| 746 | 742 |
| 747 return buffer_size; | 743 return buffer_size; |
| 748 } | 744 } |
| 749 | 745 |
| 750 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { | 746 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { |
| 751 return new AudioManagerMac(audio_log_factory); | 747 return new AudioManagerMac(audio_log_factory); |
| 752 } | 748 } |
| 753 | 749 |
| 754 } // namespace media | 750 } // namespace media |
| OLD | NEW |