Adds first unacknowledged packet send time.

This will be used to calculate a lower bound for the round trip time in
a later CL.

Bug: webrtc:9718
Change-Id: I0a1d22045961fe6bd343d1d6ce9b36490b036bb1
Reviewed-on: https://webrtc-review.googlesource.com/c/114680
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26050}
This commit is contained in:
Sebastian Jansson 2018-12-18 15:54:41 +01:00 committed by Commit Bot
parent 11b8703201
commit 503da94350
4 changed files with 20 additions and 0 deletions

View File

@ -136,6 +136,7 @@ struct TransportPacketsFeedback {
~TransportPacketsFeedback();
Timestamp feedback_time = Timestamp::PlusInfinity();
Timestamp first_unacked_send_time = Timestamp::PlusInfinity();
DataSize data_in_flight = DataSize::Zero();
DataSize prior_in_flight = DataSize::Zero();
std::vector<PacketResult> packet_feedbacks;

View File

@ -121,6 +121,16 @@ DataSize SendTimeHistory::GetOutstandingData(uint16_t local_net_id,
}
}
absl::optional<int64_t> SendTimeHistory::GetFirstUnackedSendTime() const {
if (!last_ack_seq_num_)
return absl::nullopt;
auto it = history_.find(*last_ack_seq_num_);
if (it == history_.end() ||
it->second.send_time_ms == PacketFeedback::kNoSendTime)
return absl::nullopt;
return it->second.send_time_ms;
}
void SendTimeHistory::AddPacketBytes(const PacketFeedback& packet) {
if (packet.send_time_ms < 0 || packet.payload_size == 0 ||
(last_ack_seq_num_ && *last_ack_seq_num_ >= packet.long_sequence_number))

View File

@ -47,6 +47,8 @@ class SendTimeHistory {
DataSize GetOutstandingData(uint16_t local_net_id,
uint16_t remote_net_id) const;
absl::optional<int64_t> GetFirstUnackedSendTime() const;
private:
using RemoteAndLocalNetworkId = std::pair<uint16_t, uint16_t>;

View File

@ -148,6 +148,13 @@ TransportFeedbackAdapter::ProcessTransportFeedback(
Timestamp::ms(rtp_feedback.arrival_time_ms));
}
}
{
rtc::CritScope cs(&lock_);
absl::optional<int64_t> first_unacked_send_time_ms =
send_time_history_.GetFirstUnackedSendTime();
if (first_unacked_send_time_ms)
msg.first_unacked_send_time = Timestamp::ms(*first_unacked_send_time_ms);
}
msg.feedback_time = Timestamp::ms(feedback_time_ms);
msg.prior_in_flight = prior_in_flight;
msg.data_in_flight = GetOutstandingData();