Index: webrtc/modules/remote_bitrate_estimator/send_time_history.cc |
diff --git a/webrtc/modules/remote_bitrate_estimator/send_time_history.cc b/webrtc/modules/remote_bitrate_estimator/send_time_history.cc |
index 734a9207130116d78faec56706ac08f42f23a248..4cc7a7c1c20c5a009757ae1f5e27742448b6e0f0 100644 |
--- a/webrtc/modules/remote_bitrate_estimator/send_time_history.cc |
+++ b/webrtc/modules/remote_bitrate_estimator/send_time_history.cc |
@@ -52,6 +52,9 @@ bool SendTimeHistory::GetFeedback(PacketFeedback* packet_feedback, |
RTC_DCHECK(packet_feedback); |
int64_t unwrapped_seq_num = |
seq_num_unwrapper_.Unwrap(packet_feedback->sequence_number); |
+ latest_acked_seq_num_.emplace( |
+ std::max(unwrapped_seq_num, latest_acked_seq_num_.value_or(0))); |
+ RTC_DCHECK_GE(*latest_acked_seq_num_, 0); |
auto it = history_.find(unwrapped_seq_num); |
if (it == history_.end()) |
return false; |
@@ -66,4 +69,21 @@ bool SendTimeHistory::GetFeedback(PacketFeedback* packet_feedback, |
return true; |
} |
+size_t SendTimeHistory::GetOutstandingBytes(uint16_t local_net_id, |
+ uint16_t remote_net_id) const { |
+ size_t outstanding_bytes = 0; |
+ auto unacked_it = history_.begin(); |
+ if (latest_acked_seq_num_) { |
+ unacked_it = history_.lower_bound(*latest_acked_seq_num_); |
+ } |
+ for (; unacked_it != history_.end(); ++unacked_it) { |
+ if (unacked_it->second.local_net_id == local_net_id && |
+ unacked_it->second.remote_net_id == remote_net_id && |
+ unacked_it->second.send_time_ms >= 0) { |
+ outstanding_bytes += unacked_it->second.payload_size; |
+ } |
+ } |
+ return outstanding_bytes; |
+} |
+ |
} // namespace webrtc |