OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/copresence/mediums/audio/audio_recorder.h" | 5 #include "components/copresence/mediums/audio/audio_recorder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/aligned_memory.h" | 8 #include "base/memory/aligned_memory.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "components/copresence/public/copresence_constants.h" | 10 #include "components/copresence/public/copresence_constants.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 void CreateRecorder(size_t channels, | 92 void CreateRecorder(size_t channels, |
93 size_t sample_rate, | 93 size_t sample_rate, |
94 size_t bits_per_sample, | 94 size_t bits_per_sample, |
95 size_t samples) { | 95 size_t samples) { |
96 DeleteRecorder(); | 96 DeleteRecorder(); |
97 params_.Reset(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 97 params_.Reset(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
98 kDefaultChannelLayout, | 98 kDefaultChannelLayout, |
99 channels, | 99 channels, |
| 100 2, |
100 sample_rate, | 101 sample_rate, |
101 bits_per_sample, | 102 bits_per_sample, |
102 4096); | 103 4096); |
103 | 104 |
104 channel_data_.clear(); | 105 channel_data_.clear(); |
105 channel_data_.push_back(GenerateSamples(0x1337, samples)); | 106 channel_data_.push_back(GenerateSamples(0x1337, samples)); |
106 channel_data_.push_back(GenerateSamples(0x7331, samples)); | 107 channel_data_.push_back(GenerateSamples(0x7331, samples)); |
107 | 108 |
108 total_samples_ = samples; | 109 total_samples_ = samples; |
109 | 110 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 kDefaultChannels, kDefaultSampleRate, kDefaultBitsPerSample, kNumSamples); | 244 kDefaultChannels, kDefaultSampleRate, kDefaultBitsPerSample, kNumSamples); |
244 | 245 |
245 RecordAndVerifySamples(); | 246 RecordAndVerifySamples(); |
246 | 247 |
247 DeleteRecorder(); | 248 DeleteRecorder(); |
248 } | 249 } |
249 | 250 |
250 // TODO(rkc): Add tests with recording different sample rates. | 251 // TODO(rkc): Add tests with recording different sample rates. |
251 | 252 |
252 } // namespace copresence | 253 } // namespace copresence |
OLD | NEW |