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

Unified Diff: webrtc/test/fake_network_pipe.cc

Issue 2997883002: Video/Screenshare loopback tool.
Patch Set: Rebase 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
« no previous file with comments | « webrtc/test/fake_network_pipe.h ('k') | webrtc/video/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/test/fake_network_pipe.cc
diff --git a/webrtc/test/fake_network_pipe.cc b/webrtc/test/fake_network_pipe.cc
index bb9d6b1322e5ecf495aca3b46ec25c098bed2d98..9d5c3222afdb1dfb9833de153f2006a3cea7bdc4 100644
--- a/webrtc/test/fake_network_pipe.cc
+++ b/webrtc/test/fake_network_pipe.cc
@@ -132,8 +132,14 @@ void FakeNetworkPipe::SendPacket(const uint8_t* data, size_t data_length) {
// Delay introduced by the link capacity.
int64_t capacity_delay_ms = 0;
- if (config_.link_capacity_kbps > 0)
- capacity_delay_ms = data_length / (config_.link_capacity_kbps / 8);
+ if (config_.link_capacity_kbps > 0) {
+ int offset_bytes = config_.link_capacity_kbps / 8 / 2;
+ capacity_delay_ms = (data_length + capacity_delay_error_ + offset_bytes) /
+ (config_.link_capacity_kbps / 8);
+ capacity_delay_error_ +=
+ data_length - capacity_delay_ms * (config_.link_capacity_kbps / 8);
+ // Print("Error: %ld", capacity_delay_error_);
+ }
int64_t network_start_time = time_now;
// Check if there already are packets on the link and change network start
« no previous file with comments | « webrtc/test/fake_network_pipe.h ('k') | webrtc/video/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698