2012-03-05 17:12:41 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2015-10-21 15:52:16 +02:00
|
|
|
#ifndef WEBRTC_CALL_CONGESTION_CONTROLLER_H_
|
|
|
|
|
#define WEBRTC_CALL_CONGESTION_CONTROLLER_H_
|
2012-03-05 17:12:41 +00:00
|
|
|
|
2015-03-09 10:06:40 +00:00
|
|
|
#include <vector>
|
2012-03-05 17:12:41 +00:00
|
|
|
|
2015-07-23 06:58:33 -07:00
|
|
|
#include "webrtc/base/criticalsection.h"
|
2015-02-26 14:34:55 +00:00
|
|
|
#include "webrtc/base/scoped_ptr.h"
|
2015-10-15 07:26:07 -07:00
|
|
|
#include "webrtc/base/socket.h"
|
2015-10-21 15:52:16 +02:00
|
|
|
#include "webrtc/stream.h"
|
2012-03-05 17:12:41 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2015-11-12 21:02:42 -08:00
|
|
|
class BitrateController;
|
|
|
|
|
class BitrateObserver;
|
2012-11-26 12:40:15 +00:00
|
|
|
class CallStats;
|
2013-05-13 10:50:50 +00:00
|
|
|
class Config;
|
2015-03-26 11:11:06 +01:00
|
|
|
class PacedSender;
|
|
|
|
|
class PacketRouter;
|
2012-03-05 17:12:41 +00:00
|
|
|
class ProcessThread;
|
2013-05-14 12:10:58 +00:00
|
|
|
class RemoteBitrateEstimator;
|
2015-09-22 05:10:52 -07:00
|
|
|
class RemoteEstimatorProxy;
|
2015-10-21 13:24:28 +02:00
|
|
|
class RtpRtcp;
|
2015-09-22 16:28:51 +02:00
|
|
|
class SendStatisticsProxy;
|
2015-09-22 05:10:52 -07:00
|
|
|
class TransportFeedbackAdapter;
|
2015-11-12 21:02:42 -08:00
|
|
|
class TransportFeedbackObserver;
|
2012-03-05 17:12:41 +00:00
|
|
|
class ViEEncoder;
|
|
|
|
|
class VieRemb;
|
2015-03-09 10:06:40 +00:00
|
|
|
|
2015-11-12 21:02:42 -08:00
|
|
|
class CongestionController {
|
2012-03-05 17:12:41 +00:00
|
|
|
public:
|
2015-11-12 21:02:42 -08:00
|
|
|
CongestionController(ProcessThread* process_thread, CallStats* call_stats,
|
|
|
|
|
BitrateObserver* bitrate_observer);
|
2015-10-21 15:52:16 +02:00
|
|
|
~CongestionController();
|
2015-10-21 13:24:28 +02:00
|
|
|
void AddEncoder(ViEEncoder* encoder);
|
2015-10-16 02:31:11 -07:00
|
|
|
void RemoveEncoder(ViEEncoder* encoder);
|
2015-09-28 03:57:14 -07:00
|
|
|
void SetBweBitrates(int min_bitrate_bps,
|
|
|
|
|
int start_bitrate_bps,
|
|
|
|
|
int max_bitrate_bps);
|
2012-03-05 17:12:41 +00:00
|
|
|
|
2015-10-21 13:24:28 +02:00
|
|
|
void SetChannelRembStatus(bool sender, bool receiver, RtpRtcp* rtp_module);
|
2012-03-05 17:12:41 +00:00
|
|
|
|
2015-10-14 03:12:59 -07:00
|
|
|
void SignalNetworkState(NetworkState state);
|
|
|
|
|
|
2015-03-09 10:06:40 +00:00
|
|
|
BitrateController* GetBitrateController() const;
|
2015-10-18 22:08:19 -07:00
|
|
|
RemoteBitrateEstimator* GetRemoteBitrateEstimator(bool send_side_bwe) const;
|
2015-03-26 11:11:06 +01:00
|
|
|
int64_t GetPacerQueuingDelayMs() const;
|
2015-10-16 02:31:11 -07:00
|
|
|
PacedSender* pacer() const { return pacer_.get(); }
|
|
|
|
|
PacketRouter* packet_router() const { return packet_router_.get(); }
|
|
|
|
|
TransportFeedbackObserver* GetTransportFeedbackObserver();
|
2012-04-27 05:25:53 +00:00
|
|
|
|
2015-11-12 21:02:42 -08:00
|
|
|
void UpdatePacerBitrate(int bitrate_kbps, int max_bitrate_kbps,
|
|
|
|
|
int min_bitrate_kbps);
|
2015-03-04 12:24:26 +00:00
|
|
|
|
2015-10-15 07:26:07 -07:00
|
|
|
void OnSentPacket(const rtc::SentPacket& sent_packet);
|
|
|
|
|
|
2012-03-05 17:12:41 +00:00
|
|
|
private:
|
2015-02-26 14:34:55 +00:00
|
|
|
rtc::scoped_ptr<VieRemb> remb_;
|
2015-09-23 13:51:47 +02:00
|
|
|
rtc::scoped_ptr<PacketRouter> packet_router_;
|
|
|
|
|
rtc::scoped_ptr<PacedSender> pacer_;
|
2015-09-24 15:06:57 +02:00
|
|
|
rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
|
|
|
|
|
rtc::scoped_ptr<RemoteEstimatorProxy> remote_estimator_proxy_;
|
2015-10-16 02:31:11 -07:00
|
|
|
|
|
|
|
|
mutable rtc::CriticalSection encoder_crit_;
|
|
|
|
|
std::vector<ViEEncoder*> encoders_ GUARDED_BY(encoder_crit_);
|
2015-03-26 11:11:06 +01:00
|
|
|
|
2013-04-22 12:41:57 +00:00
|
|
|
// Registered at construct time and assumed to outlive this class.
|
2015-09-14 06:42:43 -07:00
|
|
|
ProcessThread* const process_thread_;
|
2015-10-21 13:24:28 +02:00
|
|
|
CallStats* const call_stats_;
|
|
|
|
|
|
2015-03-26 11:11:06 +01:00
|
|
|
rtc::scoped_ptr<ProcessThread> pacer_thread_;
|
|
|
|
|
|
|
|
|
|
rtc::scoped_ptr<BitrateController> bitrate_controller_;
|
2015-09-24 15:06:57 +02:00
|
|
|
rtc::scoped_ptr<TransportFeedbackAdapter> transport_feedback_adapter_;
|
2015-09-28 03:57:14 -07:00
|
|
|
int min_bitrate_bps_;
|
2012-03-05 17:12:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2015-10-21 15:52:16 +02:00
|
|
|
#endif // WEBRTC_CALL_CONGESTION_CONTROLLER_H_
|