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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/bwe.cc

Issue 1235143002: Fix simulator issue where chokes didn't apply to non-congested packets. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed. Created 5 years, 5 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 ++node_it; 150 ++node_it;
151 ++number_packets_received; 151 ++number_packets_received;
152 } 152 }
153 // Interval width between oldest and newest sequence number. 153 // Interval width between oldest and newest sequence number.
154 // There was an overflow if newest_seq_nb < oldest_seq_nb. 154 // There was an overflow if newest_seq_nb < oldest_seq_nb.
155 int gap = static_cast<uint16_t>(newest_seq_nb - oldest_seq_nb + 1); 155 int gap = static_cast<uint16_t>(newest_seq_nb - oldest_seq_nb + 1);
156 156
157 return static_cast<float>(gap - number_packets_received) / gap; 157 return static_cast<float>(gap - number_packets_received) / gap;
158 } 158 }
159 159
160 LinkedSet::~LinkedSet() {
161 while (!empty())
162 RemoveTail();
163 }
164
160 void LinkedSet::Insert(uint16_t sequence_number, 165 void LinkedSet::Insert(uint16_t sequence_number,
161 int64_t send_time_ms, 166 int64_t send_time_ms,
162 int64_t arrival_time_ms, 167 int64_t arrival_time_ms,
163 size_t payload_size) { 168 size_t payload_size) {
164 std::map<uint16_t, PacketNodeIt>::iterator it = map_.find(sequence_number); 169 std::map<uint16_t, PacketNodeIt>::iterator it = map_.find(sequence_number);
165 if (it != map_.end()) { 170 if (it != map_.end()) {
166 PacketNodeIt node_it = it->second; 171 PacketNodeIt node_it = it->second;
167 PacketIdentifierNode* node = *node_it; 172 PacketIdentifierNode* node = *node_it;
168 node->arrival_time_ms = arrival_time_ms; 173 node->arrival_time_ms = arrival_time_ms;
169 if (node_it != list_.begin()) { 174 if (node_it != list_.begin()) {
170 list_.erase(node_it); 175 list_.erase(node_it);
171 list_.push_front(node); 176 list_.push_front(node);
172 map_[sequence_number] = list_.begin(); 177 map_[sequence_number] = list_.begin();
173 } 178 }
174 } else { 179 } else {
175 if (size() == capacity_) { 180 if (size() == capacity_) {
176 RemoveTail(); 181 RemoveTail();
177 } 182 }
178 UpdateHead(new PacketIdentifierNode(sequence_number, send_time_ms, 183 UpdateHead(new PacketIdentifierNode(sequence_number, send_time_ms,
179 arrival_time_ms, payload_size)); 184 arrival_time_ms, payload_size));
180 } 185 }
181 } 186 }
182 void LinkedSet::RemoveTail() { 187 void LinkedSet::RemoveTail() {
183 map_.erase(list_.back()->sequence_number); 188 map_.erase(list_.back()->sequence_number);
189 delete list_.back();
184 list_.pop_back(); 190 list_.pop_back();
185 } 191 }
186 void LinkedSet::UpdateHead(PacketIdentifierNode* new_head) { 192 void LinkedSet::UpdateHead(PacketIdentifierNode* new_head) {
187 list_.push_front(new_head); 193 list_.push_front(new_head);
188 map_[new_head->sequence_number] = list_.begin(); 194 map_[new_head->sequence_number] = list_.begin();
189 } 195 }
190 196
191 } // namespace bwe 197 } // namespace bwe
192 } // namespace testing 198 } // namespace testing
193 } // namespace webrtc 199 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/bwe.h ('k') | webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698