blob: 736689e3d7d90917e86d13e7011c1e179d1ed05e [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"
19#include "call/bitrate_constraints.h"
20
Sebastian Janssone4be6da2018-02-15 16:51:41 +010021namespace rtc {
22struct SentPacket;
23struct NetworkRoute;
24} // namespace rtc
nissecae45d02017-04-24 05:53:20 -070025namespace webrtc {
26
Sebastian Janssone4be6da2018-02-15 16:51:41 +010027class CallStatsObserver;
28class NetworkChangedObserver;
29class Module;
Stefan Holmer5c8942a2017-08-22 16:16:44 +020030class PacedSender;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010031class PacketFeedbackObserver;
nissecae45d02017-04-24 05:53:20 -070032class PacketRouter;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010033class RateLimiter;
34class RtcpBandwidthObserver;
nissecae45d02017-04-24 05:53:20 -070035class RtpPacketSender;
sprangdb2a9fc2017-08-09 06:42:32 -070036struct RtpKeepAliveConfig;
nissecae45d02017-04-24 05:53:20 -070037class TransportFeedbackObserver;
38
39// An RtpTransportController should own everything related to the RTP
40// transport to/from a remote endpoint. We should have separate
41// interfaces for send and receive side, even if they are implemented
42// by the same class. This is an ongoing refactoring project. At some
43// point, this class should be promoted to a public api under
44// webrtc/api/rtp/.
45//
46// For a start, this object is just a collection of the objects needed
47// by the VideoSendStream constructor. The plan is to move ownership
48// of all RTP-related objects here, and add methods to create per-ssrc
49// objects which would then be passed to VideoSendStream. Eventually,
50// direct accessors like packet_router() should be removed.
51//
52// This should also have a reference to the underlying
53// webrtc::Transport(s). Currently, webrtc::Transport is implemented by
eladalonf1841382017-06-12 01:16:46 -070054// WebRtcVideoChannel and WebRtcVoiceMediaChannel, and owned by
nissecae45d02017-04-24 05:53:20 -070055// WebrtcSession. Video and audio always uses different transport
56// objects, even in the common case where they are bundled over the
57// same underlying transport.
58//
59// Extracting the logic of the webrtc::Transport from BaseChannel and
60// subclasses into a separate class seems to be a prerequesite for
61// moving the transport here.
62class RtpTransportControllerSendInterface {
63 public:
64 virtual ~RtpTransportControllerSendInterface() {}
65 virtual PacketRouter* packet_router() = 0;
nissecae45d02017-04-24 05:53:20 -070066 virtual TransportFeedbackObserver* transport_feedback_observer() = 0;
67
68 virtual RtpPacketSender* packet_sender() = 0;
sprangdb2a9fc2017-08-09 06:42:32 -070069 virtual const RtpKeepAliveConfig& keepalive_config() const = 0;
Stefan Holmer5c8942a2017-08-22 16:16:44 +020070
71 // SetAllocatedSendBitrateLimits sets bitrates limits imposed by send codec
72 // settings.
73 // |min_send_bitrate_bps| is the total minimum send bitrate required by all
74 // sending streams. This is the minimum bitrate the PacedSender will use.
75 // Note that SendSideCongestionController::OnNetworkChanged can still be
76 // called with a lower bitrate estimate. |max_padding_bitrate_bps| is the max
77 // bitrate the send streams request for padding. This can be higher than the
78 // current network estimate and tells the PacedSender how much it should max
79 // pad unless there is real packets to send.
80 virtual void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps,
81 int max_padding_bitrate_bps) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010082
Sebastian Jansson4c1ffb82018-02-15 16:51:58 +010083 virtual Module* GetPacerModule() = 0;
84 virtual void SetPacingFactor(float pacing_factor) = 0;
85 virtual void SetQueueTimeLimit(int limit_ms) = 0;
86
Sebastian Janssone4be6da2018-02-15 16:51:41 +010087 virtual Module* GetModule() = 0;
88 virtual CallStatsObserver* GetCallStatsObserver() = 0;
89
90 virtual void RegisterPacketFeedbackObserver(
91 PacketFeedbackObserver* observer) = 0;
92 virtual void DeRegisterPacketFeedbackObserver(
93 PacketFeedbackObserver* observer) = 0;
94 virtual void RegisterNetworkObserver(NetworkChangedObserver* observer) = 0;
95 virtual void DeRegisterNetworkObserver(NetworkChangedObserver* observer) = 0;
Sebastian Jansson97f61ea2018-02-21 13:01:55 +010096 virtual void OnNetworkRouteChanged(
97 const std::string& transport_name,
98 const rtc::NetworkRoute& network_route) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010099 virtual void OnNetworkAvailability(bool network_available) = 0;
100 virtual void SetTransportOverhead(
101 size_t transport_overhead_bytes_per_packet) = 0;
102 virtual RtcpBandwidthObserver* GetBandwidthObserver() = 0;
103 virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0;
104 virtual int64_t GetPacerQueuingDelayMs() const = 0;
105 virtual int64_t GetFirstPacketTimeMs() const = 0;
106 virtual RateLimiter* GetRetransmissionRateLimiter() = 0;
107 virtual void EnablePeriodicAlrProbing(bool enable) = 0;
108 virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0;
Sebastian Jansson97f61ea2018-02-21 13:01:55 +0100109
110 virtual void SetSdpBitrateParameters(
111 const BitrateConstraints& constraints) = 0;
112 virtual void SetClientBitratePreferences(
113 const BitrateConstraintsMask& preferences) = 0;
nissecae45d02017-04-24 05:53:20 -0700114};
115
116} // namespace webrtc
117
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200118#endif // CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_