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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc

Issue 1230383003: Revert of Fix simulator issue where chokes didn't apply to non-congested packets. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
OLDNEW
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
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 std::max(last_send_time_us_, (*it)->send_time_us()); 434 last_send_time_us_ +
435 int64_t new_send_time_us = earliest_send_time_us +
436 ((*it)->payload_size() * 8 * 1000 + kbps_ / 2) / kbps_; 435 ((*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);
437 if (delay_cap_helper_->ShouldSendPacket(new_send_time_us, 438 if (delay_cap_helper_->ShouldSendPacket(new_send_time_us,
438 (*it)->send_time_us())) { 439 (*it)->send_time_us())) {
439 (*it)->set_send_time_us(new_send_time_us); 440 (*it)->set_send_time_us(new_send_time_us);
440 last_send_time_us_ = new_send_time_us; 441 last_send_time_us_ = new_send_time_us;
441 ++it; 442 ++it;
442 } else { 443 } else {
443 delete *it; 444 delete *it;
444 it = in_out->erase(it); 445 it = in_out->erase(it);
445 } 446 }
446 } 447 }
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size, 714 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size,
714 uint32_t remaining_payload) { 715 uint32_t remaining_payload) {
715 uint32_t fragments = 716 uint32_t fragments =
716 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes; 717 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes;
717 uint32_t avg_size = (frame_size + fragments - 1) / fragments; 718 uint32_t avg_size = (frame_size + fragments - 1) / fragments;
718 return std::min(avg_size, remaining_payload); 719 return std::min(avg_size, remaining_payload);
719 } 720 }
720 } // namespace bwe 721 } // namespace bwe
721 } // namespace testing 722 } // namespace testing
722 } // namespace webrtc 723 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698