| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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/congestion_controller/delay_based_bwe.h" | 11 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 #include <cmath> | 14 #include <cmath> |
| 15 #include <string> | 15 #include <string> |
| 16 | 16 |
| 17 #include "webrtc/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h
" |
| 17 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 18 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 18 #include "webrtc/modules/pacing/paced_sender.h" | 19 #include "webrtc/modules/pacing/paced_sender.h" |
| 19 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 20 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
| 20 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" | 21 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" |
| 21 #include "webrtc/rtc_base/checks.h" | 22 #include "webrtc/rtc_base/checks.h" |
| 22 #include "webrtc/rtc_base/constructormagic.h" | 23 #include "webrtc/rtc_base/constructormagic.h" |
| 23 #include "webrtc/rtc_base/logging.h" | 24 #include "webrtc/rtc_base/logging.h" |
| 25 #include "webrtc/rtc_base/ptr_util.h" |
| 24 #include "webrtc/rtc_base/thread_annotations.h" | 26 #include "webrtc/rtc_base/thread_annotations.h" |
| 25 #include "webrtc/system_wrappers/include/field_trial.h" | 27 #include "webrtc/system_wrappers/include/field_trial.h" |
| 26 #include "webrtc/system_wrappers/include/metrics.h" | 28 #include "webrtc/system_wrappers/include/metrics.h" |
| 27 #include "webrtc/typedefs.h" | 29 #include "webrtc/typedefs.h" |
| 28 | 30 |
| 29 namespace { | 31 namespace { |
| 30 constexpr int kTimestampGroupLengthMs = 5; | 32 constexpr int kTimestampGroupLengthMs = 5; |
| 31 constexpr int kAbsSendTimeFraction = 18; | 33 constexpr int kAbsSendTimeFraction = 18; |
| 32 constexpr int kAbsSendTimeInterArrivalUpshift = 8; | 34 constexpr int kAbsSendTimeInterArrivalUpshift = 8; |
| 33 constexpr int kInterArrivalShift = | 35 constexpr int kInterArrivalShift = |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 result.updated = UpdateEstimate(now_ms, acked_bitrate_bps, overusing, | 249 result.updated = UpdateEstimate(now_ms, acked_bitrate_bps, overusing, |
| 248 &result.target_bitrate_bps); | 250 &result.target_bitrate_bps); |
| 249 result.recovered_from_overuse = recovered_from_overuse; | 251 result.recovered_from_overuse = recovered_from_overuse; |
| 250 } | 252 } |
| 251 } | 253 } |
| 252 if (result.updated) { | 254 if (result.updated) { |
| 253 BWE_TEST_LOGGING_PLOT(1, "target_bitrate_bps", now_ms, | 255 BWE_TEST_LOGGING_PLOT(1, "target_bitrate_bps", now_ms, |
| 254 result.target_bitrate_bps); | 256 result.target_bitrate_bps); |
| 255 if (event_log_ && (result.target_bitrate_bps != last_logged_bitrate_ || | 257 if (event_log_ && (result.target_bitrate_bps != last_logged_bitrate_ || |
| 256 detector_.State() != last_logged_state_)) { | 258 detector_.State() != last_logged_state_)) { |
| 257 event_log_->LogDelayBasedBweUpdate(result.target_bitrate_bps, | 259 event_log_->Log(rtc::MakeUnique<RtcEventBweUpdateDelayBased>( |
| 258 detector_.State()); | 260 result.target_bitrate_bps, detector_.State())); |
| 259 last_logged_bitrate_ = result.target_bitrate_bps; | 261 last_logged_bitrate_ = result.target_bitrate_bps; |
| 260 last_logged_state_ = detector_.State(); | 262 last_logged_state_ = detector_.State(); |
| 261 } | 263 } |
| 262 } | 264 } |
| 263 return result; | 265 return result; |
| 264 } | 266 } |
| 265 | 267 |
| 266 bool DelayBasedBwe::UpdateEstimate(int64_t now_ms, | 268 bool DelayBasedBwe::UpdateEstimate(int64_t now_ms, |
| 267 rtc::Optional<uint32_t> acked_bitrate_bps, | 269 rtc::Optional<uint32_t> acked_bitrate_bps, |
| 268 bool overusing, | 270 bool overusing, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 void DelayBasedBwe::SetMinBitrate(int min_bitrate_bps) { | 308 void DelayBasedBwe::SetMinBitrate(int min_bitrate_bps) { |
| 307 // Called from both the configuration thread and the network thread. Shouldn't | 309 // Called from both the configuration thread and the network thread. Shouldn't |
| 308 // be called from the network thread in the future. | 310 // be called from the network thread in the future. |
| 309 rate_control_.SetMinBitrate(min_bitrate_bps); | 311 rate_control_.SetMinBitrate(min_bitrate_bps); |
| 310 } | 312 } |
| 311 | 313 |
| 312 int64_t DelayBasedBwe::GetExpectedBwePeriodMs() const { | 314 int64_t DelayBasedBwe::GetExpectedBwePeriodMs() const { |
| 313 return rate_control_.GetExpectedBandwidthPeriodMs(); | 315 return rate_control_.GetExpectedBandwidthPeriodMs(); |
| 314 } | 316 } |
| 315 } // namespace webrtc | 317 } // namespace webrtc |
| OLD | NEW |