mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Add a function to check if the packet in a PacketResult
has been received.
Bug: webrtc:12839 Change-Id: I0ee2b8fa0dfffd2bda2cba0e360b5f5815bbca9d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221102 Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org> Commit-Queue: Fanny Linderborg <linderborg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34220}
This commit is contained in:
parent
47f5f8c160
commit
096014345f
7 changed files with 11 additions and 9 deletions
|
@ -48,7 +48,7 @@ std::vector<PacketResult> TransportPacketsFeedback::ReceivedWithSendInfo()
|
|||
const {
|
||||
std::vector<PacketResult> res;
|
||||
for (const PacketResult& fb : packet_feedbacks) {
|
||||
if (fb.receive_time.IsFinite()) {
|
||||
if (fb.IsReceived()) {
|
||||
res.push_back(fb);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ std::vector<PacketResult> TransportPacketsFeedback::ReceivedWithSendInfo()
|
|||
std::vector<PacketResult> TransportPacketsFeedback::LostWithSendInfo() const {
|
||||
std::vector<PacketResult> res;
|
||||
for (const PacketResult& fb : packet_feedbacks) {
|
||||
if (fb.receive_time.IsPlusInfinity()) {
|
||||
if (!fb.IsReceived()) {
|
||||
res.push_back(fb);
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ std::vector<PacketResult> TransportPacketsFeedback::SortedByReceiveTime()
|
|||
const {
|
||||
std::vector<PacketResult> res;
|
||||
for (const PacketResult& fb : packet_feedbacks) {
|
||||
if (fb.receive_time.IsFinite()) {
|
||||
if (fb.IsReceived()) {
|
||||
res.push_back(fb);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,6 +158,8 @@ struct PacketResult {
|
|||
PacketResult(const PacketResult&);
|
||||
~PacketResult();
|
||||
|
||||
inline bool IsReceived() const { return !receive_time.IsPlusInfinity(); }
|
||||
|
||||
SentPacket sent_packet;
|
||||
Timestamp receive_time = Timestamp::PlusInfinity();
|
||||
};
|
||||
|
|
|
@ -465,7 +465,7 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback(
|
|||
expected_packets_since_last_loss_update_ +=
|
||||
report.PacketsWithFeedback().size();
|
||||
for (const auto& packet_feedback : report.PacketsWithFeedback()) {
|
||||
if (packet_feedback.receive_time.IsInfinite())
|
||||
if (!packet_feedback.IsReceived())
|
||||
lost_packets_since_last_loss_update_ += 1;
|
||||
}
|
||||
if (report.feedback_time > next_loss_update_) {
|
||||
|
|
|
@ -139,7 +139,7 @@ void LossBasedBandwidthEstimation::UpdateLossStatistics(
|
|||
}
|
||||
int loss_count = 0;
|
||||
for (const auto& pkt : packet_results) {
|
||||
loss_count += pkt.receive_time.IsInfinite() ? 1 : 0;
|
||||
loss_count += !pkt.IsReceived() ? 1 : 0;
|
||||
}
|
||||
last_loss_ratio_ = static_cast<double>(loss_count) / packet_results.size();
|
||||
const TimeDelta time_passed = last_loss_packet_report_.IsFinite()
|
||||
|
|
|
@ -47,7 +47,7 @@ void PccMonitorInterval::OnPacketsFeedback(
|
|||
feedback_collection_done_ = true;
|
||||
return;
|
||||
}
|
||||
if (packet_result.receive_time.IsInfinite()) {
|
||||
if (!packet_result.IsReceived()) {
|
||||
lost_packets_sent_time_.push_back(packet_result.sent_packet.send_time);
|
||||
} else {
|
||||
received_packets_.push_back(
|
||||
|
|
|
@ -23,7 +23,7 @@ void RttTracker::OnPacketsFeedback(
|
|||
Timestamp feedback_received_time) {
|
||||
TimeDelta packet_rtt = TimeDelta::MinusInfinity();
|
||||
for (const PacketResult& packet_result : packet_feedbacks) {
|
||||
if (packet_result.receive_time.IsInfinite())
|
||||
if (!packet_result.IsReceived())
|
||||
continue;
|
||||
packet_rtt = std::max<TimeDelta>(
|
||||
packet_rtt,
|
||||
|
|
|
@ -49,8 +49,8 @@ void ComparePacketFeedbackVectors(const std::vector<PacketResult>& truth,
|
|||
// equal. However, the difference must be the same for all x.
|
||||
TimeDelta arrival_time_delta = truth[0].receive_time - input[0].receive_time;
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
RTC_CHECK(truth[i].receive_time.IsFinite());
|
||||
if (input[i].receive_time.IsFinite()) {
|
||||
RTC_CHECK(truth[i].IsReceived());
|
||||
if (input[i].IsReceived()) {
|
||||
EXPECT_EQ(truth[i].receive_time - input[i].receive_time,
|
||||
arrival_time_delta);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue