OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.h" | 11 #include "webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.h" |
12 | 12 |
13 #include <memory> | 13 #include <memory> |
14 | 14 |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/rtc_base/checks.h" |
16 | 16 |
17 namespace webrtc { | 17 namespace webrtc { |
18 namespace test { | 18 namespace test { |
19 | 19 |
20 bool ResampleInputAudioFile::Read(size_t samples, | 20 bool ResampleInputAudioFile::Read(size_t samples, |
21 int output_rate_hz, | 21 int output_rate_hz, |
22 int16_t* destination) { | 22 int16_t* destination) { |
23 const size_t samples_to_read = samples * file_rate_hz_ / output_rate_hz; | 23 const size_t samples_to_read = samples * file_rate_hz_ / output_rate_hz; |
24 RTC_CHECK_EQ(samples_to_read * output_rate_hz, samples * file_rate_hz_) | 24 RTC_CHECK_EQ(samples_to_read * output_rate_hz, samples * file_rate_hz_) |
25 << "Frame size and sample rates don't add up to an integer."; | 25 << "Frame size and sample rates don't add up to an integer."; |
(...skipping 13 matching lines...) Expand all Loading... |
39 RTC_CHECK_GT(output_rate_hz_, 0) << "Output rate not set."; | 39 RTC_CHECK_GT(output_rate_hz_, 0) << "Output rate not set."; |
40 return Read(samples, output_rate_hz_, destination); | 40 return Read(samples, output_rate_hz_, destination); |
41 } | 41 } |
42 | 42 |
43 void ResampleInputAudioFile::set_output_rate_hz(int rate_hz) { | 43 void ResampleInputAudioFile::set_output_rate_hz(int rate_hz) { |
44 output_rate_hz_ = rate_hz; | 44 output_rate_hz_ = rate_hz; |
45 } | 45 } |
46 | 46 |
47 } // namespace test | 47 } // namespace test |
48 } // namespace webrtc | 48 } // namespace webrtc |
OLD | NEW |