| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 const int kFeedbackIntervalMs = 50; | 21 const int kFeedbackIntervalMs = 50; |
| 22 | 22 |
| 23 FullBweSender::FullBweSender(int kbps, BitrateObserver* observer, Clock* clock) | 23 FullBweSender::FullBweSender(int kbps, BitrateObserver* observer, Clock* clock) |
| 24 : bitrate_controller_( | 24 : bitrate_controller_( |
| 25 BitrateController::CreateBitrateController(clock, observer)), | 25 BitrateController::CreateBitrateController(clock, observer)), |
| 26 rbe_(new RemoteBitrateEstimatorAbsSendTime(this)), | 26 rbe_(new RemoteBitrateEstimatorAbsSendTime(this)), |
| 27 feedback_observer_(bitrate_controller_->CreateRtcpBandwidthObserver()), | 27 feedback_observer_(bitrate_controller_->CreateRtcpBandwidthObserver()), |
| 28 clock_(clock), | 28 clock_(clock), |
| 29 send_time_history_(clock_, 10000), | 29 send_time_history_(clock_, 10000), |
| 30 has_received_ack_(false), | 30 has_received_ack_(false), |
| 31 last_acked_seq_num_(0) { | 31 last_acked_seq_num_(0), |
| 32 last_log_time_ms_(0) { |
| 32 assert(kbps >= kMinBitrateKbps); | 33 assert(kbps >= kMinBitrateKbps); |
| 33 assert(kbps <= kMaxBitrateKbps); | 34 assert(kbps <= kMaxBitrateKbps); |
| 34 bitrate_controller_->SetStartBitrate(1000 * kbps); | 35 bitrate_controller_->SetStartBitrate(1000 * kbps); |
| 35 bitrate_controller_->SetMinMaxBitrate(1000 * kMinBitrateKbps, | 36 bitrate_controller_->SetMinMaxBitrate(1000 * kMinBitrateKbps, |
| 36 1000 * kMaxBitrateKbps); | 37 1000 * kMaxBitrateKbps); |
| 37 rbe_->SetMinBitrate(1000 * kMinBitrateKbps); | 38 rbe_->SetMinBitrate(1000 * kMinBitrateKbps); |
| 38 } | 39 } |
| 39 | 40 |
| 40 FullBweSender::~FullBweSender() { | 41 FullBweSender::~FullBweSender() { |
| 41 } | 42 } |
| 42 | 43 |
| 43 int FullBweSender::GetFeedbackIntervalMs() const { | 44 int FullBweSender::GetFeedbackIntervalMs() const { |
| 44 return kFeedbackIntervalMs; | 45 return kFeedbackIntervalMs; |
| 45 } | 46 } |
| 46 | 47 |
| 47 void FullBweSender::GiveFeedback(const FeedbackPacket& feedback) { | 48 void FullBweSender::GiveFeedback(const FeedbackPacket& feedback) { |
| 48 const SendSideBweFeedback& fb = | 49 const SendSideBweFeedback& fb = |
| 49 static_cast<const SendSideBweFeedback&>(feedback); | 50 static_cast<const SendSideBweFeedback&>(feedback); |
| 50 if (fb.packet_feedback_vector().empty()) | 51 if (fb.packet_feedback_vector().empty()) |
| 51 return; | 52 return; |
| 52 std::vector<PacketInfo> packet_feedback_vector(fb.packet_feedback_vector()); | 53 std::vector<PacketInfo> packet_feedback_vector(fb.packet_feedback_vector()); |
| 53 for (PacketInfo& packet_info : packet_feedback_vector) { | 54 for (PacketInfo& packet_info : packet_feedback_vector) { |
| 54 if (!send_time_history_.GetInfo(&packet_info, true)) { | 55 if (!send_time_history_.GetInfo(&packet_info, true)) { |
| 55 LOG(LS_WARNING) << "Ack arrived too late."; | 56 int64_t now_ms = clock_->TimeInMilliseconds(); |
| 57 if (now_ms - last_log_time_ms_ > 5000) { |
| 58 LOG(LS_WARNING) << "Ack arrived too late."; |
| 59 last_log_time_ms_ = now_ms; |
| 60 } |
| 56 } | 61 } |
| 57 } | 62 } |
| 58 | 63 |
| 59 int64_t rtt_ms = | 64 int64_t rtt_ms = |
| 60 clock_->TimeInMilliseconds() - feedback.latest_send_time_ms(); | 65 clock_->TimeInMilliseconds() - feedback.latest_send_time_ms(); |
| 61 rbe_->OnRttUpdate(rtt_ms, rtt_ms); | 66 rbe_->OnRttUpdate(rtt_ms, rtt_ms); |
| 62 BWE_TEST_LOGGING_PLOT(1, "RTT", clock_->TimeInMilliseconds(), rtt_ms); | 67 BWE_TEST_LOGGING_PLOT(1, "RTT", clock_->TimeInMilliseconds(), rtt_ms); |
| 63 | 68 |
| 64 rbe_->IncomingPacketFeedbackVector(packet_feedback_vector); | 69 rbe_->IncomingPacketFeedbackVector(packet_feedback_vector); |
| 65 if (has_received_ack_) { | 70 if (has_received_ack_) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 packet_feedback_vector_.back().arrival_time_ms; | 146 packet_feedback_vector_.back().arrival_time_ms; |
| 142 FeedbackPacket* fb = new SendSideBweFeedback( | 147 FeedbackPacket* fb = new SendSideBweFeedback( |
| 143 flow_id_, now_ms * 1000, corrected_send_time_ms, packet_feedback_vector_); | 148 flow_id_, now_ms * 1000, corrected_send_time_ms, packet_feedback_vector_); |
| 144 packet_feedback_vector_.clear(); | 149 packet_feedback_vector_.clear(); |
| 145 return fb; | 150 return fb; |
| 146 } | 151 } |
| 147 | 152 |
| 148 } // namespace bwe | 153 } // namespace bwe |
| 149 } // namespace testing | 154 } // namespace testing |
| 150 } // namespace webrtc | 155 } // namespace webrtc |
| OLD | NEW |