OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 temp_sequence_number = stored_packets_[*index].sequence_number; | 193 temp_sequence_number = stored_packets_[*index].sequence_number; |
194 break; | 194 break; |
195 } | 195 } |
196 } | 196 } |
197 } | 197 } |
198 return temp_sequence_number == sequence_number && | 198 return temp_sequence_number == sequence_number && |
199 stored_packets_[*index].packet; | 199 stored_packets_[*index].packet; |
200 } | 200 } |
201 | 201 |
202 int RtpPacketHistory::FindBestFittingPacket(size_t size) const { | 202 int RtpPacketHistory::FindBestFittingPacket(size_t size) const { |
203 // TODO(minyue): it looks like that the fitting expects |size| to include | |
minyue-webrtc
2017/03/24 07:10:56
Philip and Stefan, would you take a look at this?
michaelt
2017/03/27 14:25:01
Looks wrong to me as well.
| |
204 // headeer, but its use in RTPSender does not seem to match. | |
203 if (size < kMinPacketRequestBytes || stored_packets_.empty()) | 205 if (size < kMinPacketRequestBytes || stored_packets_.empty()) |
204 return -1; | 206 return -1; |
205 size_t min_diff = std::numeric_limits<size_t>::max(); | 207 size_t min_diff = std::numeric_limits<size_t>::max(); |
206 int best_index = -1; // Returned unchanged if we don't find anything. | 208 int best_index = -1; // Returned unchanged if we don't find anything. |
207 for (size_t i = 0; i < stored_packets_.size(); ++i) { | 209 for (size_t i = 0; i < stored_packets_.size(); ++i) { |
208 if (!stored_packets_[i].packet) | 210 if (!stored_packets_[i].packet) |
209 continue; | 211 continue; |
210 size_t stored_size = stored_packets_[i].packet->size(); | 212 size_t stored_size = stored_packets_[i].packet->size(); |
211 size_t diff = | 213 size_t diff = |
212 (stored_size > size) ? (stored_size - size) : (size - stored_size); | 214 (stored_size > size) ? (stored_size - size) : (size - stored_size); |
213 if (diff < min_diff) { | 215 if (diff < min_diff) { |
214 min_diff = diff; | 216 min_diff = diff; |
215 best_index = static_cast<int>(i); | 217 best_index = static_cast<int>(i); |
216 } | 218 } |
217 } | 219 } |
218 return best_index; | 220 return best_index; |
219 } | 221 } |
220 | 222 |
221 } // namespace webrtc | 223 } // namespace webrtc |
OLD | NEW |