Index: webrtc/base/virtualsocketserver.h |
diff --git a/webrtc/base/virtualsocketserver.h b/webrtc/base/virtualsocketserver.h |
index cce0279d32e2a786970ab9370545ea46e9033e22..0d34ed70c95848341d3dcca5c024b7b93d07b2e7 100644 |
--- a/webrtc/base/virtualsocketserver.h |
+++ b/webrtc/base/virtualsocketserver.h |
@@ -112,6 +112,11 @@ class VirtualSocketServer : public SocketServer, public sigslot::has_slots<> { |
bool Wait(int cms, bool process_io) override; |
void WakeUp() override; |
+ void SetDelayOnSocketAddress(const rtc::SocketAddress& address, |
+ int delay_ms) { |
+ delays_[address] = delay_ms; |
+ } |
+ |
typedef std::pair<double, double> Point; |
typedef std::vector<Point> Function; |
@@ -194,8 +199,10 @@ class VirtualSocketServer : public SocketServer, public sigslot::has_slots<> { |
// Computes the number of milliseconds required to send a packet of this size. |
uint32_t SendDelay(uint32_t size); |
- // Returns a random transit delay chosen from the appropriate distribution. |
- uint32_t GetRandomTransitDelay(); |
+ // If the delay has been set for the address of the socket, returns the set |
+ // delay. Otherwise, returns a random transit delay chosen from the |
+ // appropriate distribution. |
+ uint32_t GetTransitDelay(Socket* socket); |
// Basic operations on functions. Those that return a function also take |
// ownership of the function given (and hence, may modify or delete it). |
@@ -260,7 +267,10 @@ class VirtualSocketServer : public SocketServer, public sigslot::has_slots<> { |
uint32_t delay_mean_; |
uint32_t delay_stddev_; |
uint32_t delay_samples_; |
- Function* delay_dist_; |
+ |
+ std::map<rtc::SocketAddress, int> delays_; |
+ std::unique_ptr<Function> delay_dist_; |
+ |
CriticalSection delay_crit_; |
double drop_prob_; |