| 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 26 matching lines...) Expand all Loading... |
| 37 history_.erase(history_.begin()); | 37 history_.erase(history_.begin()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 // Add new. | 40 // Add new. |
| 41 int64_t unwrapped_seq_num = seq_num_unwrapper_.Unwrap(sequence_number); | 41 int64_t unwrapped_seq_num = seq_num_unwrapper_.Unwrap(sequence_number); |
| 42 int64_t creation_time_ms = now_ms; | 42 int64_t creation_time_ms = now_ms; |
| 43 constexpr int64_t kNoArrivalTimeMs = -1; // Arrival time is ignored. | 43 constexpr int64_t kNoArrivalTimeMs = -1; // Arrival time is ignored. |
| 44 constexpr int64_t kNoSendTimeMs = -1; // Send time is set by OnSentPacket. | 44 constexpr int64_t kNoSendTimeMs = -1; // Send time is set by OnSentPacket. |
| 45 history_.insert(std::make_pair( | 45 history_.insert(std::make_pair( |
| 46 unwrapped_seq_num, | 46 unwrapped_seq_num, |
| 47 PacketInfo(creation_time_ms, kNoArrivalTimeMs, kNoSendTimeMs, | 47 PacketFeedback(creation_time_ms, kNoArrivalTimeMs, kNoSendTimeMs, |
| 48 sequence_number, payload_size, pacing_info))); | 48 sequence_number, payload_size, pacing_info))); |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool SendTimeHistory::OnSentPacket(uint16_t sequence_number, | 51 bool SendTimeHistory::OnSentPacket(uint16_t sequence_number, |
| 52 int64_t send_time_ms) { | 52 int64_t send_time_ms) { |
| 53 int64_t unwrapped_seq_num = seq_num_unwrapper_.Unwrap(sequence_number); | 53 int64_t unwrapped_seq_num = seq_num_unwrapper_.Unwrap(sequence_number); |
| 54 auto it = history_.find(unwrapped_seq_num); | 54 auto it = history_.find(unwrapped_seq_num); |
| 55 if (it == history_.end()) | 55 if (it == history_.end()) |
| 56 return false; | 56 return false; |
| 57 it->second.send_time_ms = send_time_ms; | 57 it->second.send_time_ms = send_time_ms; |
| 58 return true; | 58 return true; |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool SendTimeHistory::GetInfo(PacketInfo* packet_info, bool remove) { | 61 bool SendTimeHistory::GetFeedback(PacketFeedback* packet_feedback, |
| 62 RTC_DCHECK(packet_info); | 62 bool remove) { |
| 63 RTC_DCHECK(packet_feedback); |
| 63 int64_t unwrapped_seq_num = | 64 int64_t unwrapped_seq_num = |
| 64 seq_num_unwrapper_.Unwrap(packet_info->sequence_number); | 65 seq_num_unwrapper_.Unwrap(packet_feedback->sequence_number); |
| 65 auto it = history_.find(unwrapped_seq_num); | 66 auto it = history_.find(unwrapped_seq_num); |
| 66 if (it == history_.end()) | 67 if (it == history_.end()) |
| 67 return false; | 68 return false; |
| 68 | 69 |
| 69 // Save arrival_time not to overwrite it. | 70 // Save arrival_time not to overwrite it. |
| 70 int64_t arrival_time_ms = packet_info->arrival_time_ms; | 71 int64_t arrival_time_ms = packet_feedback->arrival_time_ms; |
| 71 *packet_info = it->second; | 72 *packet_feedback = it->second; |
| 72 packet_info->arrival_time_ms = arrival_time_ms; | 73 packet_feedback->arrival_time_ms = arrival_time_ms; |
| 73 | 74 |
| 74 if (remove) | 75 if (remove) |
| 75 history_.erase(it); | 76 history_.erase(it); |
| 76 return true; | 77 return true; |
| 77 } | 78 } |
| 78 | 79 |
| 79 } // namespace webrtc | 80 } // namespace webrtc |
| OLD | NEW |