nisse | cae45d0 | 2017-04-24 05:53:20 -0700 | [diff] [blame] | 1 | /* |
| 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 Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_ |
| 12 | #define CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_ |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 13 | #include <stddef.h> |
| 14 | #include <stdint.h> |
nisse | cae45d0 | 2017-04-24 05:53:20 -0700 | [diff] [blame] | 15 | |
Sebastian Jansson | 97f61ea | 2018-02-21 13:01:55 +0100 | [diff] [blame] | 16 | #include <string> |
| 17 | |
| 18 | #include "api/optional.h" |
Niels Möller | 0c4f7be | 2018-05-07 14:01:37 +0200 | [diff] [blame^] | 19 | #include "api/transport/bitrate_settings.h" |
Sebastian Jansson | 97f61ea | 2018-02-21 13:01:55 +0100 | [diff] [blame] | 20 | #include "call/bitrate_constraints.h" |
| 21 | |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 22 | namespace rtc { |
| 23 | struct SentPacket; |
| 24 | struct NetworkRoute; |
Sebastian Jansson | e625605 | 2018-05-04 14:08:15 +0200 | [diff] [blame] | 25 | class TaskQueue; |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 26 | } // namespace rtc |
nisse | cae45d0 | 2017-04-24 05:53:20 -0700 | [diff] [blame] | 27 | namespace webrtc { |
| 28 | |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 29 | class CallStatsObserver; |
Sebastian Jansson | 19704ec | 2018-03-12 15:59:12 +0100 | [diff] [blame] | 30 | class TargetTransferRateObserver; |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 31 | class Module; |
Stefan Holmer | 5c8942a | 2017-08-22 16:16:44 +0200 | [diff] [blame] | 32 | class PacedSender; |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 33 | class PacketFeedbackObserver; |
nisse | cae45d0 | 2017-04-24 05:53:20 -0700 | [diff] [blame] | 34 | class PacketRouter; |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 35 | class RateLimiter; |
| 36 | class RtcpBandwidthObserver; |
nisse | cae45d0 | 2017-04-24 05:53:20 -0700 | [diff] [blame] | 37 | class RtpPacketSender; |
sprang | db2a9fc | 2017-08-09 06:42:32 -0700 | [diff] [blame] | 38 | struct RtpKeepAliveConfig; |
nisse | cae45d0 | 2017-04-24 05:53:20 -0700 | [diff] [blame] | 39 | class TransportFeedbackObserver; |
| 40 | |
| 41 | // An RtpTransportController should own everything related to the RTP |
| 42 | // transport to/from a remote endpoint. We should have separate |
| 43 | // interfaces for send and receive side, even if they are implemented |
| 44 | // by the same class. This is an ongoing refactoring project. At some |
| 45 | // point, this class should be promoted to a public api under |
| 46 | // webrtc/api/rtp/. |
| 47 | // |
| 48 | // For a start, this object is just a collection of the objects needed |
| 49 | // by the VideoSendStream constructor. The plan is to move ownership |
| 50 | // of all RTP-related objects here, and add methods to create per-ssrc |
| 51 | // objects which would then be passed to VideoSendStream. Eventually, |
| 52 | // direct accessors like packet_router() should be removed. |
| 53 | // |
| 54 | // This should also have a reference to the underlying |
| 55 | // webrtc::Transport(s). Currently, webrtc::Transport is implemented by |
eladalon | f184138 | 2017-06-12 01:16:46 -0700 | [diff] [blame] | 56 | // WebRtcVideoChannel and WebRtcVoiceMediaChannel, and owned by |
nisse | cae45d0 | 2017-04-24 05:53:20 -0700 | [diff] [blame] | 57 | // WebrtcSession. Video and audio always uses different transport |
| 58 | // objects, even in the common case where they are bundled over the |
| 59 | // same underlying transport. |
| 60 | // |
| 61 | // Extracting the logic of the webrtc::Transport from BaseChannel and |
| 62 | // subclasses into a separate class seems to be a prerequesite for |
| 63 | // moving the transport here. |
| 64 | class RtpTransportControllerSendInterface { |
| 65 | public: |
| 66 | virtual ~RtpTransportControllerSendInterface() {} |
Sebastian Jansson | e625605 | 2018-05-04 14:08:15 +0200 | [diff] [blame] | 67 | virtual rtc::TaskQueue* GetWorkerQueue() = 0; |
nisse | cae45d0 | 2017-04-24 05:53:20 -0700 | [diff] [blame] | 68 | virtual PacketRouter* packet_router() = 0; |
nisse | cae45d0 | 2017-04-24 05:53:20 -0700 | [diff] [blame] | 69 | virtual TransportFeedbackObserver* transport_feedback_observer() = 0; |
| 70 | |
| 71 | virtual RtpPacketSender* packet_sender() = 0; |
sprang | db2a9fc | 2017-08-09 06:42:32 -0700 | [diff] [blame] | 72 | virtual const RtpKeepAliveConfig& keepalive_config() const = 0; |
Stefan Holmer | 5c8942a | 2017-08-22 16:16:44 +0200 | [diff] [blame] | 73 | |
| 74 | // SetAllocatedSendBitrateLimits sets bitrates limits imposed by send codec |
| 75 | // settings. |
| 76 | // |min_send_bitrate_bps| is the total minimum send bitrate required by all |
| 77 | // sending streams. This is the minimum bitrate the PacedSender will use. |
| 78 | // Note that SendSideCongestionController::OnNetworkChanged can still be |
| 79 | // called with a lower bitrate estimate. |max_padding_bitrate_bps| is the max |
| 80 | // bitrate the send streams request for padding. This can be higher than the |
| 81 | // current network estimate and tells the PacedSender how much it should max |
| 82 | // pad unless there is real packets to send. |
| 83 | virtual void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps, |
philipel | 832b1c8 | 2018-02-28 17:04:18 +0100 | [diff] [blame] | 84 | int max_padding_bitrate_bps, |
| 85 | int total_bitrate_bps) = 0; |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 86 | |
Sebastian Jansson | 4c1ffb8 | 2018-02-15 16:51:58 +0100 | [diff] [blame] | 87 | virtual void SetPacingFactor(float pacing_factor) = 0; |
| 88 | virtual void SetQueueTimeLimit(int limit_ms) = 0; |
| 89 | |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 90 | virtual CallStatsObserver* GetCallStatsObserver() = 0; |
| 91 | |
| 92 | virtual void RegisterPacketFeedbackObserver( |
| 93 | PacketFeedbackObserver* observer) = 0; |
| 94 | virtual void DeRegisterPacketFeedbackObserver( |
| 95 | PacketFeedbackObserver* observer) = 0; |
Sebastian Jansson | 19704ec | 2018-03-12 15:59:12 +0100 | [diff] [blame] | 96 | virtual void RegisterTargetTransferRateObserver( |
| 97 | TargetTransferRateObserver* observer) = 0; |
Sebastian Jansson | 97f61ea | 2018-02-21 13:01:55 +0100 | [diff] [blame] | 98 | virtual void OnNetworkRouteChanged( |
| 99 | const std::string& transport_name, |
| 100 | const rtc::NetworkRoute& network_route) = 0; |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 101 | virtual void OnNetworkAvailability(bool network_available) = 0; |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 102 | virtual RtcpBandwidthObserver* GetBandwidthObserver() = 0; |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 103 | virtual int64_t GetPacerQueuingDelayMs() const = 0; |
| 104 | virtual int64_t GetFirstPacketTimeMs() const = 0; |
Sebastian Jansson | e4be6da | 2018-02-15 16:51:41 +0100 | [diff] [blame] | 105 | virtual void EnablePeriodicAlrProbing(bool enable) = 0; |
| 106 | virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0; |
Sebastian Jansson | 12130bb | 2018-03-21 12:48:43 +0100 | [diff] [blame] | 107 | virtual void SetPerPacketFeedbackAvailable(bool available) = 0; |
Sebastian Jansson | 97f61ea | 2018-02-21 13:01:55 +0100 | [diff] [blame] | 108 | |
| 109 | virtual void SetSdpBitrateParameters( |
| 110 | const BitrateConstraints& constraints) = 0; |
| 111 | virtual void SetClientBitratePreferences( |
Niels Möller | 0c4f7be | 2018-05-07 14:01:37 +0200 | [diff] [blame^] | 112 | const BitrateSettings& preferences) = 0; |
nisse | cae45d0 | 2017-04-24 05:53:20 -0700 | [diff] [blame] | 113 | }; |
| 114 | |
| 115 | } // namespace webrtc |
| 116 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 117 | #endif // CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_ |