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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc

Issue 2157843002: Fix crash which happens when there's reordering in the beginning of a call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comment. Created 4 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 RTC_DCHECK(packet_router_ != nullptr); 82 RTC_DCHECK(packet_router_ != nullptr);
83 packet_router_->SendFeedback(&feedback_packet); 83 packet_router_->SendFeedback(&feedback_packet);
84 } else { 84 } else {
85 more_to_build = false; 85 more_to_build = false;
86 } 86 }
87 } 87 }
88 } 88 }
89 89
90 void RemoteEstimatorProxy::OnPacketArrival(uint16_t sequence_number, 90 void RemoteEstimatorProxy::OnPacketArrival(uint16_t sequence_number,
91 int64_t arrival_time) { 91 int64_t arrival_time) {
92 // TODO(holmer): We should handle a backwards wrap here if the first
93 // sequence number was small and the new sequence number is large. The
94 // SequenceNumberUnwrapper doesn't do this, so we should replace this with
95 // calls to IsNewerSequenceNumber instead.
92 int64_t seq = unwrapper_.Unwrap(sequence_number); 96 int64_t seq = unwrapper_.Unwrap(sequence_number);
97 if (seq > window_start_seq_ + 0xFFFF / 2) {
98 LOG(LS_WARNING) << "Skipping this sequence number (" << sequence_number
99 << ") since it likely is reordered, but the unwrapper"
100 "failed to handle it. Feedback window starts at "
101 << window_start_seq_ << ".";
102 return;
103 }
93 104
94 if (packet_arrival_times_.lower_bound(window_start_seq_) == 105 if (packet_arrival_times_.lower_bound(window_start_seq_) ==
95 packet_arrival_times_.end()) { 106 packet_arrival_times_.end()) {
96 // Start new feedback packet, cull old packets. 107 // Start new feedback packet, cull old packets.
97 for (auto it = packet_arrival_times_.begin(); 108 for (auto it = packet_arrival_times_.begin();
98 it != packet_arrival_times_.end() && it->first < seq && 109 it != packet_arrival_times_.end() && it->first < seq &&
99 arrival_time - it->second >= kBackWindowMs;) { 110 arrival_time - it->second >= kBackWindowMs;) {
100 auto delete_it = it; 111 auto delete_it = it;
101 ++it; 112 ++it;
102 packet_arrival_times_.erase(delete_it); 113 packet_arrival_times_.erase(delete_it);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // Note: Don't erase items from packet_arrival_times_ after sending, in case 164 // Note: Don't erase items from packet_arrival_times_ after sending, in case
154 // they need to be re-sent after a reordering. Removal will be handled 165 // they need to be re-sent after a reordering. Removal will be handled
155 // by OnPacketArrival once packets are too old. 166 // by OnPacketArrival once packets are too old.
156 window_start_seq_ = it->first + 1; 167 window_start_seq_ = it->first + 1;
157 } 168 }
158 169
159 return true; 170 return true;
160 } 171 }
161 172
162 } // namespace webrtc 173 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698