| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 void VadCircularBuffer::Reset() { | 28 void VadCircularBuffer::Reset() { |
| 29 is_full_ = false; | 29 is_full_ = false; |
| 30 index_ = 0; | 30 index_ = 0; |
| 31 sum_ = 0; | 31 sum_ = 0; |
| 32 } | 32 } |
| 33 | 33 |
| 34 VadCircularBuffer* VadCircularBuffer::Create(int buffer_size) { | 34 VadCircularBuffer* VadCircularBuffer::Create(int buffer_size) { |
| 35 if (buffer_size <= 0) | 35 if (buffer_size <= 0) |
| 36 return NULL; | 36 return nullptr; |
| 37 return new VadCircularBuffer(buffer_size); | 37 return new VadCircularBuffer(buffer_size); |
| 38 } | 38 } |
| 39 | 39 |
| 40 double VadCircularBuffer::Oldest() const { | 40 double VadCircularBuffer::Oldest() const { |
| 41 if (!is_full_) | 41 if (!is_full_) |
| 42 return buffer_[0]; | 42 return buffer_[0]; |
| 43 else | 43 else |
| 44 return buffer_[index_]; | 44 return buffer_[index_]; |
| 45 } | 45 } |
| 46 | 46 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 for (; index > index_1; index--) { | 129 for (; index > index_1; index--) { |
| 130 if (Set(index, 0.0) < 0) | 130 if (Set(index, 0.0) < 0) |
| 131 return -1; | 131 return -1; |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 return 0; | 134 return 0; |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace webrtc | 137 } // namespace webrtc |
| OLD | NEW |