blob: 7458b3790ca9a80dcf0f88390e22e7ed45ccce78 [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;
Sebastian Jansson19704ec2018-03-12 15:59:12 +010028class TargetTransferRateObserver;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010029class 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,
philipel832b1c82018-02-28 17:04:18 +010081 int max_padding_bitrate_bps,
82 int total_bitrate_bps) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010083
Sebastian Jansson4c1ffb82018-02-15 16:51:58 +010084 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 CallStatsObserver* GetCallStatsObserver() = 0;
88
89 virtual void RegisterPacketFeedbackObserver(
90 PacketFeedbackObserver* observer) = 0;
91 virtual void DeRegisterPacketFeedbackObserver(
92 PacketFeedbackObserver* observer) = 0;
Sebastian Jansson19704ec2018-03-12 15:59:12 +010093 virtual void RegisterTargetTransferRateObserver(
94 TargetTransferRateObserver* observer) = 0;
Sebastian Jansson97f61ea2018-02-21 13:01:55 +010095 virtual void OnNetworkRouteChanged(
96 const std::string& transport_name,
97 const rtc::NetworkRoute& network_route) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010098 virtual void OnNetworkAvailability(bool network_available) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010099 virtual RtcpBandwidthObserver* GetBandwidthObserver() = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100100 virtual int64_t GetPacerQueuingDelayMs() const = 0;
101 virtual int64_t GetFirstPacketTimeMs() const = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100102 virtual void EnablePeriodicAlrProbing(bool enable) = 0;
103 virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0;
Sebastian Jansson12130bb2018-03-21 12:48:43 +0100104 virtual void SetPerPacketFeedbackAvailable(bool available) = 0;
Sebastian Jansson97f61ea2018-02-21 13:01:55 +0100105
106 virtual void SetSdpBitrateParameters(
107 const BitrateConstraints& constraints) = 0;
108 virtual void SetClientBitratePreferences(
109 const BitrateConstraintsMask& preferences) = 0;
nissecae45d02017-04-24 05:53:20 -0700110};
111
112} // namespace webrtc
113
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200114#endif // CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_