Move RtpPacketSender and merge it with RtpPacketPacer.

This interface is intended to only handle packet-sending parts of the
paced sender.

See https://webrtc-review.googlesource.com/c/src/+/145212 for context

Bug: webrtc:10809
Change-Id: I93f0b40e1865665c2d436db67021350a0ed0687b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/145216
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28662}
This commit is contained in:
Erik Språng
2019-07-24 14:52:55 +02:00
committed by Commit Bot
parent 55c4a42099
commit aa59eca891
17 changed files with 100 additions and 106 deletions

View File

@ -15,7 +15,7 @@ rtc_source_set("rtp_rtcp_format") {
"include/rtcp_statistics.h",
"include/rtp_cvo.h",
"include/rtp_header_extension_map.h",
"include/rtp_packet_pacer.h",
"include/rtp_packet_sender.h",
"include/rtp_rtcp_defines.h",
"source/byte_io.h",
"source/rtcp_packet.h",

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 2019 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.
*/
#ifndef MODULES_RTP_RTCP_INCLUDE_RTP_PACKET_PACER_H_
#define MODULES_RTP_RTCP_INCLUDE_RTP_PACKET_PACER_H_
#include <memory>
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
namespace webrtc {
// Interface for a paced sender, as implemented in the pacing module.
// This intended to replace the RtpPacketSender interface defined in
// rtp_rtcp_defines.h
// TODO(bugs.webrtc.org/10633): Add things missing to this interface so that we
// can use multiple different pacer implementations, and stop inheriting from
// RtpPacketSender.
class RtpPacketPacer : public RtpPacketSender {
public:
RtpPacketPacer() = default;
~RtpPacketPacer() override = default;
// Insert packet into queue, for eventual transmission. Based on the type of
// the packet, it will prioritized and scheduled relative to other packets and
// the current target send rate.
virtual void EnqueuePacket(std::unique_ptr<RtpPacketToSend> packet) = 0;
};
} // namespace webrtc
#endif // MODULES_RTP_RTCP_INCLUDE_RTP_PACKET_PACER_H_

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2019 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.
*/
#ifndef MODULES_RTP_RTCP_INCLUDE_RTP_PACKET_SENDER_H_
#define MODULES_RTP_RTCP_INCLUDE_RTP_PACKET_SENDER_H_
#include <memory>
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
namespace webrtc {
// TODO(bugs.webrtc.org/10633): Remove Priority and InsertPacket when old pacer
// code path is gone.
class RtpPacketSender {
public:
virtual ~RtpPacketSender() = default;
// These are part of the legacy PacedSender interface and will be removed.
enum Priority {
kHighPriority = 0, // Pass through; will be sent immediately.
kNormalPriority = 2, // Put in back of the line.
kLowPriority = 3, // Put in back of the low priority line.
};
// Adds the packet information to the queue and call TimeToSendPacket when
// it's time to send.
virtual void InsertPacket(Priority priority,
uint32_t ssrc,
uint16_t sequence_number,
int64_t capture_time_ms,
size_t bytes,
bool retransmission) = 0;
// Insert packet into queue, for eventual transmission. Based on the type of
// the packet, it will be prioritized and scheduled relative to other packets
// and the current target send rate.
virtual void EnqueuePacket(std::unique_ptr<RtpPacketToSend> packet) = 0;
};
} // namespace webrtc
#endif // MODULES_RTP_RTCP_INCLUDE_RTP_PACKET_SENDER_H_

View File

@ -25,7 +25,7 @@
#include "modules/rtp_rtcp/include/flexfec_sender.h"
#include "modules/rtp_rtcp/include/receive_statistics.h"
#include "modules/rtp_rtcp/include/report_block_data.h"
#include "modules/rtp_rtcp/include/rtp_packet_pacer.h"
#include "modules/rtp_rtcp/include/rtp_packet_sender.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
#include "rtc_base/constructor_magic.h"
@ -89,7 +89,7 @@ class RtpRtcp : public Module, public RtcpFeedbackSenderInterface {
RemoteBitrateEstimator* remote_bitrate_estimator = nullptr;
// Spread any bursts of packets into smaller bursts to minimize packet loss.
RtpPacketPacer* paced_sender = nullptr;
RtpPacketSender* paced_sender = nullptr;
// Generate FlexFEC packets.
// TODO(brandtr): Remove when FlexfecSender is wired up to PacedSender.

View File

@ -340,37 +340,6 @@ class RtcpRttStats {
virtual ~RtcpRttStats() {}
};
// This class will be deprecated and replaced with RtpPacketPacer.
class RtpPacketSender {
public:
RtpPacketSender() {}
virtual ~RtpPacketSender() {}
// These are part of the legacy PacedSender interface and will be removed.
enum Priority {
kHighPriority = 0, // Pass through; will be sent immediately.
kNormalPriority = 2, // Put in back of the line.
kLowPriority = 3, // Put in back of the low priority line.
};
// Adds the packet information to the queue and call TimeToSendPacket when
// it's time to send.
virtual void InsertPacket(Priority priority,
uint32_t ssrc,
uint16_t sequence_number,
int64_t capture_time_ms,
size_t bytes,
bool retransmission) = 0;
// Currently audio traffic is not accounted by pacer and passed through.
// With the introduction of audio BWE audio traffic will be accounted for
// the pacer budget calculation. The audio traffic still will be injected
// at high priority.
// TODO(alexnarest): Make it pure virtual after rtp_sender_unittest will be
// updated to support it.
virtual void SetAccountForAudioPackets(bool account_for_audio) {}
};
class TransportSequenceNumberAllocator {
public:
TransportSequenceNumberAllocator() {}

View File

@ -213,7 +213,7 @@ RTPSender::RTPSender(
bool audio,
Clock* clock,
Transport* transport,
RtpPacketPacer* paced_sender,
RtpPacketSender* paced_sender,
absl::optional<uint32_t> flexfec_ssrc,
TransportSequenceNumberAllocator* sequence_number_allocator,
TransportFeedbackObserver* transport_feedback_observer,

View File

@ -24,7 +24,7 @@
#include "api/transport/webrtc_key_value_config.h"
#include "modules/rtp_rtcp/include/flexfec_sender.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
#include "modules/rtp_rtcp/include/rtp_packet_pacer.h"
#include "modules/rtp_rtcp/include/rtp_packet_sender.h"
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/rtp_packet_history.h"
@ -52,7 +52,7 @@ class RTPSender {
RTPSender(bool audio,
Clock* clock,
Transport* transport,
RtpPacketPacer* paced_sender,
RtpPacketSender* paced_sender,
absl::optional<uint32_t> flexfec_ssrc,
TransportSequenceNumberAllocator* sequence_number_allocator,
TransportFeedbackObserver* transport_feedback_callback,
@ -249,7 +249,7 @@ class RTPSender {
const absl::optional<uint32_t> flexfec_ssrc_;
RtpPacketPacer* const paced_sender_;
RtpPacketSender* const paced_sender_;
TransportSequenceNumberAllocator* const transport_sequence_number_allocator_;
TransportFeedbackObserver* const transport_feedback_observer_;
rtc::CriticalSection send_critsect_;

View File

@ -22,7 +22,7 @@
#include "modules/rtp_rtcp/include/rtp_cvo.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
#include "modules/rtp_rtcp/include/rtp_header_parser.h"
#include "modules/rtp_rtcp/include/rtp_packet_pacer.h"
#include "modules/rtp_rtcp/include/rtp_packet_sender.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
#include "modules/rtp_rtcp/source/rtp_format_video_generic.h"
@ -166,7 +166,7 @@ std::string ToFieldTrialString(TestConfig config) {
} // namespace
class MockRtpPacketPacer : public RtpPacketPacer {
class MockRtpPacketPacer : public RtpPacketSender {
public:
MockRtpPacketPacer() {}
virtual ~MockRtpPacketPacer() {}
@ -180,6 +180,15 @@ class MockRtpPacketPacer : public RtpPacketPacer {
int64_t capture_time_ms,
size_t bytes,
bool retransmission));
MOCK_METHOD2(CreateProbeCluster, void(int bitrate_bps, int cluster_id));
MOCK_METHOD0(Pause, void());
MOCK_METHOD0(Resume, void());
MOCK_METHOD1(SetCongestionWindow,
void(absl::optional<int64_t> congestion_window_bytes));
MOCK_METHOD1(UpdateOutstandingData, void(int64_t outstanding_bytes));
MOCK_METHOD1(SetAccountForAudioPackets, void(bool account_for_audio));
};
class MockTransportSequenceNumberAllocator