OLD | NEW |
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> | 13 #include <algorithm> |
14 | 14 |
15 #include "webrtc/base/logging.h" | 15 #include "webrtc/base/logging.h" |
| 16 #include "webrtc/base/ptr_util.h" |
16 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" | 17 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" |
17 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" | 18 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" |
18 | 19 |
19 namespace webrtc { | 20 namespace webrtc { |
20 namespace testing { | 21 namespace testing { |
21 namespace bwe { | 22 namespace bwe { |
22 | 23 |
23 const int kFeedbackIntervalMs = 50; | 24 const int kFeedbackIntervalMs = 50; |
24 | 25 |
25 SendSideBweSender::SendSideBweSender(int kbps, | 26 SendSideBweSender::SendSideBweSender(int kbps, |
26 BitrateObserver* observer, | 27 BitrateObserver* observer, |
27 Clock* clock) | 28 Clock* clock) |
28 : bitrate_controller_( | 29 : bitrate_controller_( |
29 BitrateController::CreateBitrateController(clock, | 30 BitrateController::CreateBitrateController(clock, |
30 observer, | 31 observer, |
31 &event_log_)), | 32 &event_log_)), |
| 33 acknowledged_bitrate_estimator_( |
| 34 rtc::MakeUnique<AcknowledgedBitrateEstimator>()), |
32 bwe_(new DelayBasedBwe(nullptr, clock)), | 35 bwe_(new DelayBasedBwe(nullptr, clock)), |
33 feedback_observer_(bitrate_controller_->CreateRtcpBandwidthObserver()), | 36 feedback_observer_(bitrate_controller_->CreateRtcpBandwidthObserver()), |
34 clock_(clock), | 37 clock_(clock), |
35 send_time_history_(clock_, 10000), | 38 send_time_history_(clock_, 10000), |
36 has_received_ack_(false), | 39 has_received_ack_(false), |
37 last_acked_seq_num_(0), | 40 last_acked_seq_num_(0), |
38 last_log_time_ms_(0) { | 41 last_log_time_ms_(0) { |
39 assert(kbps >= kMinBitrateKbps); | 42 assert(kbps >= kMinBitrateKbps); |
40 assert(kbps <= kMaxBitrateKbps); | 43 assert(kbps <= kMaxBitrateKbps); |
41 bitrate_controller_->SetStartBitrate(1000 * kbps); | 44 bitrate_controller_->SetStartBitrate(1000 * kbps); |
(...skipping 23 matching lines...) Expand all Loading... |
65 last_log_time_ms_ = now_ms; | 68 last_log_time_ms_ = now_ms; |
66 } | 69 } |
67 } | 70 } |
68 } | 71 } |
69 | 72 |
70 int64_t rtt_ms = | 73 int64_t rtt_ms = |
71 clock_->TimeInMilliseconds() - feedback.latest_send_time_ms(); | 74 clock_->TimeInMilliseconds() - feedback.latest_send_time_ms(); |
72 bwe_->OnRttUpdate(rtt_ms, rtt_ms); | 75 bwe_->OnRttUpdate(rtt_ms, rtt_ms); |
73 BWE_TEST_LOGGING_PLOT(1, "RTT", clock_->TimeInMilliseconds(), rtt_ms); | 76 BWE_TEST_LOGGING_PLOT(1, "RTT", clock_->TimeInMilliseconds(), rtt_ms); |
74 | 77 |
75 DelayBasedBwe::Result result = | 78 acknowledged_bitrate_estimator_->IncomingPacketFeedbackVector( |
76 bwe_->IncomingPacketFeedbackVector(packet_feedback_vector); | 79 packet_feedback_vector); |
| 80 DelayBasedBwe::Result result = bwe_->IncomingPacketFeedbackVector( |
| 81 packet_feedback_vector, acknowledged_bitrate_estimator_->bitrate_bps()); |
77 if (result.updated) | 82 if (result.updated) |
78 bitrate_controller_->OnDelayBasedBweResult(result); | 83 bitrate_controller_->OnDelayBasedBweResult(result); |
79 | 84 |
80 if (has_received_ack_) { | 85 if (has_received_ack_) { |
81 int expected_packets = fb.packet_feedback_vector().back().sequence_number - | 86 int expected_packets = fb.packet_feedback_vector().back().sequence_number - |
82 last_acked_seq_num_; | 87 last_acked_seq_num_; |
83 // Assuming no reordering for now. | 88 // Assuming no reordering for now. |
84 if (expected_packets > 0) { | 89 if (expected_packets > 0) { |
85 int lost_packets = expected_packets - | 90 int lost_packets = expected_packets - |
86 static_cast<int>(fb.packet_feedback_vector().size()); | 91 static_cast<int>(fb.packet_feedback_vector().size()); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 packet_feedback_vector_.back().arrival_time_ms; | 167 packet_feedback_vector_.back().arrival_time_ms; |
163 FeedbackPacket* fb = new SendSideBweFeedback( | 168 FeedbackPacket* fb = new SendSideBweFeedback( |
164 flow_id_, now_ms * 1000, corrected_send_time_ms, packet_feedback_vector_); | 169 flow_id_, now_ms * 1000, corrected_send_time_ms, packet_feedback_vector_); |
165 packet_feedback_vector_.clear(); | 170 packet_feedback_vector_.clear(); |
166 return fb; | 171 return fb; |
167 } | 172 } |
168 | 173 |
169 } // namespace bwe | 174 } // namespace bwe |
170 } // namespace testing | 175 } // namespace testing |
171 } // namespace webrtc | 176 } // namespace webrtc |
OLD | NEW |