| Index: webrtc/test/fake_network_pipe.cc
|
| diff --git a/webrtc/test/fake_network_pipe.cc b/webrtc/test/fake_network_pipe.cc
|
| index d594ab8104e3b6d7b0499b85415732544ae3b40d..0b3aa6ac71c2b3695789fb19713d32a0c14ecbc0 100644
|
| --- a/webrtc/test/fake_network_pipe.cc
|
| +++ b/webrtc/test/fake_network_pipe.cc
|
| @@ -33,34 +33,13 @@
|
| : clock_(clock),
|
| packet_receiver_(NULL),
|
| random_(seed),
|
| - config_(),
|
| + config_(config),
|
| dropped_packets_(0),
|
| sent_packets_(0),
|
| total_packet_delay_(0),
|
| bursting_(false),
|
| next_process_time_(clock_->TimeInMilliseconds()),
|
| last_log_time_(clock_->TimeInMilliseconds()) {
|
| - SetConfig(config);
|
| -}
|
| -
|
| -FakeNetworkPipe::~FakeNetworkPipe() {
|
| - while (!capacity_link_.empty()) {
|
| - delete capacity_link_.front();
|
| - capacity_link_.pop();
|
| - }
|
| - while (!delay_link_.empty()) {
|
| - delete *delay_link_.begin();
|
| - delay_link_.erase(delay_link_.begin());
|
| - }
|
| -}
|
| -
|
| -void FakeNetworkPipe::SetReceiver(PacketReceiver* receiver) {
|
| - packet_receiver_ = receiver;
|
| -}
|
| -
|
| -void FakeNetworkPipe::SetConfig(const FakeNetworkPipe::Config& config) {
|
| - rtc::CritScope crit(&lock_);
|
| - config_ = config; // Shallow copy of the struct.
|
| double prob_loss = config.loss_percent / 100.0;
|
| if (config_.avg_burst_loss_length == -1) {
|
| // Uniform loss
|
| @@ -79,6 +58,26 @@
|
| prob_loss_bursting_ = (1.0 - 1.0 / avg_burst_loss_length);
|
| prob_start_bursting_ = prob_loss / (1 - prob_loss) / avg_burst_loss_length;
|
| }
|
| +}
|
| +
|
| +FakeNetworkPipe::~FakeNetworkPipe() {
|
| + while (!capacity_link_.empty()) {
|
| + delete capacity_link_.front();
|
| + capacity_link_.pop();
|
| + }
|
| + while (!delay_link_.empty()) {
|
| + delete *delay_link_.begin();
|
| + delay_link_.erase(delay_link_.begin());
|
| + }
|
| +}
|
| +
|
| +void FakeNetworkPipe::SetReceiver(PacketReceiver* receiver) {
|
| + packet_receiver_ = receiver;
|
| +}
|
| +
|
| +void FakeNetworkPipe::SetConfig(const FakeNetworkPipe::Config& config) {
|
| + rtc::CritScope crit(&lock_);
|
| + config_ = config; // Shallow copy of the struct.
|
| }
|
|
|
| void FakeNetworkPipe::SendPacket(const uint8_t* data, size_t data_length) {
|
|
|