1 // Copyright 2014 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 virtual ~CongestionControl();
20 // Called with latest measured rtt value.
21 virtual void UpdateRtt(base::TimeDelta rtt
) = 0;
23 // Called with an updated target playout delay value.
24 virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay
) = 0;
26 // Called when an encoded frame is enqueued for transport.
27 virtual void SendFrameToTransport(uint32 frame_id
,
28 size_t frame_size_in_bits
,
29 base::TimeTicks when
) = 0;
31 // Called when we receive an ACK for a frame.
32 virtual void AckFrame(uint32 frame_id
, base::TimeTicks when
) = 0;
34 // Returns the bitrate we should use for the next frame.
35 virtual uint32
GetBitrate(base::TimeTicks playout_time
,
36 base::TimeDelta playout_delay
) = 0;
39 CongestionControl
* NewAdaptiveCongestionControl(
40 base::TickClock
* clock
,
41 uint32 max_bitrate_configured
,
42 uint32 min_bitrate_configured
,
43 double max_frame_rate
);
45 CongestionControl
* NewFixedCongestionControl(uint32 bitrate
);
50 #endif // MEDIA_CAST_CONGESTION_CONTROL_CONGESTION_CONTROL_H_