OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 sequence_buffer_[i].used = false; | 141 sequence_buffer_[i].used = false; |
142 } | 142 } |
143 | 143 |
144 first_packet_received_ = false; | 144 first_packet_received_ = false; |
145 is_cleared_to_first_seq_num_ = false; | 145 is_cleared_to_first_seq_num_ = false; |
146 } | 146 } |
147 | 147 |
148 bool PacketBuffer::ExpandBufferSize() { | 148 bool PacketBuffer::ExpandBufferSize() { |
149 if (size_ == max_size_) { | 149 if (size_ == max_size_) { |
150 LOG(LS_WARNING) << "PacketBuffer is already at max size (" << max_size_ | 150 LOG(LS_WARNING) << "PacketBuffer is already at max size (" << max_size_ |
151 << "), failed to increase size."; | 151 << "), failed to increase size. Clearing PacketBuffer."; |
| 152 Clear(); |
152 return false; | 153 return false; |
153 } | 154 } |
154 | 155 |
155 size_t new_size = std::min(max_size_, 2 * size_); | 156 size_t new_size = std::min(max_size_, 2 * size_); |
156 std::vector<VCMPacket> new_data_buffer(new_size); | 157 std::vector<VCMPacket> new_data_buffer(new_size); |
157 std::vector<ContinuityInfo> new_sequence_buffer(new_size); | 158 std::vector<ContinuityInfo> new_sequence_buffer(new_size); |
158 for (size_t i = 0; i < size_; ++i) { | 159 for (size_t i = 0; i < size_; ++i) { |
159 if (sequence_buffer_[i].used) { | 160 if (sequence_buffer_[i].used) { |
160 size_t index = sequence_buffer_[i].seq_num % new_size; | 161 size_t index = sequence_buffer_[i].seq_num % new_size; |
161 new_sequence_buffer[index] = sequence_buffer_[i]; | 162 new_sequence_buffer[index] = sequence_buffer_[i]; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 int PacketBuffer::Release() const { | 312 int PacketBuffer::Release() const { |
312 int count = rtc::AtomicOps::Decrement(&ref_count_); | 313 int count = rtc::AtomicOps::Decrement(&ref_count_); |
313 if (!count) { | 314 if (!count) { |
314 delete this; | 315 delete this; |
315 } | 316 } |
316 return count; | 317 return count; |
317 } | 318 } |
318 | 319 |
319 } // namespace video_coding | 320 } // namespace video_coding |
320 } // namespace webrtc | 321 } // namespace webrtc |
OLD | NEW |