| 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 19 matching lines...) Expand all Loading... |
| 30 frame_type_(kVideoFrameDelta), | 30 frame_type_(kVideoFrameDelta), |
| 31 packets_(), | 31 packets_(), |
| 32 empty_seq_num_low_(-1), | 32 empty_seq_num_low_(-1), |
| 33 empty_seq_num_high_(-1), | 33 empty_seq_num_high_(-1), |
| 34 first_packet_seq_num_(-1), | 34 first_packet_seq_num_(-1), |
| 35 last_packet_seq_num_(-1) {} | 35 last_packet_seq_num_(-1) {} |
| 36 | 36 |
| 37 void VCMSessionInfo::UpdateDataPointers(const uint8_t* old_base_ptr, | 37 void VCMSessionInfo::UpdateDataPointers(const uint8_t* old_base_ptr, |
| 38 const uint8_t* new_base_ptr) { | 38 const uint8_t* new_base_ptr) { |
| 39 for (PacketIterator it = packets_.begin(); it != packets_.end(); ++it) | 39 for (PacketIterator it = packets_.begin(); it != packets_.end(); ++it) |
| 40 if ((*it).dataPtr != NULL) { | 40 if ((*it).dataPtr != nullptr) { |
| 41 assert(old_base_ptr != NULL && new_base_ptr != NULL); | 41 assert(old_base_ptr != nullptr && new_base_ptr != nullptr); |
| 42 (*it).dataPtr = new_base_ptr + ((*it).dataPtr - old_base_ptr); | 42 (*it).dataPtr = new_base_ptr + ((*it).dataPtr - old_base_ptr); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 int VCMSessionInfo::LowSequenceNumber() const { | 46 int VCMSessionInfo::LowSequenceNumber() const { |
| 47 if (packets_.empty()) | 47 if (packets_.empty()) |
| 48 return empty_seq_num_low_; | 48 return empty_seq_num_low_; |
| 49 return packets_.front().seqNum; | 49 return packets_.front().seqNum; |
| 50 } | 50 } |
| 51 | 51 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 void VCMSessionInfo::ShiftSubsequentPackets(PacketIterator it, | 236 void VCMSessionInfo::ShiftSubsequentPackets(PacketIterator it, |
| 237 int steps_to_shift) { | 237 int steps_to_shift) { |
| 238 ++it; | 238 ++it; |
| 239 if (it == packets_.end()) | 239 if (it == packets_.end()) |
| 240 return; | 240 return; |
| 241 uint8_t* first_packet_ptr = const_cast<uint8_t*>((*it).dataPtr); | 241 uint8_t* first_packet_ptr = const_cast<uint8_t*>((*it).dataPtr); |
| 242 int shift_length = 0; | 242 int shift_length = 0; |
| 243 // Calculate the total move length and move the data pointers in advance. | 243 // Calculate the total move length and move the data pointers in advance. |
| 244 for (; it != packets_.end(); ++it) { | 244 for (; it != packets_.end(); ++it) { |
| 245 shift_length += (*it).sizeBytes; | 245 shift_length += (*it).sizeBytes; |
| 246 if ((*it).dataPtr != NULL) | 246 if ((*it).dataPtr != nullptr) |
| 247 (*it).dataPtr += steps_to_shift; | 247 (*it).dataPtr += steps_to_shift; |
| 248 } | 248 } |
| 249 memmove(first_packet_ptr + steps_to_shift, first_packet_ptr, shift_length); | 249 memmove(first_packet_ptr + steps_to_shift, first_packet_ptr, shift_length); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void VCMSessionInfo::UpdateCompleteSession() { | 252 void VCMSessionInfo::UpdateCompleteSession() { |
| 253 if (HaveFirstPacket() && HaveLastPacket()) { | 253 if (HaveFirstPacket() && HaveLastPacket()) { |
| 254 // Do we have all the packets in this session? | 254 // Do we have all the packets in this session? |
| 255 bool complete_session = true; | 255 bool complete_session = true; |
| 256 PacketIterator it = packets_.begin(); | 256 PacketIterator it = packets_.begin(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 PacketIterator end) { | 325 PacketIterator end) { |
| 326 size_t bytes_to_delete = 0; // The number of bytes to delete. | 326 size_t bytes_to_delete = 0; // The number of bytes to delete. |
| 327 PacketIterator packet_after_end = end; | 327 PacketIterator packet_after_end = end; |
| 328 ++packet_after_end; | 328 ++packet_after_end; |
| 329 | 329 |
| 330 // Get the number of bytes to delete. | 330 // Get the number of bytes to delete. |
| 331 // Clear the size of these packets. | 331 // Clear the size of these packets. |
| 332 for (PacketIterator it = start; it != packet_after_end; ++it) { | 332 for (PacketIterator it = start; it != packet_after_end; ++it) { |
| 333 bytes_to_delete += (*it).sizeBytes; | 333 bytes_to_delete += (*it).sizeBytes; |
| 334 (*it).sizeBytes = 0; | 334 (*it).sizeBytes = 0; |
| 335 (*it).dataPtr = NULL; | 335 (*it).dataPtr = nullptr; |
| 336 } | 336 } |
| 337 if (bytes_to_delete > 0) | 337 if (bytes_to_delete > 0) |
| 338 ShiftSubsequentPackets(end, -static_cast<int>(bytes_to_delete)); | 338 ShiftSubsequentPackets(end, -static_cast<int>(bytes_to_delete)); |
| 339 return bytes_to_delete; | 339 return bytes_to_delete; |
| 340 } | 340 } |
| 341 | 341 |
| 342 VCMSessionInfo::PacketIterator VCMSessionInfo::FindNextPartitionBeginning( | 342 VCMSessionInfo::PacketIterator VCMSessionInfo::FindNextPartitionBeginning( |
| 343 PacketIterator it) const { | 343 PacketIterator it) const { |
| 344 while (it != packets_.end()) { | 344 while (it != packets_.end()) { |
| 345 if ((*it).video_header.codecHeader.VP8.beginningOfPartition) { | 345 if ((*it).video_header.codecHeader.VP8.beginningOfPartition) { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 if (empty_seq_num_high_ == -1) | 518 if (empty_seq_num_high_ == -1) |
| 519 empty_seq_num_high_ = seq_num; | 519 empty_seq_num_high_ = seq_num; |
| 520 else | 520 else |
| 521 empty_seq_num_high_ = LatestSequenceNumber(seq_num, empty_seq_num_high_); | 521 empty_seq_num_high_ = LatestSequenceNumber(seq_num, empty_seq_num_high_); |
| 522 if (empty_seq_num_low_ == -1 || | 522 if (empty_seq_num_low_ == -1 || |
| 523 IsNewerSequenceNumber(empty_seq_num_low_, seq_num)) | 523 IsNewerSequenceNumber(empty_seq_num_low_, seq_num)) |
| 524 empty_seq_num_low_ = seq_num; | 524 empty_seq_num_low_ = seq_num; |
| 525 } | 525 } |
| 526 | 526 |
| 527 } // namespace webrtc | 527 } // namespace webrtc |
| OLD | NEW |