| 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, | |
| 32 int probe_cluster_id) { | 31 int probe_cluster_id) { |
| 33 EraseOld(); | 32 EraseOld(); |
| 34 | 33 |
| 35 if (history_.empty()) | 34 if (history_.empty()) |
| 36 oldest_sequence_number_ = sequence_number; | 35 oldest_sequence_number_ = sequence_number; |
| 37 | 36 |
| 38 history_.insert(std::pair<uint16_t, PacketInfo>( | 37 history_.insert(std::pair<uint16_t, PacketInfo>( |
| 39 sequence_number, | 38 sequence_number, PacketInfo(clock_->TimeInMilliseconds(), 0, -1, |
| 40 PacketInfo(clock_->TimeInMilliseconds(), 0, -1, sequence_number, length, | 39 sequence_number, length, probe_cluster_id))); |
| 41 was_paced, probe_cluster_id))); | |
| 42 } | 40 } |
| 43 | 41 |
| 44 bool SendTimeHistory::OnSentPacket(uint16_t sequence_number, | 42 bool SendTimeHistory::OnSentPacket(uint16_t sequence_number, |
| 45 int64_t send_time_ms) { | 43 int64_t send_time_ms) { |
| 46 auto it = history_.find(sequence_number); | 44 auto it = history_.find(sequence_number); |
| 47 if (it == history_.end()) | 45 if (it == history_.end()) |
| 48 return false; | 46 return false; |
| 49 it->second.send_time_ms = send_time_ms; | 47 it->second.send_time_ms = send_time_ms; |
| 50 return true; | 48 return true; |
| 51 } | 49 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 packet->arrival_time_ms = receive_time; | 92 packet->arrival_time_ms = receive_time; |
| 95 if (remove) { | 93 if (remove) { |
| 96 history_.erase(it); | 94 history_.erase(it); |
| 97 if (packet->sequence_number == oldest_sequence_number_) | 95 if (packet->sequence_number == oldest_sequence_number_) |
| 98 UpdateOldestSequenceNumber(); | 96 UpdateOldestSequenceNumber(); |
| 99 } | 97 } |
| 100 return true; | 98 return true; |
| 101 } | 99 } |
| 102 | 100 |
| 103 } // namespace webrtc | 101 } // namespace webrtc |
| OLD | NEW |