Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: webrtc/modules/congestion_controller/transport_feedback_adapter.cc

Issue 2633923003: Add rtcp::TransportFeedback::GetReceivedPackets() (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 if (std::abs(delta - kBaseTimestampRangeSizeUs) < std::abs(delta)) { 104 if (std::abs(delta - kBaseTimestampRangeSizeUs) < std::abs(delta)) {
105 delta -= kBaseTimestampRangeSizeUs; // Wrap backwards. 105 delta -= kBaseTimestampRangeSizeUs; // Wrap backwards.
106 } else if (std::abs(delta + kBaseTimestampRangeSizeUs) < std::abs(delta)) { 106 } else if (std::abs(delta + kBaseTimestampRangeSizeUs) < std::abs(delta)) {
107 delta += kBaseTimestampRangeSizeUs; // Wrap forwards. 107 delta += kBaseTimestampRangeSizeUs; // Wrap forwards.
108 } 108 }
109 109
110 current_offset_ms_ += delta / 1000; 110 current_offset_ms_ += delta / 1000;
111 } 111 }
112 last_timestamp_us_ = timestamp_us; 112 last_timestamp_us_ = timestamp_us;
113 113
114 uint16_t sequence_number = feedback.GetBaseSequence();
115 std::vector<int64_t> delta_vec = feedback.GetReceiveDeltasUs();
116 auto delta_it = delta_vec.begin();
117 std::vector<PacketInfo> packet_feedback_vector; 114 std::vector<PacketInfo> packet_feedback_vector;
118 packet_feedback_vector.reserve(delta_vec.size()); 115 packet_feedback_vector.reserve(feedback.GetReceivedPackets().size());
119
120 { 116 {
121 rtc::CritScope cs(&lock_); 117 rtc::CritScope cs(&lock_);
122 size_t failed_lookups = 0; 118 size_t failed_lookups = 0;
123 int64_t offset_us = 0; 119 int64_t offset_us = 0;
124 for (auto symbol : feedback.GetStatusVector()) { 120 for (const auto& packet : feedback.GetReceivedPackets()) {
125 if (symbol != rtcp::TransportFeedback::StatusSymbol::kNotReceived) { 121 offset_us += packet.delta_us();
126 RTC_DCHECK(delta_it != delta_vec.end()); 122 int64_t timestamp_ms = current_offset_ms_ + (offset_us / 1000);
127 offset_us += *(delta_it++); 123 PacketInfo info(timestamp_ms, packet.sequence_number());
128 int64_t timestamp_ms = current_offset_ms_ + (offset_us / 1000); 124 if (send_time_history_.GetInfo(&info, true) && info.send_time_ms >= 0) {
129 PacketInfo info(timestamp_ms, sequence_number); 125 packet_feedback_vector.push_back(info);
130 if (send_time_history_.GetInfo(&info, true) && info.send_time_ms >= 0) { 126 } else {
131 packet_feedback_vector.push_back(info); 127 ++failed_lookups;
132 } else {
133 ++failed_lookups;
134 }
135 } 128 }
136 ++sequence_number;
137 } 129 }
138 std::sort(packet_feedback_vector.begin(), packet_feedback_vector.end(), 130 std::sort(packet_feedback_vector.begin(), packet_feedback_vector.end(),
139 PacketInfoComparator()); 131 PacketInfoComparator());
140 RTC_DCHECK(delta_it == delta_vec.end());
141 if (failed_lookups > 0) { 132 if (failed_lookups > 0) {
142 LOG(LS_WARNING) << "Failed to lookup send time for " << failed_lookups 133 LOG(LS_WARNING) << "Failed to lookup send time for " << failed_lookups
143 << " packet" << (failed_lookups > 1 ? "s" : "") 134 << " packet" << (failed_lookups > 1 ? "s" : "")
144 << ". Send time history too small?"; 135 << ". Send time history too small?";
145 } 136 }
146 } 137 }
147 return packet_feedback_vector; 138 return packet_feedback_vector;
148 } 139 }
149 140
150 void TransportFeedbackAdapter::OnTransportFeedback( 141 void TransportFeedbackAdapter::OnTransportFeedback(
(...skipping 14 matching lines...) Expand all
165 return last_packet_feedback_vector_; 156 return last_packet_feedback_vector_;
166 } 157 }
167 158
168 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms, 159 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms,
169 int64_t max_rtt_ms) { 160 int64_t max_rtt_ms) {
170 rtc::CritScope cs(&bwe_lock_); 161 rtc::CritScope cs(&bwe_lock_);
171 delay_based_bwe_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); 162 delay_based_bwe_->OnRttUpdate(avg_rtt_ms, max_rtt_ms);
172 } 163 }
173 164
174 } // namespace webrtc 165 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698