Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: webrtc/modules/remote_bitrate_estimator/send_time_history.cc

Issue 2918323002: Add functionality which limits the number of bytes on the network. (Closed)
Patch Set: Comment addressed. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/include/send_time_history.h ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698