Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: webrtc/common_audio/resampler/include/resampler.h

Issue 1231713002: Update audio code to use size_t more correctly, webrtc/common_audio/resampler/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Review comments Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 11
12 /* 12 /*
13 * A wrapper for resampling a numerous amount of sampling combinations. 13 * A wrapper for resampling a numerous amount of sampling combinations.
14 */ 14 */
15 15
16 #ifndef WEBRTC_RESAMPLER_RESAMPLER_H_ 16 #ifndef WEBRTC_RESAMPLER_RESAMPLER_H_
17 #define WEBRTC_RESAMPLER_RESAMPLER_H_ 17 #define WEBRTC_RESAMPLER_RESAMPLER_H_
18 18
19 #include <stddef.h>
20
19 #include "webrtc/typedefs.h" 21 #include "webrtc/typedefs.h"
20 22
21 namespace webrtc { 23 namespace webrtc {
22 24
23 // All methods return 0 on success and -1 on failure. 25 // All methods return 0 on success and -1 on failure.
24 class Resampler 26 class Resampler
25 { 27 {
26 28
27 public: 29 public:
28 Resampler(); 30 Resampler();
29 Resampler(int inFreq, int outFreq, int num_channels); 31 Resampler(int inFreq, int outFreq, int num_channels);
30 ~Resampler(); 32 ~Resampler();
31 33
32 // Reset all states 34 // Reset all states
33 int Reset(int inFreq, int outFreq, int num_channels); 35 int Reset(int inFreq, int outFreq, int num_channels);
34 36
35 // Reset all states if any parameter has changed 37 // Reset all states if any parameter has changed
36 int ResetIfNeeded(int inFreq, int outFreq, int num_channels); 38 int ResetIfNeeded(int inFreq, int outFreq, int num_channels);
37 39
38 // Resample samplesIn to samplesOut. 40 // Resample samplesIn to samplesOut.
39 int Push(const int16_t* samplesIn, int lengthIn, int16_t* samplesOut, 41 int Push(const int16_t* samplesIn, size_t lengthIn, int16_t* samplesOut,
40 int maxLen, int &outLen); 42 size_t maxLen, size_t &outLen);
41 43
42 private: 44 private:
43 enum ResamplerMode 45 enum ResamplerMode
44 { 46 {
45 kResamplerMode1To1, 47 kResamplerMode1To1,
46 kResamplerMode1To2, 48 kResamplerMode1To2,
47 kResamplerMode1To3, 49 kResamplerMode1To3,
48 kResamplerMode1To4, 50 kResamplerMode1To4,
49 kResamplerMode1To6, 51 kResamplerMode1To6,
50 kResamplerMode1To12, 52 kResamplerMode1To12,
(...skipping 15 matching lines...) Expand all
66 }; 68 };
67 69
68 // Generic pointers since we don't know what states we'll need 70 // Generic pointers since we don't know what states we'll need
69 void* state1_; 71 void* state1_;
70 void* state2_; 72 void* state2_;
71 void* state3_; 73 void* state3_;
72 74
73 // Storage if needed 75 // Storage if needed
74 int16_t* in_buffer_; 76 int16_t* in_buffer_;
75 int16_t* out_buffer_; 77 int16_t* out_buffer_;
76 int in_buffer_size_; 78 size_t in_buffer_size_;
77 int out_buffer_size_; 79 size_t out_buffer_size_;
78 int in_buffer_size_max_; 80 size_t in_buffer_size_max_;
79 int out_buffer_size_max_; 81 size_t out_buffer_size_max_;
80 82
81 int my_in_frequency_khz_; 83 int my_in_frequency_khz_;
82 int my_out_frequency_khz_; 84 int my_out_frequency_khz_;
83 ResamplerMode my_mode_; 85 ResamplerMode my_mode_;
84 int num_channels_; 86 int num_channels_;
85 87
86 // Extra instance for stereo 88 // Extra instance for stereo
87 Resampler* slave_left_; 89 Resampler* slave_left_;
88 Resampler* slave_right_; 90 Resampler* slave_right_;
89 }; 91 };
90 92
91 } // namespace webrtc 93 } // namespace webrtc
92 94
93 #endif // WEBRTC_RESAMPLER_RESAMPLER_H_ 95 #endif // WEBRTC_RESAMPLER_RESAMPLER_H_
OLDNEW
« no previous file with comments | « webrtc/common_audio/resampler/include/push_resampler.h ('k') | webrtc/common_audio/resampler/push_resampler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698