| 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 27 matching lines...) Expand all Loading... |
| 38 Free(); | 38 Free(); |
| 39 } | 39 } |
| 40 RTC_DCHECK(!store_); | 40 RTC_DCHECK(!store_); |
| 41 Allocate(number_to_store); | 41 Allocate(number_to_store); |
| 42 } else { | 42 } else { |
| 43 Free(); | 43 Free(); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 void RtpPacketHistory::Allocate(size_t number_to_store) { | 47 void RtpPacketHistory::Allocate(size_t number_to_store) { |
| 48 RTC_DCHECK_GT(number_to_store, 0u); | 48 RTC_DCHECK_GT(number_to_store, 0); |
| 49 RTC_DCHECK_LE(number_to_store, kMaxCapacity); | 49 RTC_DCHECK_LE(number_to_store, kMaxCapacity); |
| 50 store_ = true; | 50 store_ = true; |
| 51 stored_packets_.resize(number_to_store); | 51 stored_packets_.resize(number_to_store); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void RtpPacketHistory::Free() { | 54 void RtpPacketHistory::Free() { |
| 55 if (!store_) { | 55 if (!store_) { |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 | 58 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 (stored_size > size) ? (stored_size - size) : (size - stored_size); | 212 (stored_size > size) ? (stored_size - size) : (size - stored_size); |
| 213 if (diff < min_diff) { | 213 if (diff < min_diff) { |
| 214 min_diff = diff; | 214 min_diff = diff; |
| 215 best_index = static_cast<int>(i); | 215 best_index = static_cast<int>(i); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 return best_index; | 218 return best_index; |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace webrtc | 221 } // namespace webrtc |
| OLD | NEW |