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
3 // found in the LICENSE file.
5 #ifndef MEDIA_CAST_CONGESTION_CONTROL_CONGESTION_CONTROL_H_
6 #define MEDIA_CAST_CONGESTION_CONTROL_CONGESTION_CONTROL_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/tick_clock.h"
11 #include "base/time/time.h"
16 class CongestionControl
{
18 CongestionControl(base::TickClock
* clock
,
19 float congestion_control_back_off
,
20 uint32 max_bitrate_configured
,
21 uint32 min_bitrate_configured
,
22 uint32 start_bitrate
);
24 virtual ~CongestionControl();
26 // Don't call OnAck if the same message contain a NACK.
27 // Returns true if the bitrate have changed.
28 bool OnAck(base::TimeDelta rtt_ms
, uint32
* new_bitrate
);
30 // Returns true if the bitrate have changed.
31 bool OnNack(base::TimeDelta rtt_ms
, uint32
* new_bitrate
);
35 base::TickClock
* const clock_
; // Not owned by this class.
36 const float congestion_control_back_off_
;
37 const uint32 max_bitrate_configured_
;
38 const uint32 min_bitrate_configured_
;
40 base::TimeTicks time_last_increase_
;
41 base::TimeTicks time_last_decrease_
;
43 DISALLOW_COPY_AND_ASSIGN(CongestionControl
);
49 #endif // MEDIA_CAST_CONGESTION_CONTROL_CONGESTION_CONTROL_H_