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, | |
101 sample_rate, | 100 sample_rate, |
102 bits_per_sample, | 101 bits_per_sample, |
103 4096); | 102 4096); |
104 | 103 |
105 channel_data_.clear(); | 104 channel_data_.clear(); |
106 channel_data_.push_back(GenerateSamples(0x1337, samples)); | 105 channel_data_.push_back(GenerateSamples(0x1337, samples)); |
107 channel_data_.push_back(GenerateSamples(0x7331, samples)); | 106 channel_data_.push_back(GenerateSamples(0x7331, samples)); |
108 | 107 |
109 total_samples_ = samples; | 108 total_samples_ = samples; |
110 | 109 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 kDefaultChannels, kDefaultSampleRate, kDefaultBitsPerSample, kNumSamples); | 243 kDefaultChannels, kDefaultSampleRate, kDefaultBitsPerSample, kNumSamples); |
245 | 244 |
246 RecordAndVerifySamples(); | 245 RecordAndVerifySamples(); |
247 | 246 |
248 DeleteRecorder(); | 247 DeleteRecorder(); |
249 } | 248 } |
250 | 249 |
251 // TODO(rkc): Add tests with recording different sample rates. | 250 // TODO(rkc): Add tests with recording different sample rates. |
252 | 251 |
253 } // namespace copresence | 252 } // namespace copresence |
OLD | NEW |