| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 return (drop_this < loss_rate_ * RAND_MAX); | 269 return (drop_this < loss_rate_ * RAND_MAX); |
| 270 } | 270 } |
| 271 | 271 |
| 272 GilbertElliotLoss::GilbertElliotLoss(double prob_trans_11, double prob_trans_01) | 272 GilbertElliotLoss::GilbertElliotLoss(double prob_trans_11, double prob_trans_01) |
| 273 : prob_trans_11_(prob_trans_11), | 273 : prob_trans_11_(prob_trans_11), |
| 274 prob_trans_01_(prob_trans_01), | 274 prob_trans_01_(prob_trans_01), |
| 275 lost_last_(false), | 275 lost_last_(false), |
| 276 uniform_loss_model_(new UniformLoss(0)) { | 276 uniform_loss_model_(new UniformLoss(0)) { |
| 277 } | 277 } |
| 278 | 278 |
| 279 GilbertElliotLoss::~GilbertElliotLoss() {} |
| 280 |
| 279 bool GilbertElliotLoss::Lost() { | 281 bool GilbertElliotLoss::Lost() { |
| 280 // Simulate bursty channel (Gilbert model). | 282 // Simulate bursty channel (Gilbert model). |
| 281 // (1st order) Markov chain model with memory of the previous/last | 283 // (1st order) Markov chain model with memory of the previous/last |
| 282 // packet state (lost or received). | 284 // packet state (lost or received). |
| 283 if (lost_last_) { | 285 if (lost_last_) { |
| 284 // Previous packet was not received. | 286 // Previous packet was not received. |
| 285 uniform_loss_model_->set_loss_rate(prob_trans_11_); | 287 uniform_loss_model_->set_loss_rate(prob_trans_11_); |
| 286 return lost_last_ = uniform_loss_model_->Lost(); | 288 return lost_last_ = uniform_loss_model_->Lost(); |
| 287 } else { | 289 } else { |
| 288 uniform_loss_model_->set_loss_rate(prob_trans_01_); | 290 uniform_loss_model_->set_loss_rate(prob_trans_01_); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 } | 432 } |
| 431 } | 433 } |
| 432 Log() << "Average bit rate was " | 434 Log() << "Average bit rate was " |
| 433 << 8.0f * total_payload_size_bytes_ / FLAGS_runtime_ms | 435 << 8.0f * total_payload_size_bytes_ / FLAGS_runtime_ms |
| 434 << " kbps" | 436 << " kbps" |
| 435 << std::endl; | 437 << std::endl; |
| 436 } | 438 } |
| 437 | 439 |
| 438 } // namespace test | 440 } // namespace test |
| 439 } // namespace webrtc | 441 } // namespace webrtc |
| OLD | NEW |