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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 int Resampler::Reset(int inFreq, int outFreq, size_t num_channels) | 94 int Resampler::Reset(int inFreq, int outFreq, size_t num_channels) |
95 { | 95 { |
96 if (num_channels != 1 && num_channels != 2) { | 96 if (num_channels != 1 && num_channels != 2) { |
97 return -1; | 97 return -1; |
98 } | 98 } |
99 num_channels_ = num_channels; | 99 num_channels_ = num_channels; |
100 | 100 |
101 if (state1_) | 101 if (state1_) |
102 { | 102 { |
103 free(state1_); | 103 free(state1_); |
104 state1_ = NULL; | 104 state1_ = nullptr; |
105 } | 105 } |
106 if (state2_) | 106 if (state2_) |
107 { | 107 { |
108 free(state2_); | 108 free(state2_); |
109 state2_ = NULL; | 109 state2_ = nullptr; |
110 } | 110 } |
111 if (state3_) | 111 if (state3_) |
112 { | 112 { |
113 free(state3_); | 113 free(state3_); |
114 state3_ = NULL; | 114 state3_ = nullptr; |
115 } | 115 } |
116 if (in_buffer_) | 116 if (in_buffer_) |
117 { | 117 { |
118 free(in_buffer_); | 118 free(in_buffer_); |
119 in_buffer_ = NULL; | 119 in_buffer_ = nullptr; |
120 } | 120 } |
121 if (out_buffer_) | 121 if (out_buffer_) |
122 { | 122 { |
123 free(out_buffer_); | 123 free(out_buffer_); |
124 out_buffer_ = NULL; | 124 out_buffer_ = nullptr; |
125 } | 125 } |
126 if (slave_left_) | 126 if (slave_left_) |
127 { | 127 { |
128 delete slave_left_; | 128 delete slave_left_; |
129 slave_left_ = NULL; | 129 slave_left_ = nullptr; |
130 } | 130 } |
131 if (slave_right_) | 131 if (slave_right_) |
132 { | 132 { |
133 delete slave_right_; | 133 delete slave_right_; |
134 slave_right_ = NULL; | 134 slave_right_ = nullptr; |
135 } | 135 } |
136 | 136 |
137 in_buffer_size_ = 0; | 137 in_buffer_size_ = 0; |
138 out_buffer_size_ = 0; | 138 out_buffer_size_ = 0; |
139 in_buffer_size_max_ = 0; | 139 in_buffer_size_max_ = 0; |
140 out_buffer_size_max_ = 0; | 140 out_buffer_size_max_ = 0; |
141 | 141 |
142 // Start with a math exercise, Euclid's algorithm to find the gcd: | 142 // Start with a math exercise, Euclid's algorithm to find the gcd: |
143 int a = inFreq; | 143 int a = inFreq; |
144 int b = outFreq; | 144 int b = outFreq; |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 outLen = (lengthIn * 8) / 11; | 950 outLen = (lengthIn * 8) / 11; |
951 free(tmp_mem); | 951 free(tmp_mem); |
952 return 0; | 952 return 0; |
953 break; | 953 break; |
954 | 954 |
955 } | 955 } |
956 return 0; | 956 return 0; |
957 } | 957 } |
958 | 958 |
959 } // namespace webrtc | 959 } // namespace webrtc |
OLD | NEW |