Make sure lost packets are removed from FakeNetworkPipe.
Bug: webrtc:10239 Change-Id: I4391b35151c4cd99a2671a5126fd2546f82192ff Reviewed-on: https://webrtc-review.googlesource.com/c/119641 Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org> Reviewed-by: Sebastian Jansson <srte@webrtc.org> Commit-Queue: Johannes Kron <kron@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26401}
This commit is contained in:
parent
fe490d8e69
commit
a8f9e25778
@ -145,29 +145,28 @@ std::vector<PacketDeliveryInfo> SimulatedNetwork::DequeueDeliverablePackets(
|
||||
if ((bursting_ && random_.Rand<double>() < prob_loss_bursting) ||
|
||||
(!bursting_ && random_.Rand<double>() < prob_start_bursting)) {
|
||||
bursting_ = true;
|
||||
continue;
|
||||
packet.arrival_time_us = PacketDeliveryInfo::kNotReceived;
|
||||
} else {
|
||||
bursting_ = false;
|
||||
}
|
||||
int64_t arrival_time_jitter_us = std::max(
|
||||
random_.Gaussian(config.queue_delay_ms * 1000,
|
||||
config.delay_standard_deviation_ms * 1000),
|
||||
0.0);
|
||||
|
||||
int64_t arrival_time_jitter_us = std::max(
|
||||
random_.Gaussian(config.queue_delay_ms * 1000,
|
||||
config.delay_standard_deviation_ms * 1000),
|
||||
0.0);
|
||||
|
||||
// If reordering is not allowed then adjust arrival_time_jitter
|
||||
// to make sure all packets are sent in order.
|
||||
if (!config.allow_reordering && !delay_link_.empty() &&
|
||||
packet.arrival_time_us + arrival_time_jitter_us <
|
||||
last_arrival_time_us) {
|
||||
arrival_time_jitter_us =
|
||||
last_arrival_time_us - packet.arrival_time_us;
|
||||
}
|
||||
packet.arrival_time_us += arrival_time_jitter_us;
|
||||
if (packet.arrival_time_us >= last_arrival_time_us) {
|
||||
last_arrival_time_us = packet.arrival_time_us;
|
||||
} else {
|
||||
needs_sort = true;
|
||||
// If reordering is not allowed then adjust arrival_time_jitter
|
||||
// to make sure all packets are sent in order.
|
||||
if (!config.allow_reordering && !delay_link_.empty() &&
|
||||
packet.arrival_time_us + arrival_time_jitter_us <
|
||||
last_arrival_time_us) {
|
||||
arrival_time_jitter_us =
|
||||
last_arrival_time_us - packet.arrival_time_us;
|
||||
}
|
||||
packet.arrival_time_us += arrival_time_jitter_us;
|
||||
if (packet.arrival_time_us >= last_arrival_time_us) {
|
||||
last_arrival_time_us = packet.arrival_time_us;
|
||||
} else {
|
||||
needs_sort = true;
|
||||
}
|
||||
}
|
||||
delay_link_.emplace_back(std::move(packet));
|
||||
}
|
||||
|
||||
@ -99,8 +99,11 @@ void EmulatedNetworkNode::Process(Timestamp at_time) {
|
||||
RTC_CHECK(receiver);
|
||||
// We don't want to keep the lock here. Otherwise we would get a deadlock if
|
||||
// the receiver tries to push a new packet.
|
||||
packet->packet.arrival_time = Timestamp::us(delivery_info.receive_time_us);
|
||||
receiver->OnPacketReceived(std::move(packet->packet));
|
||||
if (delivery_info.receive_time_us != PacketDeliveryInfo::kNotReceived) {
|
||||
packet->packet.arrival_time =
|
||||
Timestamp::us(delivery_info.receive_time_us);
|
||||
receiver->OnPacketReceived(std::move(packet->packet));
|
||||
}
|
||||
{
|
||||
rtc::CritScope crit(&lock_);
|
||||
while (!packets_.empty() && packets_.front().removed) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user