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