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

Side by Side Diff: trunk/src/media/cast/congestion_control/congestion_control.cc

Issue 25546003: Revert 226264 "Be able to build cast_unittest and related target..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/cast/congestion_control/congestion_control.h" 5 #include "media/cast/congestion_control/congestion_control.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/cast/cast_config.h" 8 #include "media/cast/cast_config.h"
9 #include "media/cast/cast_defines.h" 9 #include "media/cast/cast_defines.h"
10 10
(...skipping 19 matching lines...) Expand all
30 bitrate_(start_bitrate), 30 bitrate_(start_bitrate),
31 default_tick_clock_(new base::DefaultTickClock()), 31 default_tick_clock_(new base::DefaultTickClock()),
32 clock_(default_tick_clock_.get()) { 32 clock_(default_tick_clock_.get()) {
33 DCHECK_GT(congestion_control_back_off, 0.0f) << "Invalid config"; 33 DCHECK_GT(congestion_control_back_off, 0.0f) << "Invalid config";
34 DCHECK_LT(congestion_control_back_off, 1.0f) << "Invalid config"; 34 DCHECK_LT(congestion_control_back_off, 1.0f) << "Invalid config";
35 DCHECK_GE(max_bitrate_configured, min_bitrate_configured) << "Invalid config"; 35 DCHECK_GE(max_bitrate_configured, min_bitrate_configured) << "Invalid config";
36 DCHECK_GE(max_bitrate_configured, start_bitrate) << "Invalid config"; 36 DCHECK_GE(max_bitrate_configured, start_bitrate) << "Invalid config";
37 DCHECK_GE(start_bitrate, min_bitrate_configured) << "Invalid config"; 37 DCHECK_GE(start_bitrate, min_bitrate_configured) << "Invalid config";
38 } 38 }
39 39
40 CongestionControl::~CongestionControl() {
41 }
42
43 bool CongestionControl::OnAck(base::TimeDelta rtt, uint32* new_bitrate) { 40 bool CongestionControl::OnAck(base::TimeDelta rtt, uint32* new_bitrate) {
44 base::TimeTicks now = clock_->NowTicks(); 41 base::TimeTicks now = clock_->NowTicks();
45 42
46 // First feedback? 43 // First feedback?
47 if (time_last_increase_.is_null()) { 44 if (time_last_increase_.is_null()) {
48 time_last_increase_ = now; 45 time_last_increase_ = now;
49 time_last_decrease_ = now; 46 time_last_decrease_ = now;
50 return false; 47 return false;
51 } 48 }
52 // Are we at the max bitrate? 49 // Are we at the max bitrate?
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 *new_bitrate = std::max( 103 *new_bitrate = std::max(
107 static_cast<uint32>(bitrate_ * congestion_control_back_off_), 104 static_cast<uint32>(bitrate_ * congestion_control_back_off_),
108 min_bitrate_configured_); 105 min_bitrate_configured_);
109 106
110 bitrate_ = *new_bitrate; 107 bitrate_ = *new_bitrate;
111 return true; 108 return true;
112 } 109 }
113 110
114 } // namespace cast 111 } // namespace cast
115 } // namespace media 112 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698