blob: ad3aa2b75d50287ca664d487968359f68b35de8f [file] [log] [blame]
nissecae45d02017-04-24 05:53:20 -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_INTERFACE_H_
12#define CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_
Sebastian Janssone4be6da2018-02-15 16:51:41 +010013#include <stddef.h>
14#include <stdint.h>
nissecae45d02017-04-24 05:53:20 -070015
Sebastian Jansson97f61ea2018-02-21 13:01:55 +010016#include <string>
17
18#include "api/optional.h"
Niels Möller0c4f7be2018-05-07 14:01:37 +020019#include "api/transport/bitrate_settings.h"
Sebastian Jansson97f61ea2018-02-21 13:01:55 +010020#include "call/bitrate_constraints.h"
21
Sebastian Janssone4be6da2018-02-15 16:51:41 +010022namespace rtc {
23struct SentPacket;
24struct NetworkRoute;
Sebastian Janssone6256052018-05-04 14:08:15 +020025class TaskQueue;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010026} // namespace rtc
nissecae45d02017-04-24 05:53:20 -070027namespace webrtc {
28
Sebastian Janssone4be6da2018-02-15 16:51:41 +010029class CallStatsObserver;
Sebastian Jansson19704ec2018-03-12 15:59:12 +010030class TargetTransferRateObserver;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010031class Module;
Stefan Holmer5c8942a2017-08-22 16:16:44 +020032class PacedSender;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010033class PacketFeedbackObserver;
nissecae45d02017-04-24 05:53:20 -070034class PacketRouter;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010035class RateLimiter;
36class RtcpBandwidthObserver;
nissecae45d02017-04-24 05:53:20 -070037class RtpPacketSender;
sprangdb2a9fc2017-08-09 06:42:32 -070038struct RtpKeepAliveConfig;
nissecae45d02017-04-24 05:53:20 -070039class TransportFeedbackObserver;
40
41// An RtpTransportController should own everything related to the RTP
42// transport to/from a remote endpoint. We should have separate
43// interfaces for send and receive side, even if they are implemented
44// by the same class. This is an ongoing refactoring project. At some
45// point, this class should be promoted to a public api under
46// webrtc/api/rtp/.
47//
48// For a start, this object is just a collection of the objects needed
49// by the VideoSendStream constructor. The plan is to move ownership
50// of all RTP-related objects here, and add methods to create per-ssrc
51// objects which would then be passed to VideoSendStream. Eventually,
52// direct accessors like packet_router() should be removed.
53//
54// This should also have a reference to the underlying
55// webrtc::Transport(s). Currently, webrtc::Transport is implemented by
eladalonf1841382017-06-12 01:16:46 -070056// WebRtcVideoChannel and WebRtcVoiceMediaChannel, and owned by
nissecae45d02017-04-24 05:53:20 -070057// WebrtcSession. Video and audio always uses different transport
58// objects, even in the common case where they are bundled over the
59// same underlying transport.
60//
61// Extracting the logic of the webrtc::Transport from BaseChannel and
62// subclasses into a separate class seems to be a prerequesite for
63// moving the transport here.
64class RtpTransportControllerSendInterface {
65 public:
66 virtual ~RtpTransportControllerSendInterface() {}
Sebastian Janssone6256052018-05-04 14:08:15 +020067 virtual rtc::TaskQueue* GetWorkerQueue() = 0;
nissecae45d02017-04-24 05:53:20 -070068 virtual PacketRouter* packet_router() = 0;
nissecae45d02017-04-24 05:53:20 -070069 virtual TransportFeedbackObserver* transport_feedback_observer() = 0;
70
71 virtual RtpPacketSender* packet_sender() = 0;
sprangdb2a9fc2017-08-09 06:42:32 -070072 virtual const RtpKeepAliveConfig& keepalive_config() const = 0;
Stefan Holmer5c8942a2017-08-22 16:16:44 +020073
74 // SetAllocatedSendBitrateLimits sets bitrates limits imposed by send codec
75 // settings.
76 // |min_send_bitrate_bps| is the total minimum send bitrate required by all
77 // sending streams. This is the minimum bitrate the PacedSender will use.
78 // Note that SendSideCongestionController::OnNetworkChanged can still be
79 // called with a lower bitrate estimate. |max_padding_bitrate_bps| is the max
80 // bitrate the send streams request for padding. This can be higher than the
81 // current network estimate and tells the PacedSender how much it should max
82 // pad unless there is real packets to send.
83 virtual void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps,
philipel832b1c82018-02-28 17:04:18 +010084 int max_padding_bitrate_bps,
85 int total_bitrate_bps) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010086
Sebastian Jansson4c1ffb82018-02-15 16:51:58 +010087 virtual void SetPacingFactor(float pacing_factor) = 0;
88 virtual void SetQueueTimeLimit(int limit_ms) = 0;
89
Sebastian Janssone4be6da2018-02-15 16:51:41 +010090 virtual CallStatsObserver* GetCallStatsObserver() = 0;
91
92 virtual void RegisterPacketFeedbackObserver(
93 PacketFeedbackObserver* observer) = 0;
94 virtual void DeRegisterPacketFeedbackObserver(
95 PacketFeedbackObserver* observer) = 0;
Sebastian Jansson19704ec2018-03-12 15:59:12 +010096 virtual void RegisterTargetTransferRateObserver(
97 TargetTransferRateObserver* observer) = 0;
Sebastian Jansson97f61ea2018-02-21 13:01:55 +010098 virtual void OnNetworkRouteChanged(
99 const std::string& transport_name,
100 const rtc::NetworkRoute& network_route) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100101 virtual void OnNetworkAvailability(bool network_available) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100102 virtual RtcpBandwidthObserver* GetBandwidthObserver() = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100103 virtual int64_t GetPacerQueuingDelayMs() const = 0;
104 virtual int64_t GetFirstPacketTimeMs() const = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100105 virtual void EnablePeriodicAlrProbing(bool enable) = 0;
106 virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0;
Sebastian Jansson12130bb2018-03-21 12:48:43 +0100107 virtual void SetPerPacketFeedbackAvailable(bool available) = 0;
Sebastian Jansson97f61ea2018-02-21 13:01:55 +0100108
109 virtual void SetSdpBitrateParameters(
110 const BitrateConstraints& constraints) = 0;
111 virtual void SetClientBitratePreferences(
Niels Möller0c4f7be2018-05-07 14:01:37 +0200112 const BitrateSettings& preferences) = 0;
nissecae45d02017-04-24 05:53:20 -0700113};
114
115} // namespace webrtc
116
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200117#endif // CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_