blob: bb95bc913755db43e647f7b4938d2fa978870784 [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;
Sebastian Janssone6256052018-05-04 14:08:15 +020024class TaskQueue;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010025} // namespace rtc
nissecae45d02017-04-24 05:53:20 -070026namespace webrtc {
27
Sebastian Janssone4be6da2018-02-15 16:51:41 +010028class CallStatsObserver;
Sebastian Jansson19704ec2018-03-12 15:59:12 +010029class TargetTransferRateObserver;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010030class Module;
Stefan Holmer5c8942a2017-08-22 16:16:44 +020031class PacedSender;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010032class PacketFeedbackObserver;
nissecae45d02017-04-24 05:53:20 -070033class PacketRouter;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010034class RateLimiter;
35class RtcpBandwidthObserver;
nissecae45d02017-04-24 05:53:20 -070036class RtpPacketSender;
sprangdb2a9fc2017-08-09 06:42:32 -070037struct RtpKeepAliveConfig;
nissecae45d02017-04-24 05:53:20 -070038class TransportFeedbackObserver;
39
40// An RtpTransportController should own everything related to the RTP
41// transport to/from a remote endpoint. We should have separate
42// interfaces for send and receive side, even if they are implemented
43// by the same class. This is an ongoing refactoring project. At some
44// point, this class should be promoted to a public api under
45// webrtc/api/rtp/.
46//
47// For a start, this object is just a collection of the objects needed
48// by the VideoSendStream constructor. The plan is to move ownership
49// of all RTP-related objects here, and add methods to create per-ssrc
50// objects which would then be passed to VideoSendStream. Eventually,
51// direct accessors like packet_router() should be removed.
52//
53// This should also have a reference to the underlying
54// webrtc::Transport(s). Currently, webrtc::Transport is implemented by
eladalonf1841382017-06-12 01:16:46 -070055// WebRtcVideoChannel and WebRtcVoiceMediaChannel, and owned by
nissecae45d02017-04-24 05:53:20 -070056// WebrtcSession. Video and audio always uses different transport
57// objects, even in the common case where they are bundled over the
58// same underlying transport.
59//
60// Extracting the logic of the webrtc::Transport from BaseChannel and
61// subclasses into a separate class seems to be a prerequesite for
62// moving the transport here.
63class RtpTransportControllerSendInterface {
64 public:
65 virtual ~RtpTransportControllerSendInterface() {}
Sebastian Janssone6256052018-05-04 14:08:15 +020066 virtual rtc::TaskQueue* GetWorkerQueue() = 0;
nissecae45d02017-04-24 05:53:20 -070067 virtual PacketRouter* packet_router() = 0;
nissecae45d02017-04-24 05:53:20 -070068 virtual TransportFeedbackObserver* transport_feedback_observer() = 0;
69
70 virtual RtpPacketSender* packet_sender() = 0;
sprangdb2a9fc2017-08-09 06:42:32 -070071 virtual const RtpKeepAliveConfig& keepalive_config() const = 0;
Stefan Holmer5c8942a2017-08-22 16:16:44 +020072
73 // SetAllocatedSendBitrateLimits sets bitrates limits imposed by send codec
74 // settings.
75 // |min_send_bitrate_bps| is the total minimum send bitrate required by all
76 // sending streams. This is the minimum bitrate the PacedSender will use.
77 // Note that SendSideCongestionController::OnNetworkChanged can still be
78 // called with a lower bitrate estimate. |max_padding_bitrate_bps| is the max
79 // bitrate the send streams request for padding. This can be higher than the
80 // current network estimate and tells the PacedSender how much it should max
81 // pad unless there is real packets to send.
82 virtual void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps,
philipel832b1c82018-02-28 17:04:18 +010083 int max_padding_bitrate_bps,
84 int total_bitrate_bps) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +010085
Sebastian Jansson4c1ffb82018-02-15 16:51:58 +010086 virtual void SetPacingFactor(float pacing_factor) = 0;
87 virtual void SetQueueTimeLimit(int limit_ms) = 0;
88
Sebastian Janssone4be6da2018-02-15 16:51:41 +010089 virtual CallStatsObserver* GetCallStatsObserver() = 0;
90
91 virtual void RegisterPacketFeedbackObserver(
92 PacketFeedbackObserver* observer) = 0;
93 virtual void DeRegisterPacketFeedbackObserver(
94 PacketFeedbackObserver* observer) = 0;
Sebastian Jansson19704ec2018-03-12 15:59:12 +010095 virtual void RegisterTargetTransferRateObserver(
96 TargetTransferRateObserver* observer) = 0;
Sebastian Jansson97f61ea2018-02-21 13:01:55 +010097 virtual void OnNetworkRouteChanged(
98 const std::string& transport_name,
99 const rtc::NetworkRoute& network_route) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100100 virtual void OnNetworkAvailability(bool network_available) = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100101 virtual RtcpBandwidthObserver* GetBandwidthObserver() = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100102 virtual int64_t GetPacerQueuingDelayMs() const = 0;
103 virtual int64_t GetFirstPacketTimeMs() const = 0;
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100104 virtual void EnablePeriodicAlrProbing(bool enable) = 0;
105 virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0;
Sebastian Jansson12130bb2018-03-21 12:48:43 +0100106 virtual void SetPerPacketFeedbackAvailable(bool available) = 0;
Sebastian Jansson97f61ea2018-02-21 13:01:55 +0100107
108 virtual void SetSdpBitrateParameters(
109 const BitrateConstraints& constraints) = 0;
110 virtual void SetClientBitratePreferences(
111 const BitrateConstraintsMask& preferences) = 0;
nissecae45d02017-04-24 05:53:20 -0700112};
113
114} // namespace webrtc
115
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200116#endif // CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_