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 21 matching lines...) Expand all Loading... |
32 in_buffer_size_max_(0), | 32 in_buffer_size_max_(0), |
33 out_buffer_size_max_(0), | 33 out_buffer_size_max_(0), |
34 my_in_frequency_khz_(0), | 34 my_in_frequency_khz_(0), |
35 my_out_frequency_khz_(0), | 35 my_out_frequency_khz_(0), |
36 my_mode_(kResamplerMode1To1), | 36 my_mode_(kResamplerMode1To1), |
37 num_channels_(0), | 37 num_channels_(0), |
38 slave_left_(nullptr), | 38 slave_left_(nullptr), |
39 slave_right_(nullptr) { | 39 slave_right_(nullptr) { |
40 } | 40 } |
41 | 41 |
42 Resampler::Resampler(int inFreq, int outFreq, int num_channels) | 42 Resampler::Resampler(int inFreq, int outFreq, size_t num_channels) |
43 : Resampler() { | 43 : Resampler() { |
44 Reset(inFreq, outFreq, num_channels); | 44 Reset(inFreq, outFreq, num_channels); |
45 } | 45 } |
46 | 46 |
47 Resampler::~Resampler() | 47 Resampler::~Resampler() |
48 { | 48 { |
49 if (state1_) | 49 if (state1_) |
50 { | 50 { |
51 free(state1_); | 51 free(state1_); |
52 } | 52 } |
(...skipping 16 matching lines...) Expand all Loading... |
69 if (slave_left_) | 69 if (slave_left_) |
70 { | 70 { |
71 delete slave_left_; | 71 delete slave_left_; |
72 } | 72 } |
73 if (slave_right_) | 73 if (slave_right_) |
74 { | 74 { |
75 delete slave_right_; | 75 delete slave_right_; |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 int Resampler::ResetIfNeeded(int inFreq, int outFreq, int num_channels) | 79 int Resampler::ResetIfNeeded(int inFreq, int outFreq, size_t num_channels) |
80 { | 80 { |
81 int tmpInFreq_kHz = inFreq / 1000; | 81 int tmpInFreq_kHz = inFreq / 1000; |
82 int tmpOutFreq_kHz = outFreq / 1000; | 82 int tmpOutFreq_kHz = outFreq / 1000; |
83 | 83 |
84 if ((tmpInFreq_kHz != my_in_frequency_khz_) || (tmpOutFreq_kHz != my_out_fre
quency_khz_) | 84 if ((tmpInFreq_kHz != my_in_frequency_khz_) || (tmpOutFreq_kHz != my_out_fre
quency_khz_) |
85 || (num_channels != num_channels_)) | 85 || (num_channels != num_channels_)) |
86 { | 86 { |
87 return Reset(inFreq, outFreq, num_channels); | 87 return Reset(inFreq, outFreq, num_channels); |
88 } else | 88 } else |
89 { | 89 { |
90 return 0; | 90 return 0; |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 int Resampler::Reset(int inFreq, int outFreq, int 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_ = NULL; |
(...skipping 845 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 |