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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc

Issue 2223033002: Fix issue where the number of packets reported in tests/simulations sometimes are negative. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 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
11 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h" 11 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h"
12 12
13 #include <algorithm>
14
13 #include "webrtc/base/logging.h" 15 #include "webrtc/base/logging.h"
14 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s end_time.h" 16 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s end_time.h"
15 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" 17 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
16 18
17 namespace webrtc { 19 namespace webrtc {
18 namespace testing { 20 namespace testing {
19 namespace bwe { 21 namespace bwe {
20 22
21 const int kFeedbackIntervalMs = 50; 23 const int kFeedbackIntervalMs = 50;
22 24
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 rbe_->IncomingPacketFeedbackVector(packet_feedback_vector); 73 rbe_->IncomingPacketFeedbackVector(packet_feedback_vector);
72 if (has_received_ack_) { 74 if (has_received_ack_) {
73 int expected_packets = fb.packet_feedback_vector().back().sequence_number - 75 int expected_packets = fb.packet_feedback_vector().back().sequence_number -
74 last_acked_seq_num_; 76 last_acked_seq_num_;
75 // Assuming no reordering for now. 77 // Assuming no reordering for now.
76 if (expected_packets > 0) { 78 if (expected_packets > 0) {
77 int lost_packets = expected_packets - 79 int lost_packets = expected_packets -
78 static_cast<int>(fb.packet_feedback_vector().size()); 80 static_cast<int>(fb.packet_feedback_vector().size());
79 report_block_.fractionLost = (lost_packets << 8) / expected_packets; 81 report_block_.fractionLost = (lost_packets << 8) / expected_packets;
80 report_block_.cumulativeLost += lost_packets; 82 report_block_.cumulativeLost += lost_packets;
83 uint32_t unwrapped = seq_num_unwrapper_.Unwrap(
84 packet_feedback_vector.back().sequence_number);
81 report_block_.extendedHighSeqNum = 85 report_block_.extendedHighSeqNum =
82 packet_feedback_vector.back().sequence_number; 86 std::max(unwrapped, report_block_.extendedHighSeqNum);
83 ReportBlockList report_blocks; 87 ReportBlockList report_blocks;
84 report_blocks.push_back(report_block_); 88 report_blocks.push_back(report_block_);
85 feedback_observer_->OnReceivedRtcpReceiverReport( 89 feedback_observer_->OnReceivedRtcpReceiverReport(
86 report_blocks, rtt_ms, clock_->TimeInMilliseconds()); 90 report_blocks, rtt_ms, clock_->TimeInMilliseconds());
87 } 91 }
88 bitrate_controller_->Process(); 92 bitrate_controller_->Process();
89 93
90 last_acked_seq_num_ = LatestSequenceNumber( 94 last_acked_seq_num_ = LatestSequenceNumber(
91 packet_feedback_vector.back().sequence_number, last_acked_seq_num_); 95 packet_feedback_vector.back().sequence_number, last_acked_seq_num_);
92 } else { 96 } else {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 packet_feedback_vector_.back().arrival_time_ms; 154 packet_feedback_vector_.back().arrival_time_ms;
151 FeedbackPacket* fb = new SendSideBweFeedback( 155 FeedbackPacket* fb = new SendSideBweFeedback(
152 flow_id_, now_ms * 1000, corrected_send_time_ms, packet_feedback_vector_); 156 flow_id_, now_ms * 1000, corrected_send_time_ms, packet_feedback_vector_);
153 packet_feedback_vector_.clear(); 157 packet_feedback_vector_.clear();
154 return fb; 158 return fb;
155 } 159 }
156 160
157 } // namespace bwe 161 } // namespace bwe
158 } // namespace testing 162 } // namespace testing
159 } // namespace webrtc 163 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698