blob: 49bd8b8f7fdb07b1721217f455860fdec36b5cde [file] [log] [blame]
nisseb8f9a322017-03-27 05:36:15 -07001/*
2 * Copyright (c) 2017 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef CALL_RTP_TRANSPORT_CONTROLLER_SEND_H_
12#define CALL_RTP_TRANSPORT_CONTROLLER_SEND_H_
nisseb8f9a322017-03-27 05:36:15 -070013
Sebastian Jansson91bb6672018-02-21 13:02:51 +010014#include <map>
Sebastian Janssonc33c0fc2018-02-22 11:10:18 +010015#include <memory>
Sebastian Jansson97f61ea2018-02-21 13:01:55 +010016#include <string>
17
18#include "call/rtp_bitrate_configurator.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "call/rtp_transport_controller_send_interface.h"
Mirko Bonadei71207422017-09-15 13:58:09 +020020#include "common_types.h" // NOLINT(build/include)
Sebastian Jansson10211e92018-02-28 16:48:26 +010021#include "modules/congestion_controller/include/send_side_congestion_controller_interface.h"
Niels Möllerfd6c0912017-10-31 10:19:10 +010022#include "modules/pacing/packet_router.h"
Sebastian Janssonc33c0fc2018-02-22 11:10:18 +010023#include "modules/utility/include/process_thread.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020024#include "rtc_base/constructormagic.h"
Sebastian Jansson91bb6672018-02-21 13:02:51 +010025#include "rtc_base/networkroute.h"
nissecae45d02017-04-24 05:53:20 -070026
nisseb8f9a322017-03-27 05:36:15 -070027namespace webrtc {
nissecae45d02017-04-24 05:53:20 -070028class Clock;
29class RtcEventLog;
nisseb8f9a322017-03-27 05:36:15 -070030
nissecae45d02017-04-24 05:53:20 -070031// TODO(nisse): When we get the underlying transports here, we should
32// have one object implementing RtpTransportControllerSendInterface
33// per transport, sharing the same congestion controller.
34class RtpTransportControllerSend : public RtpTransportControllerSendInterface {
nisseb8f9a322017-03-27 05:36:15 -070035 public:
Sebastian Jansson97f61ea2018-02-21 13:01:55 +010036 RtpTransportControllerSend(Clock* clock,
37 RtcEventLog* event_log,
38 const BitrateConstraints& bitrate_config);
39 ~RtpTransportControllerSend() override;
nissecae45d02017-04-24 05:53:20 -070040 // Implements RtpTransportControllerSendInterface
nisse76e62b02017-05-31 02:24:52 -070041 PacketRouter* packet_router() override;
Sebastian Jansson4c1ffb82018-02-15 16:51:58 +010042
nisse76e62b02017-05-31 02:24:52 -070043 TransportFeedbackObserver* transport_feedback_observer() override;
44 RtpPacketSender* packet_sender() override;
sprangdb2a9fc2017-08-09 06:42:32 -070045 const RtpKeepAliveConfig& keepalive_config() const override;
46
Stefan Holmer5c8942a2017-08-22 16:16:44 +020047 void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps,
philipel832b1c82018-02-28 17:04:18 +010048 int max_padding_bitrate_bps,
49 int total_bitrate_bps) override;
Stefan Holmer5c8942a2017-08-22 16:16:44 +020050
sprangdb2a9fc2017-08-09 06:42:32 -070051 void SetKeepAliveConfig(const RtpKeepAliveConfig& config);
Sebastian Jansson4c1ffb82018-02-15 16:51:58 +010052 void SetPacingFactor(float pacing_factor) override;
53 void SetQueueTimeLimit(int limit_ms) override;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010054 CallStatsObserver* GetCallStatsObserver() override;
55 void RegisterPacketFeedbackObserver(
56 PacketFeedbackObserver* observer) override;
57 void DeRegisterPacketFeedbackObserver(
58 PacketFeedbackObserver* observer) override;
59 void RegisterNetworkObserver(NetworkChangedObserver* observer) override;
Sebastian Jansson97f61ea2018-02-21 13:01:55 +010060 void OnNetworkRouteChanged(const std::string& transport_name,
61 const rtc::NetworkRoute& network_route) override;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010062 void OnNetworkAvailability(bool network_available) override;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010063 RtcpBandwidthObserver* GetBandwidthObserver() override;
64 bool AvailableBandwidth(uint32_t* bandwidth) const override;
65 int64_t GetPacerQueuingDelayMs() const override;
66 int64_t GetFirstPacketTimeMs() const override;
67 RateLimiter* GetRetransmissionRateLimiter() override;
68 void EnablePeriodicAlrProbing(bool enable) override;
69 void OnSentPacket(const rtc::SentPacket& sent_packet) override;
nissecae45d02017-04-24 05:53:20 -070070
Sebastian Jansson97f61ea2018-02-21 13:01:55 +010071 void SetSdpBitrateParameters(const BitrateConstraints& constraints) override;
72 void SetClientBitratePreferences(
73 const BitrateConstraintsMask& preferences) override;
74
nissecae45d02017-04-24 05:53:20 -070075 private:
76 PacketRouter packet_router_;
Stefan Holmer5c8942a2017-08-22 16:16:44 +020077 PacedSender pacer_;
Sebastian Jansson10211e92018-02-28 16:48:26 +010078 const std::unique_ptr<SendSideCongestionControllerInterface> send_side_cc_;
sprangdb2a9fc2017-08-09 06:42:32 -070079 RtpKeepAliveConfig keepalive_;
Sebastian Jansson97f61ea2018-02-21 13:01:55 +010080 RtpBitrateConfigurator bitrate_configurator_;
Sebastian Jansson91bb6672018-02-21 13:02:51 +010081 std::map<std::string, rtc::NetworkRoute> network_routes_;
Sebastian Janssonc33c0fc2018-02-22 11:10:18 +010082 const std::unique_ptr<ProcessThread> process_thread_;
nissecae45d02017-04-24 05:53:20 -070083
84 RTC_DISALLOW_COPY_AND_ASSIGN(RtpTransportControllerSend);
nisseb8f9a322017-03-27 05:36:15 -070085};
86
87} // namespace webrtc
88
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020089#endif // CALL_RTP_TRANSPORT_CONTROLLER_SEND_H_