2017-04-24 05:53:20 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_
|
|
|
|
|
#define CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_
|
2018-02-15 16:51:41 +01:00
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdint.h>
|
2017-04-24 05:53:20 -07:00
|
|
|
|
2018-07-17 16:03:46 +02:00
|
|
|
#include <map>
|
2018-10-04 15:21:55 +02:00
|
|
|
#include <memory>
|
2024-08-29 13:00:40 +00:00
|
|
|
#include <optional>
|
2018-02-21 13:01:55 +01:00
|
|
|
|
2022-05-17 11:48:46 +02:00
|
|
|
#include "absl/strings/string_view.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "api/crypto/crypto_options.h"
|
2018-10-04 15:21:55 +02:00
|
|
|
#include "api/fec_controller.h"
|
2020-02-27 16:16:55 +01:00
|
|
|
#include "api/frame_transformer_interface.h"
|
2024-07-26 11:51:53 +00:00
|
|
|
#include "api/rtp_packet_sender.h"
|
2024-09-02 20:55:52 +00:00
|
|
|
#include "api/scoped_refptr.h"
|
2024-02-07 14:16:20 +01:00
|
|
|
#include "api/transport/bandwidth_estimation_settings.h"
|
2018-05-07 14:01:37 +02:00
|
|
|
#include "api/transport/bitrate_settings.h"
|
2024-06-17 17:28:40 +02:00
|
|
|
#include "api/transport/network_control.h"
|
2024-09-02 20:55:52 +00:00
|
|
|
#include "api/transport/network_types.h"
|
2019-07-29 16:38:27 +02:00
|
|
|
#include "api/units/timestamp.h"
|
2018-07-17 16:03:46 +02:00
|
|
|
#include "call/rtp_config.h"
|
2020-08-25 10:28:50 +02:00
|
|
|
#include "common_video/frame_counts.h"
|
2019-05-27 10:44:24 +02:00
|
|
|
#include "modules/rtp_rtcp/include/report_block_data.h"
|
2018-11-27 14:05:08 +01:00
|
|
|
#include "modules/rtp_rtcp/include/rtcp_statistics.h"
|
2018-07-17 16:03:46 +02:00
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
2018-02-21 13:01:55 +01:00
|
|
|
|
2018-02-15 16:51:41 +01:00
|
|
|
namespace rtc {
|
|
|
|
|
struct SentPacket;
|
|
|
|
|
struct NetworkRoute;
|
|
|
|
|
} // namespace rtc
|
2017-04-24 05:53:20 -07:00
|
|
|
namespace webrtc {
|
|
|
|
|
|
2018-10-17 17:27:25 -07:00
|
|
|
class FrameEncryptorInterface;
|
2018-03-12 15:59:12 +01:00
|
|
|
class TargetTransferRateObserver;
|
2018-07-17 16:03:46 +02:00
|
|
|
class Transport;
|
2017-04-24 05:53:20 -07:00
|
|
|
class PacketRouter;
|
2018-07-19 10:34:38 +02:00
|
|
|
class RtpVideoSenderInterface;
|
2017-04-24 05:53:20 -07:00
|
|
|
class RtpPacketSender;
|
2024-01-26 11:18:26 +01:00
|
|
|
class RtpRtcpInterface;
|
2017-04-24 05:53:20 -07:00
|
|
|
|
2018-07-17 16:03:46 +02:00
|
|
|
struct RtpSenderObservers {
|
|
|
|
|
RtcpRttStats* rtcp_rtt_stats;
|
|
|
|
|
RtcpIntraFrameObserver* intra_frame_callback;
|
2019-04-09 11:55:13 +02:00
|
|
|
RtcpLossNotificationObserver* rtcp_loss_notification_observer;
|
2019-05-27 10:44:24 +02:00
|
|
|
ReportBlockDataObserver* report_block_data_observer;
|
2018-07-17 16:03:46 +02:00
|
|
|
StreamDataCountersCallback* rtp_stats;
|
|
|
|
|
BitrateStatisticsObserver* bitrate_observer;
|
|
|
|
|
FrameCountObserver* frame_count_observer;
|
|
|
|
|
RtcpPacketTypeCounterObserver* rtcp_type_observer;
|
|
|
|
|
SendPacketObserver* send_packet_observer;
|
|
|
|
|
};
|
|
|
|
|
|
2018-10-17 17:27:25 -07:00
|
|
|
struct RtpSenderFrameEncryptionConfig {
|
|
|
|
|
FrameEncryptorInterface* frame_encryptor = nullptr;
|
|
|
|
|
CryptoOptions crypto_options;
|
|
|
|
|
};
|
|
|
|
|
|
2017-04-24 05:53:20 -07:00
|
|
|
// An RtpTransportController should own everything related to the RTP
|
|
|
|
|
// transport to/from a remote endpoint. We should have separate
|
|
|
|
|
// interfaces for send and receive side, even if they are implemented
|
|
|
|
|
// by the same class. This is an ongoing refactoring project. At some
|
|
|
|
|
// point, this class should be promoted to a public api under
|
|
|
|
|
// webrtc/api/rtp/.
|
|
|
|
|
//
|
|
|
|
|
// For a start, this object is just a collection of the objects needed
|
|
|
|
|
// by the VideoSendStream constructor. The plan is to move ownership
|
|
|
|
|
// of all RTP-related objects here, and add methods to create per-ssrc
|
|
|
|
|
// objects which would then be passed to VideoSendStream. Eventually,
|
|
|
|
|
// direct accessors like packet_router() should be removed.
|
|
|
|
|
//
|
|
|
|
|
// This should also have a reference to the underlying
|
|
|
|
|
// webrtc::Transport(s). Currently, webrtc::Transport is implemented by
|
2017-06-12 01:16:46 -07:00
|
|
|
// WebRtcVideoChannel and WebRtcVoiceMediaChannel, and owned by
|
2017-04-24 05:53:20 -07:00
|
|
|
// WebrtcSession. Video and audio always uses different transport
|
|
|
|
|
// objects, even in the common case where they are bundled over the
|
|
|
|
|
// same underlying transport.
|
|
|
|
|
//
|
|
|
|
|
// Extracting the logic of the webrtc::Transport from BaseChannel and
|
|
|
|
|
// subclasses into a separate class seems to be a prerequesite for
|
|
|
|
|
// moving the transport here.
|
|
|
|
|
class RtpTransportControllerSendInterface {
|
|
|
|
|
public:
|
|
|
|
|
virtual ~RtpTransportControllerSendInterface() {}
|
|
|
|
|
virtual PacketRouter* packet_router() = 0;
|
2018-07-17 16:03:46 +02:00
|
|
|
|
2018-07-19 10:34:38 +02:00
|
|
|
virtual RtpVideoSenderInterface* CreateRtpVideoSender(
|
2021-11-29 10:26:40 +01:00
|
|
|
const std::map<uint32_t, RtpState>& suspended_ssrcs,
|
2018-07-17 16:03:46 +02:00
|
|
|
// TODO(holmer): Move states into RtpTransportControllerSend.
|
|
|
|
|
const std::map<uint32_t, RtpPayloadState>& states,
|
|
|
|
|
const RtpConfig& rtp_config,
|
2018-11-09 13:17:39 -08:00
|
|
|
int rtcp_report_interval_ms,
|
2018-07-17 16:03:46 +02:00
|
|
|
Transport* send_transport,
|
|
|
|
|
const RtpSenderObservers& observers,
|
2018-10-17 17:27:25 -07:00
|
|
|
std::unique_ptr<FecController> fec_controller,
|
2020-02-27 16:16:55 +01:00
|
|
|
const RtpSenderFrameEncryptionConfig& frame_encryption_config,
|
|
|
|
|
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer) = 0;
|
2018-07-19 10:34:38 +02:00
|
|
|
virtual void DestroyRtpVideoSender(
|
|
|
|
|
RtpVideoSenderInterface* rtp_video_sender) = 0;
|
2018-07-17 16:03:46 +02:00
|
|
|
|
2024-01-26 11:18:26 +01:00
|
|
|
// Register a specific RTP stream as sending. This means that the pacer and
|
|
|
|
|
// packet router can send packets using this RTP stream.
|
|
|
|
|
virtual void RegisterSendingRtpStream(RtpRtcpInterface& rtp_module) = 0;
|
|
|
|
|
// Pacer and PacketRouter stop using this RTP stream.
|
|
|
|
|
virtual void DeRegisterSendingRtpStream(RtpRtcpInterface& rtp_module) = 0;
|
|
|
|
|
|
2019-07-24 11:38:03 +02:00
|
|
|
virtual NetworkStateEstimateObserver* network_state_estimate_observer() = 0;
|
2017-04-24 05:53:20 -07:00
|
|
|
|
2019-07-24 14:52:55 +02:00
|
|
|
virtual RtpPacketSender* packet_sender() = 0;
|
2017-08-22 16:16:44 +02:00
|
|
|
|
|
|
|
|
// SetAllocatedSendBitrateLimits sets bitrates limits imposed by send codec
|
|
|
|
|
// settings.
|
2019-09-18 18:31:52 +02:00
|
|
|
virtual void SetAllocatedSendBitrateLimits(
|
|
|
|
|
BitrateAllocationLimits limits) = 0;
|
2018-02-15 16:51:41 +01:00
|
|
|
|
2024-02-07 14:16:20 +01:00
|
|
|
virtual void ReconfigureBandwidthEstimation(
|
|
|
|
|
const BandwidthEstimationSettings& settings) = 0;
|
|
|
|
|
|
2018-02-15 16:51:58 +01:00
|
|
|
virtual void SetPacingFactor(float pacing_factor) = 0;
|
|
|
|
|
virtual void SetQueueTimeLimit(int limit_ms) = 0;
|
|
|
|
|
|
2019-10-29 17:18:51 +01:00
|
|
|
virtual StreamFeedbackProvider* GetStreamFeedbackProvider() = 0;
|
2018-03-12 15:59:12 +01:00
|
|
|
virtual void RegisterTargetTransferRateObserver(
|
|
|
|
|
TargetTransferRateObserver* observer) = 0;
|
2018-02-21 13:01:55 +01:00
|
|
|
virtual void OnNetworkRouteChanged(
|
2022-05-17 11:48:46 +02:00
|
|
|
absl::string_view transport_name,
|
2018-02-21 13:01:55 +01:00
|
|
|
const rtc::NetworkRoute& network_route) = 0;
|
2018-02-15 16:51:41 +01:00
|
|
|
virtual void OnNetworkAvailability(bool network_available) = 0;
|
2023-05-17 13:25:39 +02:00
|
|
|
virtual NetworkLinkRtcpObserver* GetRtcpObserver() = 0;
|
2018-02-15 16:51:41 +01:00
|
|
|
virtual int64_t GetPacerQueuingDelayMs() const = 0;
|
2024-08-29 13:00:40 +00:00
|
|
|
virtual std::optional<Timestamp> GetFirstPacketTime() const = 0;
|
2018-02-15 16:51:41 +01:00
|
|
|
virtual void EnablePeriodicAlrProbing(bool enable) = 0;
|
2021-04-19 12:53:09 +02:00
|
|
|
|
|
|
|
|
// Called when a packet has been sent.
|
|
|
|
|
// The call should arrive on the network thread, but may not in all cases
|
|
|
|
|
// (some tests don't adhere to this). Implementations today should not block
|
|
|
|
|
// the calling thread or make assumptions about the thread context.
|
2018-02-15 16:51:41 +01:00
|
|
|
virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0;
|
2021-04-19 12:53:09 +02:00
|
|
|
|
2023-09-24 20:36:41 +00:00
|
|
|
virtual void OnReceivedPacket(const ReceivedPacket& received_packet) = 0;
|
|
|
|
|
|
2018-02-21 13:01:55 +01:00
|
|
|
virtual void SetSdpBitrateParameters(
|
|
|
|
|
const BitrateConstraints& constraints) = 0;
|
|
|
|
|
virtual void SetClientBitratePreferences(
|
2018-05-07 14:01:37 +02:00
|
|
|
const BitrateSettings& preferences) = 0;
|
2018-06-25 16:08:36 +02:00
|
|
|
|
2018-10-04 15:21:55 +02:00
|
|
|
virtual void OnTransportOverheadChanged(
|
|
|
|
|
size_t transport_overhead_per_packet) = 0;
|
2019-07-24 14:52:55 +02:00
|
|
|
|
|
|
|
|
virtual void AccountForAudioPacketsInPacedSender(bool account_for_audio) = 0;
|
2020-01-29 17:42:52 +01:00
|
|
|
virtual void IncludeOverheadInPacedSender() = 0;
|
2020-09-14 11:03:13 +02:00
|
|
|
|
|
|
|
|
virtual void EnsureStarted() = 0;
|
2024-06-17 17:28:40 +02:00
|
|
|
virtual NetworkControllerInterface* GetNetworkController() = 0;
|
2024-12-19 07:58:06 +00:00
|
|
|
|
|
|
|
|
// Called once it's known that the remote end supports RFC 8888.
|
|
|
|
|
virtual void EnableCongestionControlFeedbackAccordingToRfc8888() = 0;
|
2024-11-13 11:54:41 +00:00
|
|
|
// Count of RFC8888 feedback reports received
|
|
|
|
|
virtual int ReceivedCongestionControlFeedbackCount() const = 0;
|
2024-11-19 12:11:47 +00:00
|
|
|
// Count of transport-cc feedback reports received
|
|
|
|
|
virtual int ReceivedTransportCcFeedbackCount() const = 0;
|
2017-04-24 05:53:20 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_
|