| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 SendTimeHistory::~SendTimeHistory() { | 22 SendTimeHistory::~SendTimeHistory() { |
| 23 } | 23 } |
| 24 | 24 |
| 25 void SendTimeHistory::Clear() { | 25 void SendTimeHistory::Clear() { |
| 26 history_.clear(); | 26 history_.clear(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void SendTimeHistory::AddAndRemoveOld(uint16_t sequence_number, | 29 void SendTimeHistory::AddAndRemoveOld(uint16_t sequence_number, |
| 30 size_t length, | 30 size_t length, |
| 31 bool was_paced, |
| 31 int probe_cluster_id) { | 32 int probe_cluster_id) { |
| 32 EraseOld(); | 33 EraseOld(); |
| 33 | 34 |
| 34 if (history_.empty()) | 35 if (history_.empty()) |
| 35 oldest_sequence_number_ = sequence_number; | 36 oldest_sequence_number_ = sequence_number; |
| 36 | 37 |
| 37 history_.insert(std::pair<uint16_t, PacketInfo>( | 38 history_.insert(std::pair<uint16_t, PacketInfo>( |
| 38 sequence_number, PacketInfo(clock_->TimeInMilliseconds(), 0, -1, | 39 sequence_number, |
| 39 sequence_number, length, probe_cluster_id))); | 40 PacketInfo(clock_->TimeInMilliseconds(), 0, -1, sequence_number, length, |
| 41 was_paced, probe_cluster_id))); |
| 40 } | 42 } |
| 41 | 43 |
| 42 bool SendTimeHistory::OnSentPacket(uint16_t sequence_number, | 44 bool SendTimeHistory::OnSentPacket(uint16_t sequence_number, |
| 43 int64_t send_time_ms) { | 45 int64_t send_time_ms) { |
| 44 auto it = history_.find(sequence_number); | 46 auto it = history_.find(sequence_number); |
| 45 if (it == history_.end()) | 47 if (it == history_.end()) |
| 46 return false; | 48 return false; |
| 47 it->second.send_time_ms = send_time_ms; | 49 it->second.send_time_ms = send_time_ms; |
| 48 return true; | 50 return true; |
| 49 } | 51 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 packet->arrival_time_ms = receive_time; | 94 packet->arrival_time_ms = receive_time; |
| 93 if (remove) { | 95 if (remove) { |
| 94 history_.erase(it); | 96 history_.erase(it); |
| 95 if (packet->sequence_number == oldest_sequence_number_) | 97 if (packet->sequence_number == oldest_sequence_number_) |
| 96 UpdateOldestSequenceNumber(); | 98 UpdateOldestSequenceNumber(); |
| 97 } | 99 } |
| 98 return true; | 100 return true; |
| 99 } | 101 } |
| 100 | 102 |
| 101 } // namespace webrtc | 103 } // namespace webrtc |
| OLD | NEW |