OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "webrtc/typedefs.h" | 21 #include "webrtc/typedefs.h" |
22 | 22 |
23 namespace webrtc { | 23 namespace webrtc { |
24 | 24 |
25 // All methods return 0 on success and -1 on failure. | 25 // All methods return 0 on success and -1 on failure. |
26 class Resampler | 26 class Resampler |
27 { | 27 { |
28 | 28 |
29 public: | 29 public: |
30 Resampler(); | 30 Resampler(); |
31 Resampler(int inFreq, int outFreq, int num_channels); | 31 Resampler(int inFreq, int outFreq, size_t num_channels); |
32 ~Resampler(); | 32 ~Resampler(); |
33 | 33 |
34 // Reset all states | 34 // Reset all states |
35 int Reset(int inFreq, int outFreq, int num_channels); | 35 int Reset(int inFreq, int outFreq, size_t num_channels); |
36 | 36 |
37 // Reset all states if any parameter has changed | 37 // Reset all states if any parameter has changed |
38 int ResetIfNeeded(int inFreq, int outFreq, int num_channels); | 38 int ResetIfNeeded(int inFreq, int outFreq, size_t num_channels); |
39 | 39 |
40 // Resample samplesIn to samplesOut. | 40 // Resample samplesIn to samplesOut. |
41 int Push(const int16_t* samplesIn, size_t lengthIn, int16_t* samplesOut, | 41 int Push(const int16_t* samplesIn, size_t lengthIn, int16_t* samplesOut, |
42 size_t maxLen, size_t &outLen); | 42 size_t maxLen, size_t &outLen); |
43 | 43 |
44 private: | 44 private: |
45 enum ResamplerMode | 45 enum ResamplerMode |
46 { | 46 { |
47 kResamplerMode1To1, | 47 kResamplerMode1To1, |
48 kResamplerMode1To2, | 48 kResamplerMode1To2, |
(...skipping 27 matching lines...) Expand all Loading... |
76 int16_t* in_buffer_; | 76 int16_t* in_buffer_; |
77 int16_t* out_buffer_; | 77 int16_t* out_buffer_; |
78 size_t in_buffer_size_; | 78 size_t in_buffer_size_; |
79 size_t out_buffer_size_; | 79 size_t out_buffer_size_; |
80 size_t in_buffer_size_max_; | 80 size_t in_buffer_size_max_; |
81 size_t out_buffer_size_max_; | 81 size_t out_buffer_size_max_; |
82 | 82 |
83 int my_in_frequency_khz_; | 83 int my_in_frequency_khz_; |
84 int my_out_frequency_khz_; | 84 int my_out_frequency_khz_; |
85 ResamplerMode my_mode_; | 85 ResamplerMode my_mode_; |
86 int num_channels_; | 86 size_t num_channels_; |
87 | 87 |
88 // Extra instance for stereo | 88 // Extra instance for stereo |
89 Resampler* slave_left_; | 89 Resampler* slave_left_; |
90 Resampler* slave_right_; | 90 Resampler* slave_right_; |
91 }; | 91 }; |
92 | 92 |
93 } // namespace webrtc | 93 } // namespace webrtc |
94 | 94 |
95 #endif // WEBRTC_RESAMPLER_RESAMPLER_H_ | 95 #endif // WEBRTC_RESAMPLER_RESAMPLER_H_ |
OLD | NEW |