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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 void ChokeFilter::SetCapacity(uint32_t kbps) { | 424 void ChokeFilter::SetCapacity(uint32_t kbps) { |
425 BWE_TEST_LOGGING_ENABLE(false); | 425 BWE_TEST_LOGGING_ENABLE(false); |
426 BWE_TEST_LOGGING_LOG1("BitrateChoke", "%d kbps", kbps); | 426 BWE_TEST_LOGGING_LOG1("BitrateChoke", "%d kbps", kbps); |
427 kbps_ = kbps; | 427 kbps_ = kbps; |
428 } | 428 } |
429 | 429 |
430 void ChokeFilter::RunFor(int64_t /*time_ms*/, Packets* in_out) { | 430 void ChokeFilter::RunFor(int64_t /*time_ms*/, Packets* in_out) { |
431 assert(in_out); | 431 assert(in_out); |
432 for (PacketsIt it = in_out->begin(); it != in_out->end(); ) { | 432 for (PacketsIt it = in_out->begin(); it != in_out->end(); ) { |
433 int64_t earliest_send_time_us = | 433 int64_t earliest_send_time_us = |
434 last_send_time_us_ + | 434 std::max(last_send_time_us_, (*it)->send_time_us()); |
| 435 int64_t new_send_time_us = earliest_send_time_us + |
435 ((*it)->payload_size() * 8 * 1000 + kbps_ / 2) / kbps_; | 436 ((*it)->payload_size() * 8 * 1000 + kbps_ / 2) / kbps_; |
436 int64_t new_send_time_us = | |
437 std::max((*it)->send_time_us(), earliest_send_time_us); | |
438 if (delay_cap_helper_->ShouldSendPacket(new_send_time_us, | 437 if (delay_cap_helper_->ShouldSendPacket(new_send_time_us, |
439 (*it)->send_time_us())) { | 438 (*it)->send_time_us())) { |
440 (*it)->set_send_time_us(new_send_time_us); | 439 (*it)->set_send_time_us(new_send_time_us); |
441 last_send_time_us_ = new_send_time_us; | 440 last_send_time_us_ = new_send_time_us; |
442 ++it; | 441 ++it; |
443 } else { | 442 } else { |
444 delete *it; | 443 delete *it; |
445 it = in_out->erase(it); | 444 it = in_out->erase(it); |
446 } | 445 } |
447 } | 446 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size, | 713 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size, |
715 uint32_t remaining_payload) { | 714 uint32_t remaining_payload) { |
716 uint32_t fragments = | 715 uint32_t fragments = |
717 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes; | 716 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes; |
718 uint32_t avg_size = (frame_size + fragments - 1) / fragments; | 717 uint32_t avg_size = (frame_size + fragments - 1) / fragments; |
719 return std::min(avg_size, remaining_payload); | 718 return std::min(avg_size, remaining_payload); |
720 } | 719 } |
721 } // namespace bwe | 720 } // namespace bwe |
722 } // namespace testing | 721 } // namespace testing |
723 } // namespace webrtc | 722 } // namespace webrtc |
OLD | NEW |