Removes rtp level keep alive support.
This is not used in practice as there's functionality on other levels that serves the same purpose. Bug: None Change-Id: I0488dc42459b07607363eba0f2b06f4c50f7cda4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/125520 Reviewed-by: Stefan Holmer <stefan@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27061}
This commit is contained in:
committed by
Commit Bot
parent
9ffb5df04e
commit
d155d686f8
@ -97,8 +97,6 @@ class RtpRtcp : public Module, public RtcpFeedbackSenderInterface {
|
||||
OverheadObserver* overhead_observer = nullptr;
|
||||
RtcpAckObserver* ack_observer = nullptr;
|
||||
|
||||
RtpKeepAliveConfig keepalive_config;
|
||||
|
||||
int rtcp_report_interval_ms = 0;
|
||||
|
||||
// Update network2 instead of pacer_exit field of video timing extension.
|
||||
|
||||
@ -97,7 +97,7 @@ enum RTCPPacketType : uint32_t {
|
||||
|
||||
enum KeyFrameRequestMethod { kKeyFrameReqPliRtcp, kKeyFrameReqFirRtcp };
|
||||
|
||||
enum RtpRtcpPacketType { kPacketRtp = 0, kPacketKeepAlive = 1 };
|
||||
enum RtpRtcpPacketType { kPacketRtp = 0 };
|
||||
|
||||
enum RtxMode {
|
||||
kRtxOff = 0x0,
|
||||
|
||||
@ -82,12 +82,10 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
|
||||
: kDefaultVideoReportInterval),
|
||||
this),
|
||||
clock_(configuration.clock),
|
||||
keepalive_config_(configuration.keepalive_config),
|
||||
last_bitrate_process_time_(clock_->TimeInMilliseconds()),
|
||||
last_rtt_process_time_(clock_->TimeInMilliseconds()),
|
||||
next_process_time_(clock_->TimeInMilliseconds() +
|
||||
kRtpRtcpMaxIdleTimeProcessMs),
|
||||
next_keepalive_time_(-1),
|
||||
packet_overhead_(28), // IPV4 UDP.
|
||||
nack_last_time_sent_full_ms_(0),
|
||||
nack_last_seq_number_sent_(0),
|
||||
@ -119,11 +117,6 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
|
||||
|
||||
// Make sure rtcp sender use same timestamp offset as rtp sender.
|
||||
rtcp_sender_.SetTimestampOffset(rtp_sender_->TimestampOffset());
|
||||
|
||||
if (keepalive_config_.timeout_interval_ms != -1) {
|
||||
next_keepalive_time_ =
|
||||
clock_->TimeInMilliseconds() + keepalive_config_.timeout_interval_ms;
|
||||
}
|
||||
}
|
||||
|
||||
// Set default packet size limit.
|
||||
@ -154,20 +147,6 @@ void ModuleRtpRtcpImpl::Process() {
|
||||
next_process_time_ =
|
||||
std::min(next_process_time_, now + kRtpRtcpBitrateProcessTimeMs);
|
||||
}
|
||||
if (keepalive_config_.timeout_interval_ms > 0 &&
|
||||
now >= next_keepalive_time_) {
|
||||
int64_t last_send_time_ms = rtp_sender_->LastTimestampTimeMs();
|
||||
// If no packet has been sent, |last_send_time_ms| will be 0, and so the
|
||||
// keep-alive will be triggered as expected.
|
||||
if (now >= last_send_time_ms + keepalive_config_.timeout_interval_ms) {
|
||||
rtp_sender_->SendKeepAlive(keepalive_config_.payload_type);
|
||||
next_keepalive_time_ = now + keepalive_config_.timeout_interval_ms;
|
||||
} else {
|
||||
next_keepalive_time_ =
|
||||
last_send_time_ms + keepalive_config_.timeout_interval_ms;
|
||||
}
|
||||
next_process_time_ = std::min(next_process_time_, next_keepalive_time_);
|
||||
}
|
||||
}
|
||||
|
||||
bool process_rtt = now >= last_rtt_process_time_ + kRtpRtcpRttProcessTimeMs;
|
||||
|
||||
@ -320,11 +320,9 @@ class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp {
|
||||
|
||||
Clock* const clock_;
|
||||
|
||||
const RtpKeepAliveConfig keepalive_config_;
|
||||
int64_t last_bitrate_process_time_;
|
||||
int64_t last_rtt_process_time_;
|
||||
int64_t next_process_time_;
|
||||
int64_t next_keepalive_time_;
|
||||
uint16_t packet_overhead_;
|
||||
|
||||
// Send side
|
||||
|
||||
@ -60,9 +60,7 @@ class SendTransport : public Transport {
|
||||
clock_(nullptr),
|
||||
delay_ms_(0),
|
||||
rtp_packets_sent_(0),
|
||||
rtcp_packets_sent_(0),
|
||||
keepalive_payload_type_(0),
|
||||
num_keepalive_sent_(0) {}
|
||||
rtcp_packets_sent_(0) {}
|
||||
|
||||
void SetRtpRtcpModule(ModuleRtpRtcpImpl* receiver) { receiver_ = receiver; }
|
||||
void SimulateNetworkDelay(int64_t delay_ms, SimulatedClock* clock) {
|
||||
@ -76,8 +74,6 @@ class SendTransport : public Transport {
|
||||
std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
|
||||
EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), len, &header));
|
||||
++rtp_packets_sent_;
|
||||
if (header.payloadType == keepalive_payload_type_)
|
||||
++num_keepalive_sent_;
|
||||
last_rtp_header_ = header;
|
||||
return true;
|
||||
}
|
||||
@ -94,10 +90,6 @@ class SendTransport : public Transport {
|
||||
++rtcp_packets_sent_;
|
||||
return true;
|
||||
}
|
||||
void SetKeepalivePayloadType(uint8_t payload_type) {
|
||||
keepalive_payload_type_ = payload_type;
|
||||
}
|
||||
size_t NumKeepaliveSent() { return num_keepalive_sent_; }
|
||||
size_t NumRtcpSent() { return rtcp_packets_sent_; }
|
||||
ModuleRtpRtcpImpl* receiver_;
|
||||
SimulatedClock* clock_;
|
||||
@ -106,8 +98,6 @@ class SendTransport : public Transport {
|
||||
size_t rtcp_packets_sent_;
|
||||
RTPHeader last_rtp_header_;
|
||||
std::vector<uint16_t> last_nack_list_;
|
||||
uint8_t keepalive_payload_type_;
|
||||
size_t num_keepalive_sent_;
|
||||
};
|
||||
|
||||
class RtpRtcpModule : public RtcpPacketTypeCounterObserver {
|
||||
@ -127,7 +117,6 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver {
|
||||
RtcpRttStatsTestImpl rtt_stats_;
|
||||
std::unique_ptr<ModuleRtpRtcpImpl> impl_;
|
||||
uint32_t remote_ssrc_;
|
||||
RtpKeepAliveConfig keepalive_config_;
|
||||
int rtcp_report_interval_ms_ = 0;
|
||||
|
||||
void SetRemoteSsrc(uint32_t ssrc) {
|
||||
@ -157,12 +146,6 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver {
|
||||
std::vector<uint16_t> LastNackListSent() {
|
||||
return transport_.last_nack_list_;
|
||||
}
|
||||
void SetKeepaliveConfigAndReset(const RtpKeepAliveConfig& config) {
|
||||
keepalive_config_ = config;
|
||||
// Need to create a new module impl, since it's configured at creation.
|
||||
CreateModuleImpl();
|
||||
transport_.SetKeepalivePayloadType(config.payload_type);
|
||||
}
|
||||
void SetRtcpReportIntervalAndReset(int rtcp_report_interval_ms) {
|
||||
rtcp_report_interval_ms_ = rtcp_report_interval_ms;
|
||||
CreateModuleImpl();
|
||||
@ -177,7 +160,6 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver {
|
||||
config.receive_statistics = receive_statistics_.get();
|
||||
config.rtcp_packet_type_counter_observer = this;
|
||||
config.rtt_stats = &rtt_stats_;
|
||||
config.keepalive_config = keepalive_config_;
|
||||
config.rtcp_report_interval_ms = rtcp_report_interval_ms_;
|
||||
|
||||
impl_.reset(new ModuleRtpRtcpImpl(config));
|
||||
@ -569,60 +551,6 @@ TEST_F(RtpRtcpImplTest, UniqueNackRequests) {
|
||||
EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent());
|
||||
}
|
||||
|
||||
TEST_F(RtpRtcpImplTest, SendsKeepaliveAfterTimout) {
|
||||
const int kTimeoutMs = 1500;
|
||||
|
||||
RtpKeepAliveConfig config;
|
||||
config.timeout_interval_ms = kTimeoutMs;
|
||||
|
||||
// Recreate sender impl with new configuration, and redo setup.
|
||||
sender_.SetKeepaliveConfigAndReset(config);
|
||||
SetUp();
|
||||
|
||||
// Initial process call.
|
||||
sender_.impl_->Process();
|
||||
EXPECT_EQ(0U, sender_.transport_.NumKeepaliveSent());
|
||||
|
||||
// After one time, a single keep-alive packet should be sent.
|
||||
clock_.AdvanceTimeMilliseconds(kTimeoutMs);
|
||||
sender_.impl_->Process();
|
||||
EXPECT_EQ(1U, sender_.transport_.NumKeepaliveSent());
|
||||
|
||||
// Process for the same timestamp again, no new packet should be sent.
|
||||
sender_.impl_->Process();
|
||||
EXPECT_EQ(1U, sender_.transport_.NumKeepaliveSent());
|
||||
|
||||
// Move ahead to the last ms before a keep-alive is expected, no action.
|
||||
clock_.AdvanceTimeMilliseconds(kTimeoutMs - 1);
|
||||
sender_.impl_->Process();
|
||||
EXPECT_EQ(1U, sender_.transport_.NumKeepaliveSent());
|
||||
|
||||
// Move the final ms, timeout relative last KA. Should create new keep-alive.
|
||||
clock_.AdvanceTimeMilliseconds(1);
|
||||
sender_.impl_->Process();
|
||||
EXPECT_EQ(2U, sender_.transport_.NumKeepaliveSent());
|
||||
|
||||
// Move ahead to the last ms before Christmas.
|
||||
clock_.AdvanceTimeMilliseconds(kTimeoutMs - 1);
|
||||
sender_.impl_->Process();
|
||||
EXPECT_EQ(2U, sender_.transport_.NumKeepaliveSent());
|
||||
|
||||
// Send actual payload data, no keep-alive expected.
|
||||
SendFrame(&sender_, sender_video_.get(), 0);
|
||||
sender_.impl_->Process();
|
||||
EXPECT_EQ(2U, sender_.transport_.NumKeepaliveSent());
|
||||
|
||||
// Move ahead as far as possible again, timeout now relative payload. No KA.
|
||||
clock_.AdvanceTimeMilliseconds(kTimeoutMs - 1);
|
||||
sender_.impl_->Process();
|
||||
EXPECT_EQ(2U, sender_.transport_.NumKeepaliveSent());
|
||||
|
||||
// Timeout relative payload, send new keep-alive.
|
||||
clock_.AdvanceTimeMilliseconds(1);
|
||||
sender_.impl_->Process();
|
||||
EXPECT_EQ(3U, sender_.transport_.NumKeepaliveSent());
|
||||
}
|
||||
|
||||
TEST_F(RtpRtcpImplTest, ConfigurableRtcpReportInterval) {
|
||||
const int kVideoReportInterval = 3000;
|
||||
|
||||
|
||||
@ -1229,21 +1229,6 @@ int64_t RTPSender::LastTimestampTimeMs() const {
|
||||
return last_timestamp_time_ms_;
|
||||
}
|
||||
|
||||
void RTPSender::SendKeepAlive(uint8_t payload_type) {
|
||||
std::unique_ptr<RtpPacketToSend> packet = AllocatePacket();
|
||||
packet->SetPayloadType(payload_type);
|
||||
// Set marker bit and timestamps in the same manner as plain padding packets.
|
||||
packet->SetMarker(false);
|
||||
{
|
||||
rtc::CritScope lock(&send_critsect_);
|
||||
packet->SetTimestamp(last_rtp_timestamp_);
|
||||
packet->set_capture_time_ms(capture_time_ms_);
|
||||
}
|
||||
AssignSequenceNumber(packet.get());
|
||||
SendToNetwork(std::move(packet), StorageType::kDontRetransmit,
|
||||
RtpPacketSender::Priority::kLowPriority);
|
||||
}
|
||||
|
||||
void RTPSender::SetRtt(int64_t rtt_ms) {
|
||||
packet_history_.SetRtt(rtt_ms);
|
||||
flexfec_packet_history_.SetRtt(rtt_ms);
|
||||
|
||||
@ -171,7 +171,6 @@ class RTPSender {
|
||||
RtpState GetRtxRtpState() const;
|
||||
|
||||
int64_t LastTimestampTimeMs() const;
|
||||
void SendKeepAlive(uint8_t payload_type);
|
||||
|
||||
void SetRtt(int64_t rtt_ms);
|
||||
|
||||
|
||||
@ -1759,40 +1759,6 @@ TEST_P(RtpSenderTest, DoesNotUpdateOverheadOnEqualSize) {
|
||||
SendGenericPacket();
|
||||
}
|
||||
|
||||
TEST_P(RtpSenderTest, SendsKeepAlive) {
|
||||
MockTransport transport;
|
||||
rtp_sender_.reset(
|
||||
new RTPSender(false, &fake_clock_, &transport, nullptr, absl::nullopt,
|
||||
nullptr, nullptr, nullptr, nullptr, &mock_rtc_event_log_,
|
||||
nullptr, &retransmission_rate_limiter_, nullptr, false,
|
||||
nullptr, false, false, FieldTrialBasedConfig()));
|
||||
rtp_sender_->SetSequenceNumber(kSeqNum);
|
||||
rtp_sender_->SetTimestampOffset(0);
|
||||
rtp_sender_->SetSSRC(kSsrc);
|
||||
|
||||
const uint8_t kKeepalivePayloadType = 20;
|
||||
RTC_CHECK_NE(kKeepalivePayloadType, kPayload);
|
||||
|
||||
EXPECT_CALL(transport, SendRtp(_, _, _))
|
||||
.WillOnce(
|
||||
Invoke([&kKeepalivePayloadType](const uint8_t* packet, size_t len,
|
||||
const PacketOptions& options) {
|
||||
webrtc::RTPHeader rtp_header;
|
||||
RtpUtility::RtpHeaderParser parser(packet, len);
|
||||
EXPECT_TRUE(parser.Parse(&rtp_header, nullptr));
|
||||
EXPECT_FALSE(rtp_header.markerBit);
|
||||
EXPECT_EQ(0U, rtp_header.paddingLength);
|
||||
EXPECT_EQ(kKeepalivePayloadType, rtp_header.payloadType);
|
||||
EXPECT_EQ(kSeqNum, rtp_header.sequenceNumber);
|
||||
EXPECT_EQ(kSsrc, rtp_header.ssrc);
|
||||
EXPECT_EQ(0u, len - rtp_header.headerLength);
|
||||
return true;
|
||||
}));
|
||||
|
||||
rtp_sender_->SendKeepAlive(kKeepalivePayloadType);
|
||||
EXPECT_EQ(kSeqNum + 1, rtp_sender_->SequenceNumber());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(WithAndWithoutOverhead,
|
||||
RtpSenderTest,
|
||||
::testing::Bool());
|
||||
|
||||
Reference in New Issue
Block a user