OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
385 void JitterFilter::SetMaxJitter(int64_t max_jitter_ms) { | 385 void JitterFilter::SetMaxJitter(int64_t max_jitter_ms) { |
386 BWE_TEST_LOGGING_ENABLE(false); | 386 BWE_TEST_LOGGING_ENABLE(false); |
387 BWE_TEST_LOGGING_LOG1("Max Jitter", "%d ms", static_cast<int>(max_jitter_ms)); | 387 BWE_TEST_LOGGING_LOG1("Max Jitter", "%d ms", static_cast<int>(max_jitter_ms)); |
388 assert(max_jitter_ms >= 0); | 388 assert(max_jitter_ms >= 0); |
389 // Truncated gaussian, Max jitter = kN*sigma. | 389 // Truncated gaussian, Max jitter = kN*sigma. |
390 stddev_jitter_us_ = (max_jitter_ms * 1000 + kN / 2) / kN; | 390 stddev_jitter_us_ = (max_jitter_ms * 1000 + kN / 2) / kN; |
391 } | 391 } |
392 | 392 |
393 namespace { | 393 namespace { |
394 inline int64_t TruncatedNSigmaGaussian(test::Random* const random, | 394 inline int64_t TruncatedNSigmaGaussian(Random* const random, |
395 int64_t mean, | 395 int64_t mean, |
396 int64_t std_dev) { | 396 int64_t std_dev) { |
397 int64_t gaussian_random = random->Gaussian(mean, std_dev); | 397 int64_t gaussian_random = random->Gaussian(mean, std_dev); |
398 return std::max(std::min(gaussian_random, kN * std_dev), -kN * std_dev); | 398 return std::max(std::min(gaussian_random, kN * std_dev), -kN * std_dev); |
399 } | 399 } |
400 } | 400 } |
401 | 401 |
402 void JitterFilter::RunFor(int64_t /*time_ms*/, Packets* in_out) { | 402 void JitterFilter::RunFor(int64_t /*time_ms*/, Packets* in_out) { |
403 assert(in_out); | 403 assert(in_out); |
404 for (Packet* packet : *in_out) { | 404 for (Packet* packet : *in_out) { |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size, | 808 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size, |
809 uint32_t remaining_payload) { | 809 uint32_t remaining_payload) { |
810 uint32_t fragments = | 810 uint32_t fragments = |
811 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes; | 811 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes; |
812 uint32_t avg_size = (frame_size + fragments - 1) / fragments; | 812 uint32_t avg_size = (frame_size + fragments - 1) / fragments; |
813 return std::min(avg_size, remaining_payload); | 813 return std::min(avg_size, remaining_payload); |
814 } | 814 } |
815 } // namespace bwe | 815 } // namespace bwe |
816 } // namespace testing | 816 } // namespace testing |
817 } // namespace webrtc | 817 } // namespace webrtc |
OLD | NEW |