Increase the send-time history to 60 seconds.
This helps us avoid time-outs on really bad networks with long queues. Also adding periodic logging of the fake network pipe's queue in milliseconds. BUG=webrtc:5079 Review-Url: https://codereview.webrtc.org/2687013005 Cr-Commit-Position: refs/heads/master@{#16532}
This commit is contained in:
parent
4ca18696c5
commit
e9ad271db4
@ -24,7 +24,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
const int64_t kNoTimestamp = -1;
|
||||
const int64_t kSendTimeHistoryWindowMs = 10000;
|
||||
const int64_t kSendTimeHistoryWindowMs = 60000;
|
||||
const int64_t kBaseTimestampScaleFactor =
|
||||
rtcp::TransportFeedback::kDeltaScaleFactor * (1 << 8);
|
||||
const int64_t kBaseTimestampRangeSizeUs = kBaseTimestampScaleFactor * (1 << 24);
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/safe_conversions.h"
|
||||
#include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h"
|
||||
#include "webrtc/modules/congestion_controller/transport_feedback_adapter.h"
|
||||
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
@ -128,6 +129,72 @@ TEST_F(TransportFeedbackAdapterTest, AdaptsFeedbackAndPopulatesSendTimes) {
|
||||
ComparePacketVectors(packets, adapter_->GetTransportFeedbackVector());
|
||||
}
|
||||
|
||||
TEST_F(TransportFeedbackAdapterTest, Timeout) {
|
||||
const int64_t kFeedbackTimeoutMs = 60001;
|
||||
{
|
||||
std::vector<PacketInfo> packets;
|
||||
packets.push_back(PacketInfo(100, 200, 0, 1500, 0));
|
||||
packets.push_back(PacketInfo(110, 210, 1, 1500, 0));
|
||||
packets.push_back(PacketInfo(120, 220, 2, 1500, 0));
|
||||
packets.push_back(PacketInfo(130, 230, 3, 1500, 1));
|
||||
packets.push_back(PacketInfo(140, 240, 4, 1500, 1));
|
||||
|
||||
for (const PacketInfo& packet : packets)
|
||||
OnSentPacket(packet);
|
||||
|
||||
rtcp::TransportFeedback feedback;
|
||||
feedback.SetBase(packets[0].sequence_number,
|
||||
packets[0].arrival_time_ms * 1000);
|
||||
|
||||
for (const PacketInfo& packet : packets) {
|
||||
EXPECT_TRUE(feedback.AddReceivedPacket(packet.sequence_number,
|
||||
packet.arrival_time_ms * 1000));
|
||||
}
|
||||
|
||||
feedback.Build();
|
||||
|
||||
clock_.AdvanceTimeMilliseconds(kFeedbackTimeoutMs);
|
||||
PacketInfo later_packet(kFeedbackTimeoutMs + 140, kFeedbackTimeoutMs + 240,
|
||||
5, 1500, 1);
|
||||
OnSentPacket(later_packet);
|
||||
|
||||
adapter_->OnTransportFeedback(feedback);
|
||||
EXPECT_EQ(0, rtc::checked_cast<int>(
|
||||
adapter_->GetTransportFeedbackVector().size()));
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<PacketInfo> packets;
|
||||
packets.push_back(PacketInfo(100, 200, 0, 1500, 0));
|
||||
packets.push_back(PacketInfo(110, 210, 1, 1500, 0));
|
||||
packets.push_back(PacketInfo(120, 220, 2, 1500, 0));
|
||||
packets.push_back(PacketInfo(130, 230, 3, 1500, 1));
|
||||
packets.push_back(PacketInfo(140, 240, 4, 1500, 1));
|
||||
|
||||
for (const PacketInfo& packet : packets)
|
||||
OnSentPacket(packet);
|
||||
|
||||
rtcp::TransportFeedback feedback;
|
||||
feedback.SetBase(packets[0].sequence_number,
|
||||
packets[0].arrival_time_ms * 1000);
|
||||
|
||||
for (const PacketInfo& packet : packets) {
|
||||
EXPECT_TRUE(feedback.AddReceivedPacket(packet.sequence_number,
|
||||
packet.arrival_time_ms * 1000));
|
||||
}
|
||||
|
||||
feedback.Build();
|
||||
|
||||
clock_.AdvanceTimeMilliseconds(kFeedbackTimeoutMs - 1);
|
||||
PacketInfo later_packet(kFeedbackTimeoutMs + 140, kFeedbackTimeoutMs + 240,
|
||||
5, 1500, 1);
|
||||
OnSentPacket(later_packet);
|
||||
|
||||
adapter_->OnTransportFeedback(feedback);
|
||||
ComparePacketVectors(packets, adapter_->GetTransportFeedbackVector());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(TransportFeedbackAdapterTest, HandlesDroppedPackets) {
|
||||
std::vector<PacketInfo> packets;
|
||||
packets.push_back(PacketInfo(100, 200, 0, 1500, 1));
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/call/call.h"
|
||||
#include "webrtc/system_wrappers/include/clock.h"
|
||||
|
||||
@ -37,7 +38,8 @@ FakeNetworkPipe::FakeNetworkPipe(Clock* clock,
|
||||
sent_packets_(0),
|
||||
total_packet_delay_(0),
|
||||
bursting_(false),
|
||||
next_process_time_(clock_->TimeInMilliseconds()) {
|
||||
next_process_time_(clock_->TimeInMilliseconds()),
|
||||
last_log_time_(clock_->TimeInMilliseconds()) {
|
||||
double prob_loss = config.loss_percent / 100.0;
|
||||
if (config_.avg_burst_loss_length == -1) {
|
||||
// Uniform loss
|
||||
@ -134,6 +136,14 @@ void FakeNetworkPipe::Process() {
|
||||
std::queue<NetworkPacket*> packets_to_deliver;
|
||||
{
|
||||
rtc::CritScope crit(&lock_);
|
||||
if (time_now - last_log_time_ > 5000) {
|
||||
int64_t queueing_delay_ms = 0;
|
||||
if (!capacity_link_.empty()) {
|
||||
queueing_delay_ms = time_now - capacity_link_.front()->send_time();
|
||||
}
|
||||
LOG(LS_INFO) << "Network queue: " << queueing_delay_ms << " ms.";
|
||||
last_log_time_ = time_now;
|
||||
}
|
||||
// Check the capacity link first.
|
||||
while (!capacity_link_.empty() &&
|
||||
time_now >= capacity_link_.front()->arrival_time()) {
|
||||
|
||||
@ -146,6 +146,8 @@ class FakeNetworkPipe {
|
||||
|
||||
int64_t next_process_time_;
|
||||
|
||||
int64_t last_log_time_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(FakeNetworkPipe);
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user