in RTPSender disallow enabling misconfigured rtx
Bug: None Change-Id: Id94771626ef723212e4d92d9093af3ec9e647990 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251780 Auto-Submit: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36020}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
419344264c
commit
27d5f14cf2
@ -258,6 +258,12 @@ size_t RTPSender::MaxRtpPacketSize() const {
|
|||||||
|
|
||||||
void RTPSender::SetRtxStatus(int mode) {
|
void RTPSender::SetRtxStatus(int mode) {
|
||||||
MutexLock lock(&send_mutex_);
|
MutexLock lock(&send_mutex_);
|
||||||
|
if (mode != kRtxOff &&
|
||||||
|
(!rtx_ssrc_.has_value() || rtx_payload_type_map_.empty())) {
|
||||||
|
RTC_LOG(LS_ERROR)
|
||||||
|
<< "Failed to enable RTX without RTX SSRC or payload types.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
rtx_ = mode;
|
rtx_ = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,6 +459,7 @@ std::vector<std::unique_ptr<RtpPacketToSend>> RTPSender::GeneratePadding(
|
|||||||
}
|
}
|
||||||
|
|
||||||
RTC_DCHECK(rtx_ssrc_);
|
RTC_DCHECK(rtx_ssrc_);
|
||||||
|
RTC_DCHECK(!rtx_payload_type_map_.empty());
|
||||||
padding_packet->SetSsrc(*rtx_ssrc_);
|
padding_packet->SetSsrc(*rtx_ssrc_);
|
||||||
padding_packet->SetPayloadType(rtx_payload_type_map_.begin()->second);
|
padding_packet->SetPayloadType(rtx_payload_type_map_.begin()->second);
|
||||||
}
|
}
|
||||||
|
@ -443,6 +443,39 @@ TEST_F(RtpSenderTest, NoPaddingAsFirstPacketWithoutBweExtensions) {
|
|||||||
IsEmpty());
|
IsEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(RtpSenderTest, RequiresRtxSsrcToEnableRtx) {
|
||||||
|
RtpRtcpInterface::Configuration config = GetDefaultConfig();
|
||||||
|
config.rtx_send_ssrc = absl::nullopt;
|
||||||
|
RTPSender rtp_sender(config, packet_history_.get(), config.paced_sender);
|
||||||
|
rtp_sender.SetRtxPayloadType(kRtxPayload, kPayload);
|
||||||
|
|
||||||
|
rtp_sender.SetRtxStatus(kRtxRetransmitted);
|
||||||
|
|
||||||
|
EXPECT_EQ(rtp_sender.RtxStatus(), kRtxOff);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(RtpSenderTest, RequiresRtxPayloadTypesToEnableRtx) {
|
||||||
|
RtpRtcpInterface::Configuration config = GetDefaultConfig();
|
||||||
|
config.rtx_send_ssrc = kRtxSsrc;
|
||||||
|
RTPSender rtp_sender(config, packet_history_.get(), config.paced_sender);
|
||||||
|
|
||||||
|
rtp_sender.SetRtxStatus(kRtxRetransmitted);
|
||||||
|
|
||||||
|
EXPECT_EQ(rtp_sender.RtxStatus(), kRtxOff);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(RtpSenderTest, CanEnableRtxWhenRtxSsrcAndPayloadTypeAreConfigured) {
|
||||||
|
RtpRtcpInterface::Configuration config = GetDefaultConfig();
|
||||||
|
config.rtx_send_ssrc = kRtxSsrc;
|
||||||
|
RTPSender rtp_sender(config, packet_history_.get(), config.paced_sender);
|
||||||
|
rtp_sender.SetRtxPayloadType(kRtxPayload, kPayload);
|
||||||
|
|
||||||
|
ASSERT_EQ(rtp_sender.RtxStatus(), kRtxOff);
|
||||||
|
rtp_sender.SetRtxStatus(kRtxRetransmitted);
|
||||||
|
|
||||||
|
EXPECT_EQ(rtp_sender.RtxStatus(), kRtxRetransmitted);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(RtpSenderTest, AllowPaddingAsFirstPacketOnRtxWithTransportCc) {
|
TEST_F(RtpSenderTest, AllowPaddingAsFirstPacketOnRtxWithTransportCc) {
|
||||||
ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension(
|
ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension(
|
||||||
TransportSequenceNumber::Uri(), kTransportSequenceNumberExtensionId));
|
TransportSequenceNumber::Uri(), kTransportSequenceNumberExtensionId));
|
||||||
@ -1049,8 +1082,8 @@ TEST_F(RtpSenderTest, GeneratePaddingResendsOldPacketsWithRtx) {
|
|||||||
// Min requested size in order to use RTX payload.
|
// Min requested size in order to use RTX payload.
|
||||||
const size_t kMinPaddingSize = 50;
|
const size_t kMinPaddingSize = 50;
|
||||||
|
|
||||||
rtp_sender_->SetRtxStatus(kRtxRetransmitted | kRtxRedundantPayloads);
|
|
||||||
rtp_sender_->SetRtxPayloadType(kRtxPayload, kPayload);
|
rtp_sender_->SetRtxPayloadType(kRtxPayload, kPayload);
|
||||||
|
rtp_sender_->SetRtxStatus(kRtxRetransmitted | kRtxRedundantPayloads);
|
||||||
packet_history_->SetStorePacketsStatus(
|
packet_history_->SetStorePacketsStatus(
|
||||||
RtpPacketHistory::StorageMode::kStoreAndCull, 1);
|
RtpPacketHistory::StorageMode::kStoreAndCull, 1);
|
||||||
|
|
||||||
@ -1099,8 +1132,8 @@ TEST_F(RtpSenderTest, LimitsPayloadPaddingSize) {
|
|||||||
const double kFactor = 2.0;
|
const double kFactor = 2.0;
|
||||||
field_trials_.SetMaxPaddingFactor(kFactor);
|
field_trials_.SetMaxPaddingFactor(kFactor);
|
||||||
SetUpRtpSender(false, false, nullptr);
|
SetUpRtpSender(false, false, nullptr);
|
||||||
rtp_sender_->SetRtxStatus(kRtxRetransmitted | kRtxRedundantPayloads);
|
|
||||||
rtp_sender_->SetRtxPayloadType(kRtxPayload, kPayload);
|
rtp_sender_->SetRtxPayloadType(kRtxPayload, kPayload);
|
||||||
|
rtp_sender_->SetRtxStatus(kRtxRetransmitted | kRtxRedundantPayloads);
|
||||||
packet_history_->SetStorePacketsStatus(
|
packet_history_->SetStorePacketsStatus(
|
||||||
RtpPacketHistory::StorageMode::kStoreAndCull, 1);
|
RtpPacketHistory::StorageMode::kStoreAndCull, 1);
|
||||||
|
|
||||||
@ -1201,6 +1234,7 @@ TEST_F(RtpSenderTest, SupportsPadding) {
|
|||||||
if (redundant_payloads) {
|
if (redundant_payloads) {
|
||||||
rtx_mode |= kRtxRedundantPayloads;
|
rtx_mode |= kRtxRedundantPayloads;
|
||||||
}
|
}
|
||||||
|
rtp_sender_->SetRtxPayloadType(kRtxPayload, kPayload);
|
||||||
rtp_sender_->SetRtxStatus(rtx_mode);
|
rtp_sender_->SetRtxStatus(rtx_mode);
|
||||||
|
|
||||||
for (auto extension_uri : kBweExtensionUris) {
|
for (auto extension_uri : kBweExtensionUris) {
|
||||||
|
Reference in New Issue
Block a user