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; | |
62 if (input_params.IsValid()) { | 61 if (input_params.IsValid()) { |
63 sample_rate = input_params.sample_rate(); | 62 sample_rate = input_params.sample_rate(); |
64 bits_per_sample = input_params.bits_per_sample(); | 63 bits_per_sample = input_params.bits_per_sample(); |
65 channel_layout = input_params.channel_layout(); | 64 channel_layout = input_params.channel_layout(); |
66 input_channels = input_params.input_channels(); | |
67 buffer_size = std::min(input_params.frames_per_buffer(), buffer_size); | 65 buffer_size = std::min(input_params.frames_per_buffer(), buffer_size); |
68 } | 66 } |
69 | 67 |
70 return AudioParameters( | 68 return AudioParameters( |
71 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, input_channels, | 69 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, |
72 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); | 70 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); |
73 } | 71 } |
74 | 72 |
75 AudioParameters FakeAudioManager::GetInputStreamParameters( | 73 AudioParameters FakeAudioManager::GetInputStreamParameters( |
76 const std::string& device_id) { | 74 const std::string& device_id) { |
77 return AudioParameters( | 75 return AudioParameters( |
78 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, | 76 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, |
79 kDefaultSampleRate, 16, kDefaultInputBufferSize); | 77 kDefaultSampleRate, 16, kDefaultInputBufferSize); |
80 } | 78 } |
81 | 79 |
82 } // namespace media | 80 } // namespace media |
OLD | NEW |