blob: d8f58db0e8c1baa3dd689289cb713dc3e14ba530 [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;
Stefan Holmer5c8942a2017-08-22 16:16:44 +020061 virtual PacedSender* pacer() = 0;
nissecae45d02017-04-24 05:53:20 -070062 virtual TransportFeedbackObserver* transport_feedback_observer() = 0;
63
64 virtual RtpPacketSender* packet_sender() = 0;
sprangdb2a9fc2017-08-09 06:42:32 -070065 virtual const RtpKeepAliveConfig& keepalive_config() const = 0;
Stefan Holmer5c8942a2017-08-22 16:16:44 +020066
67 // SetAllocatedSendBitrateLimits sets bitrates limits imposed by send codec
68 // settings.
69 // |min_send_bitrate_bps| is the total minimum send bitrate required by all
70 // sending streams. This is the minimum bitrate the PacedSender will use.
71 // Note that SendSideCongestionController::OnNetworkChanged can still be
72 // called with a lower bitrate estimate. |max_padding_bitrate_bps| is the max
73 // bitrate the send streams request for padding. This can be higher than the
74 // current network estimate and tells the PacedSender how much it should max
75 // pad unless there is real packets to send.
76 virtual void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps,
77 int max_padding_bitrate_bps) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010078
79 virtual Module* GetModule() = 0;
80 virtual CallStatsObserver* GetCallStatsObserver() = 0;
81
82 virtual void RegisterPacketFeedbackObserver(
83 PacketFeedbackObserver* observer) = 0;
84 virtual void DeRegisterPacketFeedbackObserver(
85 PacketFeedbackObserver* observer) = 0;
86 virtual void RegisterNetworkObserver(NetworkChangedObserver* observer) = 0;
87 virtual void DeRegisterNetworkObserver(NetworkChangedObserver* observer) = 0;
88 virtual void SetBweBitrates(int min_bitrate_bps,
89 int start_bitrate_bps,
90 int max_bitrate_bps) = 0;
91 virtual void OnNetworkRouteChanged(const rtc::NetworkRoute& network_route,
92 int start_bitrate_bps,
93 int min_bitrate_bps,
94 int max_bitrate_bps) = 0;
95 virtual void OnNetworkAvailability(bool network_available) = 0;
96 virtual void SetTransportOverhead(
97 size_t transport_overhead_bytes_per_packet) = 0;
98 virtual RtcpBandwidthObserver* GetBandwidthObserver() = 0;
99 virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0;
100 virtual int64_t GetPacerQueuingDelayMs() const = 0;
101 virtual int64_t GetFirstPacketTimeMs() const = 0;
102 virtual RateLimiter* GetRetransmissionRateLimiter() = 0;
103 virtual void EnablePeriodicAlrProbing(bool enable) = 0;
104 virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0;
nissecae45d02017-04-24 05:53:20 -0700105};
106
107} // namespace webrtc
108
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200109#endif // CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_