OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 capacity_link_.pop(); | 85 capacity_link_.pop(); |
86 } | 86 } |
87 while (!delay_link_.empty()) { | 87 while (!delay_link_.empty()) { |
88 delete *delay_link_.begin(); | 88 delete *delay_link_.begin(); |
89 delay_link_.erase(delay_link_.begin()); | 89 delay_link_.erase(delay_link_.begin()); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 void FakeNetworkPipe::SetReceiver(PacketReceiver* receiver) { | 93 void FakeNetworkPipe::SetReceiver(PacketReceiver* receiver) { |
94 RTC_CHECK(demuxer_); | 94 RTC_CHECK(demuxer_); |
| 95 // TODO(eladalon): !!! Lock? |
95 demuxer_->SetReceiver(receiver); | 96 demuxer_->SetReceiver(receiver); |
96 } | 97 } |
97 | 98 |
98 void FakeNetworkPipe::SetConfig(const FakeNetworkPipe::Config& config) { | 99 void FakeNetworkPipe::SetConfig(const FakeNetworkPipe::Config& config) { |
99 rtc::CritScope crit(&lock_); | 100 rtc::CritScope crit(&lock_); |
100 config_ = config; // Shallow copy of the struct. | 101 config_ = config; // Shallow copy of the struct. |
101 double prob_loss = config.loss_percent / 100.0; | 102 double prob_loss = config.loss_percent / 100.0; |
102 if (config_.avg_burst_loss_length == -1) { | 103 if (config_.avg_burst_loss_length == -1) { |
103 // Uniform loss | 104 // Uniform loss |
104 prob_loss_bursting_ = prob_loss; | 105 prob_loss_bursting_ = prob_loss; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 : time_now + kDefaultProcessIntervalMs; | 239 : time_now + kDefaultProcessIntervalMs; |
239 } | 240 } |
240 | 241 |
241 int64_t FakeNetworkPipe::TimeUntilNextProcess() const { | 242 int64_t FakeNetworkPipe::TimeUntilNextProcess() const { |
242 rtc::CritScope crit(&lock_); | 243 rtc::CritScope crit(&lock_); |
243 return std::max<int64_t>(next_process_time_ - clock_->TimeInMilliseconds(), | 244 return std::max<int64_t>(next_process_time_ - clock_->TimeInMilliseconds(), |
244 0); | 245 0); |
245 } | 246 } |
246 | 247 |
247 } // namespace webrtc | 248 } // namespace webrtc |
OLD | NEW |