2017-03-27 05:36:15 -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_H_
|
|
|
|
|
#define CALL_RTP_TRANSPORT_CONTROLLER_SEND_H_
|
2017-03-27 05:36:15 -07:00
|
|
|
|
2018-02-21 13:02:51 +01:00
|
|
|
#include <map>
|
2018-02-22 11:10:18 +01:00
|
|
|
#include <memory>
|
2018-02-21 13:01:55 +01:00
|
|
|
#include <string>
|
2018-07-17 16:03:46 +02:00
|
|
|
#include <vector>
|
2018-02-21 13:01:55 +01:00
|
|
|
|
2018-05-18 18:05:10 +02:00
|
|
|
#include "api/transport/network_control.h"
|
2018-02-21 13:01:55 +01:00
|
|
|
#include "call/rtp_bitrate_configurator.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "call/rtp_transport_controller_send_interface.h"
|
2018-07-19 10:34:38 +02:00
|
|
|
#include "call/rtp_video_sender.h"
|
2017-09-15 13:58:09 +02:00
|
|
|
#include "common_types.h" // NOLINT(build/include)
|
2018-02-28 16:48:26 +01:00
|
|
|
#include "modules/congestion_controller/include/send_side_congestion_controller_interface.h"
|
2017-10-31 10:19:10 +01:00
|
|
|
#include "modules/pacing/packet_router.h"
|
2018-02-22 11:10:18 +01:00
|
|
|
#include "modules/utility/include/process_thread.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/constructormagic.h"
|
2018-02-21 13:02:51 +01:00
|
|
|
#include "rtc_base/networkroute.h"
|
2018-05-04 14:08:15 +02:00
|
|
|
#include "rtc_base/task_queue.h"
|
2017-04-24 05:53:20 -07:00
|
|
|
|
2017-03-27 05:36:15 -07:00
|
|
|
namespace webrtc {
|
2017-04-24 05:53:20 -07:00
|
|
|
class Clock;
|
|
|
|
|
class RtcEventLog;
|
2017-03-27 05:36:15 -07:00
|
|
|
|
2017-04-24 05:53:20 -07:00
|
|
|
// TODO(nisse): When we get the underlying transports here, we should
|
|
|
|
|
// have one object implementing RtpTransportControllerSendInterface
|
|
|
|
|
// per transport, sharing the same congestion controller.
|
2018-03-16 15:36:37 +01:00
|
|
|
class RtpTransportControllerSend final
|
|
|
|
|
: public RtpTransportControllerSendInterface,
|
|
|
|
|
public NetworkChangedObserver {
|
2017-03-27 05:36:15 -07:00
|
|
|
public:
|
2018-05-18 18:05:10 +02:00
|
|
|
RtpTransportControllerSend(
|
|
|
|
|
Clock* clock,
|
|
|
|
|
RtcEventLog* event_log,
|
|
|
|
|
NetworkControllerFactoryInterface* controller_factory,
|
|
|
|
|
const BitrateConstraints& bitrate_config);
|
2018-02-21 13:01:55 +01:00
|
|
|
~RtpTransportControllerSend() override;
|
2018-03-12 15:59:12 +01:00
|
|
|
|
2018-07-19 10:34:38 +02:00
|
|
|
RtpVideoSenderInterface* CreateRtpVideoSender(
|
2018-07-17 16:03:46 +02:00
|
|
|
const std::vector<uint32_t>& ssrcs,
|
|
|
|
|
std::map<uint32_t, RtpState> suspended_ssrcs,
|
|
|
|
|
const std::map<uint32_t, RtpPayloadState>&
|
|
|
|
|
states, // move states into RtpTransportControllerSend
|
|
|
|
|
const RtpConfig& rtp_config,
|
|
|
|
|
const RtcpConfig& rtcp_config,
|
|
|
|
|
Transport* send_transport,
|
|
|
|
|
const RtpSenderObservers& observers,
|
|
|
|
|
RtcEventLog* event_log) override;
|
2018-07-19 10:34:38 +02:00
|
|
|
void DestroyRtpVideoSender(
|
|
|
|
|
RtpVideoSenderInterface* rtp_video_sender) override;
|
2018-07-17 16:03:46 +02:00
|
|
|
|
2018-03-12 15:59:12 +01:00
|
|
|
// Implements NetworkChangedObserver interface.
|
|
|
|
|
void OnNetworkChanged(uint32_t bitrate_bps,
|
|
|
|
|
uint8_t fraction_loss,
|
|
|
|
|
int64_t rtt_ms,
|
|
|
|
|
int64_t probing_interval_ms) override;
|
|
|
|
|
|
2017-04-24 05:53:20 -07:00
|
|
|
// Implements RtpTransportControllerSendInterface
|
2018-05-04 14:08:15 +02:00
|
|
|
rtc::TaskQueue* GetWorkerQueue() override;
|
2017-05-31 02:24:52 -07:00
|
|
|
PacketRouter* packet_router() override;
|
2018-02-15 16:51:58 +01:00
|
|
|
|
2017-05-31 02:24:52 -07:00
|
|
|
TransportFeedbackObserver* transport_feedback_observer() override;
|
|
|
|
|
RtpPacketSender* packet_sender() override;
|
2017-08-09 06:42:32 -07:00
|
|
|
const RtpKeepAliveConfig& keepalive_config() const override;
|
|
|
|
|
|
2017-08-22 16:16:44 +02:00
|
|
|
void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps,
|
2018-02-28 17:04:18 +01:00
|
|
|
int max_padding_bitrate_bps,
|
2018-03-06 18:29:22 +01:00
|
|
|
int max_total_bitrate_bps) override;
|
2017-08-22 16:16:44 +02:00
|
|
|
|
2017-08-09 06:42:32 -07:00
|
|
|
void SetKeepAliveConfig(const RtpKeepAliveConfig& config);
|
2018-02-15 16:51:58 +01:00
|
|
|
void SetPacingFactor(float pacing_factor) override;
|
|
|
|
|
void SetQueueTimeLimit(int limit_ms) override;
|
2018-02-15 16:51:41 +01:00
|
|
|
CallStatsObserver* GetCallStatsObserver() override;
|
|
|
|
|
void RegisterPacketFeedbackObserver(
|
|
|
|
|
PacketFeedbackObserver* observer) override;
|
|
|
|
|
void DeRegisterPacketFeedbackObserver(
|
|
|
|
|
PacketFeedbackObserver* observer) override;
|
2018-03-12 15:59:12 +01:00
|
|
|
void RegisterTargetTransferRateObserver(
|
|
|
|
|
TargetTransferRateObserver* observer) override;
|
2018-02-21 13:01:55 +01:00
|
|
|
void OnNetworkRouteChanged(const std::string& transport_name,
|
|
|
|
|
const rtc::NetworkRoute& network_route) override;
|
2018-02-15 16:51:41 +01:00
|
|
|
void OnNetworkAvailability(bool network_available) override;
|
|
|
|
|
RtcpBandwidthObserver* GetBandwidthObserver() override;
|
|
|
|
|
int64_t GetPacerQueuingDelayMs() const override;
|
|
|
|
|
int64_t GetFirstPacketTimeMs() const override;
|
2018-03-21 12:48:43 +01:00
|
|
|
void SetPerPacketFeedbackAvailable(bool available) override;
|
2018-02-15 16:51:41 +01:00
|
|
|
void EnablePeriodicAlrProbing(bool enable) override;
|
|
|
|
|
void OnSentPacket(const rtc::SentPacket& sent_packet) override;
|
2017-04-24 05:53:20 -07:00
|
|
|
|
2018-02-21 13:01:55 +01:00
|
|
|
void SetSdpBitrateParameters(const BitrateConstraints& constraints) override;
|
2018-05-07 14:01:37 +02:00
|
|
|
void SetClientBitratePreferences(const BitrateSettings& preferences) override;
|
2018-02-21 13:01:55 +01:00
|
|
|
|
2018-06-25 16:08:36 +02:00
|
|
|
void SetAllocatedBitrateWithoutFeedback(uint32_t bitrate_bps) override;
|
|
|
|
|
|
2017-04-24 05:53:20 -07:00
|
|
|
private:
|
2018-03-12 15:59:12 +01:00
|
|
|
const Clock* const clock_;
|
2017-04-24 05:53:20 -07:00
|
|
|
PacketRouter packet_router_;
|
2018-07-19 10:34:38 +02:00
|
|
|
std::vector<std::unique_ptr<RtpVideoSenderInterface>> video_rtp_senders_;
|
2017-08-22 16:16:44 +02:00
|
|
|
PacedSender pacer_;
|
2017-08-09 06:42:32 -07:00
|
|
|
RtpKeepAliveConfig keepalive_;
|
2018-02-21 13:01:55 +01:00
|
|
|
RtpBitrateConfigurator bitrate_configurator_;
|
2018-02-21 13:02:51 +01:00
|
|
|
std::map<std::string, rtc::NetworkRoute> network_routes_;
|
2018-02-22 11:10:18 +01:00
|
|
|
const std::unique_ptr<ProcessThread> process_thread_;
|
2018-03-12 15:59:12 +01:00
|
|
|
rtc::CriticalSection observer_crit_;
|
|
|
|
|
TargetTransferRateObserver* observer_ RTC_GUARDED_BY(observer_crit_);
|
2018-05-07 16:33:50 +02:00
|
|
|
std::unique_ptr<SendSideCongestionControllerInterface> send_side_cc_;
|
2018-07-17 16:03:46 +02:00
|
|
|
RateLimiter retransmission_rate_limiter_;
|
|
|
|
|
|
2018-05-04 14:08:15 +02:00
|
|
|
// TODO(perkj): |task_queue_| is supposed to replace |process_thread_|.
|
|
|
|
|
// |task_queue_| is defined last to ensure all pending tasks are cancelled
|
|
|
|
|
// and deleted before any other members.
|
|
|
|
|
rtc::TaskQueue task_queue_;
|
2017-04-24 05:53:20 -07:00
|
|
|
RTC_DISALLOW_COPY_AND_ASSIGN(RtpTransportControllerSend);
|
2017-03-27 05:36:15 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // CALL_RTP_TRANSPORT_CONTROLLER_SEND_H_
|