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

Unified Diff: webrtc/test/fake_network_pipe.cc

Issue 2703393002: Revert of Fixes a bug where a video stream can get stuck in the suspended state. (Closed)
Patch Set: Created 3 years, 10 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/encoder_settings.cc ('k') | no next file » | 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 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) {
« no previous file with comments | « webrtc/test/encoder_settings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698