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

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

Issue 1233853002: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 423
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 =
magalhaesc 2015/07/13 13:07:59 LGTM
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698