blob: a1c1b853ffa1aa2d71d88ca2ee2cc8b3663a4d74 [file] [log] [blame]
mflodman@webrtc.org9ec883e2012-03-05 17:12:41 +00001/*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
mflodman0c478b32015-10-21 15:52:16 +020011#ifndef WEBRTC_CALL_CONGESTION_CONTROLLER_H_
12#define WEBRTC_CALL_CONGESTION_CONTROLLER_H_
mflodman@webrtc.org9ec883e2012-03-05 17:12:41 +000013
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +000014#include "webrtc/base/scoped_ptr.h"
mflodman0c478b32015-10-21 15:52:16 +020015#include "webrtc/stream.h"
mflodman@webrtc.org9ec883e2012-03-05 17:12:41 +000016
Stefan Holmer58c664c2016-02-08 14:31:30 +010017namespace rtc {
18struct SentPacket;
19}
20
mflodman@webrtc.org9ec883e2012-03-05 17:12:41 +000021namespace webrtc {
22
mflodman0e7e2592015-11-12 21:02:42 -080023class BitrateController;
24class BitrateObserver;
mflodman@webrtc.org7c894b72012-11-26 12:40:15 +000025class CallStats;
Stefan Holmer58c664c2016-02-08 14:31:30 +010026class Clock;
Stefan Holmere5904162015-03-26 11:11:06 +010027class PacedSender;
28class PacketRouter;
mflodman@webrtc.org9ec883e2012-03-05 17:12:41 +000029class ProcessThread;
andresp@webrtc.org29b22192013-05-14 12:10:58 +000030class RemoteBitrateEstimator;
Stefan Holmer58c664c2016-02-08 14:31:30 +010031class RemoteBitrateObserver;
sprangef165ee2015-09-22 05:10:52 -070032class RemoteEstimatorProxy;
mflodmane3787022015-10-21 13:24:28 +020033class RtpRtcp;
sprangef165ee2015-09-22 05:10:52 -070034class TransportFeedbackAdapter;
mflodman0e7e2592015-11-12 21:02:42 -080035class TransportFeedbackObserver;
stefan@webrtc.orga50e6f02015-03-09 10:06:40 +000036
mflodman0e7e2592015-11-12 21:02:42 -080037class CongestionController {
mflodman@webrtc.org9ec883e2012-03-05 17:12:41 +000038 public:
Stefan Holmer58c664c2016-02-08 14:31:30 +010039 CongestionController(Clock* clock,
40 ProcessThread* process_thread,
41 CallStats* call_stats,
42 BitrateObserver* bitrate_observer,
43 RemoteBitrateObserver* remote_bitrate_observer);
Stefan Holmer3842c5c2016-01-12 13:55:00 +010044 virtual ~CongestionController();
Stefan Holmer3842c5c2016-01-12 13:55:00 +010045 virtual void SetBweBitrates(int min_bitrate_bps,
46 int start_bitrate_bps,
47 int max_bitrate_bps);
mflodman@webrtc.org9ec883e2012-03-05 17:12:41 +000048
Stefan Holmer3842c5c2016-01-12 13:55:00 +010049 virtual void SignalNetworkState(NetworkState state);
stefan457a61d2015-10-14 03:12:59 -070050
Stefan Holmer3842c5c2016-01-12 13:55:00 +010051 virtual BitrateController* GetBitrateController() const;
52 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator(
53 bool send_side_bwe) const;
54 virtual int64_t GetPacerQueuingDelayMs() const;
55 virtual PacedSender* pacer() const { return pacer_.get(); }
56 virtual PacketRouter* packet_router() const { return packet_router_.get(); }
57 virtual TransportFeedbackObserver* GetTransportFeedbackObserver();
pwestin@webrtc.org49888ce2012-04-27 05:25:53 +000058
Stefan Holmer3842c5c2016-01-12 13:55:00 +010059 virtual void UpdatePacerBitrate(int bitrate_kbps,
60 int max_bitrate_kbps,
61 int min_bitrate_kbps);
stefan@webrtc.org792f1a12015-03-04 12:24:26 +000062
Stefan Holmer3842c5c2016-01-12 13:55:00 +010063 virtual void OnSentPacket(const rtc::SentPacket& sent_packet);
stefanc1aeaf02015-10-15 07:26:07 -070064
mflodman@webrtc.org9ec883e2012-03-05 17:12:41 +000065 private:
Stefan Holmer58c664c2016-02-08 14:31:30 +010066 Clock* const clock_;
Stefan Holmere5904162015-03-26 11:11:06 +010067 rtc::scoped_ptr<PacketRouter> packet_router_;
68 rtc::scoped_ptr<PacedSender> pacer_;
Erik Språng6b8d3552015-09-24 15:06:57 +020069 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
70 rtc::scoped_ptr<RemoteEstimatorProxy> remote_estimator_proxy_;
mflodman949c2f02015-10-16 02:31:11 -070071
mflodman@webrtc.orgaeff4f32013-04-22 12:41:57 +000072 // Registered at construct time and assumed to outlive this class.
sprang5e023eb2015-09-14 06:42:43 -070073 ProcessThread* const process_thread_;
mflodmane3787022015-10-21 13:24:28 +020074 CallStats* const call_stats_;
75
Stefan Holmere5904162015-03-26 11:11:06 +010076 rtc::scoped_ptr<ProcessThread> pacer_thread_;
77
78 rtc::scoped_ptr<BitrateController> bitrate_controller_;
Erik Språng6b8d3552015-09-24 15:06:57 +020079 rtc::scoped_ptr<TransportFeedbackAdapter> transport_feedback_adapter_;
stefan4fbd1452015-09-28 03:57:14 -070080 int min_bitrate_bps_;
Stefan Holmer3842c5c2016-01-12 13:55:00 +010081
82 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController);
mflodman@webrtc.org9ec883e2012-03-05 17:12:41 +000083};
84
85} // namespace webrtc
86
mflodman0c478b32015-10-21 15:52:16 +020087#endif // WEBRTC_CALL_CONGESTION_CONTROLLER_H_