Chromium Code Reviews| 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 |
| 11 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" | 11 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" |
| 12 | 12 |
| 13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
| 14 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 14 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 15 #include "webrtc/system_wrappers/include/clock.h" | 15 #include "webrtc/system_wrappers/include/clock.h" |
| 16 | 16 |
| 17 namespace webrtc { | 17 namespace webrtc { |
| 18 | 18 |
| 19 SendTimeHistory::SendTimeHistory(Clock* clock, int64_t packet_age_limit_ms) | 19 SendTimeHistory::SendTimeHistory(Clock* clock, int64_t packet_age_limit_ms) |
| 20 : clock_(clock), packet_age_limit_ms_(packet_age_limit_ms) {} | 20 : clock_(clock), packet_age_limit_ms_(packet_age_limit_ms) {} |
| 21 | 21 |
| 22 SendTimeHistory::~SendTimeHistory() {} | 22 SendTimeHistory::~SendTimeHistory() {} |
| 23 | 23 |
| 24 void SendTimeHistory::Clear() { | 24 void SendTimeHistory::Clear() { |
| 25 history_.clear(); | 25 history_.clear(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void SendTimeHistory::AddAndRemoveOld(uint16_t sequence_number, | 28 void SendTimeHistory::AddAndRemoveOld(uint16_t sequence_number, |
| 29 size_t payload_size, | 29 size_t payload_size, |
| 30 int probe_cluster_id) { | 30 const PacedPacketInfo& pacing_info) { |
| 31 int64_t now_ms = clock_->TimeInMilliseconds(); | 31 int64_t now_ms = clock_->TimeInMilliseconds(); |
| 32 // Remove old. | 32 // Remove old. |
| 33 while (!history_.empty() && | 33 while (!history_.empty() && |
| 34 now_ms - history_.begin()->second.creation_time_ms > | 34 now_ms - history_.begin()->second.creation_time_ms > |
| 35 packet_age_limit_ms_) { | 35 packet_age_limit_ms_) { |
| 36 // TODO(sprang): Warn if erasing (too many) old items? | 36 // TODO(sprang): Warn if erasing (too many) old items? |
| 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 PacketInfo(creation_time_ms, kNoArrivalTimeMs, kNoSendTimeMs, |
| 48 sequence_number, payload_size, probe_cluster_id))); | 48 sequence_number, payload_size, pacing_info))); |
|
nisse-webrtc
2017/02/22 12:37:47
And this is where pacing_info stops?
Where is the
philipel
2017/02/22 13:11:26
When we receive feedback the TransportFeedbackAdap
| |
| 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; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 70 int64_t arrival_time_ms = packet_info->arrival_time_ms; | 70 int64_t arrival_time_ms = packet_info->arrival_time_ms; |
| 71 *packet_info = it->second; | 71 *packet_info = it->second; |
| 72 packet_info->arrival_time_ms = arrival_time_ms; | 72 packet_info->arrival_time_ms = arrival_time_ms; |
| 73 | 73 |
| 74 if (remove) | 74 if (remove) |
| 75 history_.erase(it); | 75 history_.erase(it); |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace webrtc | 79 } // namespace webrtc |
| OLD | NEW |