blob: 284aeec46b59a1e48b5f775b7ddac40553ddfcaf [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 Janssone4be6da2018-02-15 16:51:41 +010016namespace rtc {
17struct SentPacket;
18struct NetworkRoute;
19} // namespace rtc
nissecae45d02017-04-24 05:53:20 -070020namespace webrtc {
21
Sebastian Janssone4be6da2018-02-15 16:51:41 +010022class CallStatsObserver;
23class NetworkChangedObserver;
24class Module;
Stefan Holmer5c8942a2017-08-22 16:16:44 +020025class PacedSender;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010026class PacketFeedbackObserver;
nissecae45d02017-04-24 05:53:20 -070027class PacketRouter;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010028class RateLimiter;
29class RtcpBandwidthObserver;
nissecae45d02017-04-24 05:53:20 -070030class RtpPacketSender;
sprangdb2a9fc2017-08-09 06:42:32 -070031struct RtpKeepAliveConfig;
nissecae45d02017-04-24 05:53:20 -070032class TransportFeedbackObserver;
33
34// An RtpTransportController should own everything related to the RTP
35// transport to/from a remote endpoint. We should have separate
36// interfaces for send and receive side, even if they are implemented
37// by the same class. This is an ongoing refactoring project. At some
38// point, this class should be promoted to a public api under
39// webrtc/api/rtp/.
40//
41// For a start, this object is just a collection of the objects needed
42// by the VideoSendStream constructor. The plan is to move ownership
43// of all RTP-related objects here, and add methods to create per-ssrc
44// objects which would then be passed to VideoSendStream. Eventually,
45// direct accessors like packet_router() should be removed.
46//
47// This should also have a reference to the underlying
48// webrtc::Transport(s). Currently, webrtc::Transport is implemented by
eladalonf1841382017-06-12 01:16:46 -070049// WebRtcVideoChannel and WebRtcVoiceMediaChannel, and owned by
nissecae45d02017-04-24 05:53:20 -070050// WebrtcSession. Video and audio always uses different transport
51// objects, even in the common case where they are bundled over the
52// same underlying transport.
53//
54// Extracting the logic of the webrtc::Transport from BaseChannel and
55// subclasses into a separate class seems to be a prerequesite for
56// moving the transport here.
57class RtpTransportControllerSendInterface {
58 public:
59 virtual ~RtpTransportControllerSendInterface() {}
60 virtual PacketRouter* packet_router() = 0;
nissecae45d02017-04-24 05:53:20 -070061 virtual TransportFeedbackObserver* transport_feedback_observer() = 0;
62
63 virtual RtpPacketSender* packet_sender() = 0;
sprangdb2a9fc2017-08-09 06:42:32 -070064 virtual const RtpKeepAliveConfig& keepalive_config() const = 0;
Stefan Holmer5c8942a2017-08-22 16:16:44 +020065
66 // SetAllocatedSendBitrateLimits sets bitrates limits imposed by send codec
67 // settings.
68 // |min_send_bitrate_bps| is the total minimum send bitrate required by all
69 // sending streams. This is the minimum bitrate the PacedSender will use.
70 // Note that SendSideCongestionController::OnNetworkChanged can still be
71 // called with a lower bitrate estimate. |max_padding_bitrate_bps| is the max
72 // bitrate the send streams request for padding. This can be higher than the
73 // current network estimate and tells the PacedSender how much it should max
74 // pad unless there is real packets to send.
75 virtual void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps,
76 int max_padding_bitrate_bps) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010077
Sebastian Jansson4c1ffb82018-02-15 16:51:58 +010078 virtual Module* GetPacerModule() = 0;
79 virtual void SetPacingFactor(float pacing_factor) = 0;
80 virtual void SetQueueTimeLimit(int limit_ms) = 0;
81
Sebastian Janssone4be6da2018-02-15 16:51:41 +010082 virtual Module* GetModule() = 0;
83 virtual CallStatsObserver* GetCallStatsObserver() = 0;
84
85 virtual void RegisterPacketFeedbackObserver(
86 PacketFeedbackObserver* observer) = 0;
87 virtual void DeRegisterPacketFeedbackObserver(
88 PacketFeedbackObserver* observer) = 0;
89 virtual void RegisterNetworkObserver(NetworkChangedObserver* observer) = 0;
90 virtual void DeRegisterNetworkObserver(NetworkChangedObserver* observer) = 0;
91 virtual void SetBweBitrates(int min_bitrate_bps,
92 int start_bitrate_bps,
93 int max_bitrate_bps) = 0;
94 virtual void OnNetworkRouteChanged(const rtc::NetworkRoute& network_route,
95 int start_bitrate_bps,
96 int min_bitrate_bps,
97 int max_bitrate_bps) = 0;
98 virtual void OnNetworkAvailability(bool network_available) = 0;
99 virtual void SetTransportOverhead(
100 size_t transport_overhead_bytes_per_packet) = 0;
101 virtual RtcpBandwidthObserver* GetBandwidthObserver() = 0;
102 virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0;
103 virtual int64_t GetPacerQueuingDelayMs() const = 0;
104 virtual int64_t GetFirstPacketTimeMs() const = 0;
105 virtual RateLimiter* GetRetransmissionRateLimiter() = 0;
106 virtual void EnablePeriodicAlrProbing(bool enable) = 0;
107 virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0;
nissecae45d02017-04-24 05:53:20 -0700108};
109
110} // namespace webrtc
111
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200112#endif // CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_