OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/fake_audio_manager.h" | 5 #include "media/audio/fake_audio_manager.h" |
6 | 6 |
7 namespace media { | 7 namespace media { |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 AudioParameters FakeAudioManager::GetPreferredOutputStreamParameters( | 52 AudioParameters FakeAudioManager::GetPreferredOutputStreamParameters( |
53 const std::string& output_device_id, | 53 const std::string& output_device_id, |
54 const AudioParameters& input_params) { | 54 const AudioParameters& input_params) { |
55 static const int kDefaultOutputBufferSize = 2048; | 55 static const int kDefaultOutputBufferSize = 2048; |
56 static const int kDefaultSampleRate = 48000; | 56 static const int kDefaultSampleRate = 48000; |
57 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; | 57 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; |
58 int sample_rate = kDefaultSampleRate; | 58 int sample_rate = kDefaultSampleRate; |
59 int buffer_size = kDefaultOutputBufferSize; | 59 int buffer_size = kDefaultOutputBufferSize; |
60 int bits_per_sample = 16; | 60 int bits_per_sample = 16; |
| 61 int input_channels = 0; |
61 if (input_params.IsValid()) { | 62 if (input_params.IsValid()) { |
62 sample_rate = input_params.sample_rate(); | 63 sample_rate = input_params.sample_rate(); |
63 bits_per_sample = input_params.bits_per_sample(); | 64 bits_per_sample = input_params.bits_per_sample(); |
64 channel_layout = input_params.channel_layout(); | 65 channel_layout = input_params.channel_layout(); |
| 66 input_channels = input_params.input_channels(); |
65 buffer_size = std::min(input_params.frames_per_buffer(), buffer_size); | 67 buffer_size = std::min(input_params.frames_per_buffer(), buffer_size); |
66 } | 68 } |
67 | 69 |
68 return AudioParameters( | 70 return AudioParameters( |
69 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, | 71 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, input_channels, |
70 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); | 72 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); |
71 } | 73 } |
72 | 74 |
73 AudioParameters FakeAudioManager::GetInputStreamParameters( | 75 AudioParameters FakeAudioManager::GetInputStreamParameters( |
74 const std::string& device_id) { | 76 const std::string& device_id) { |
75 return AudioParameters( | 77 return AudioParameters( |
76 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, | 78 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, |
77 kDefaultSampleRate, 16, kDefaultInputBufferSize); | 79 kDefaultSampleRate, 16, kDefaultInputBufferSize); |
78 } | 80 } |
79 | 81 |
80 } // namespace media | 82 } // namespace media |
OLD | NEW |