Cleanup of bwe_defines.h
Delete unused macros BWE_MIN and BWE_MAX. Move enum RateControlState: Make it a private enum class in AimdRateControl, the only user. Change users of the header file that only need BandwidthUsage, to instead include api/network_state_predictor.h, the file defining this class. As a result, fewer dependencies on modules/remote_bitrate_estimator. Bug: None Change-Id: I4450c79dd58e1875d64dd74d1ae2cb7d911a14b3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195222 Reviewed-by: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32704}
This commit is contained in:
parent
e57eb34a40
commit
0d863f72a8
@ -80,7 +80,6 @@ rtc_library("audio") {
|
||||
"../modules/audio_processing:audio_frame_proxies",
|
||||
"../modules/audio_processing:rms_level",
|
||||
"../modules/pacing",
|
||||
"../modules/remote_bitrate_estimator",
|
||||
"../modules/rtp_rtcp",
|
||||
"../modules/rtp_rtcp:rtp_rtcp_format",
|
||||
"../modules/utility",
|
||||
|
||||
@ -11,7 +11,6 @@ include_rules = [
|
||||
"+modules/bitrate_controller",
|
||||
"+modules/congestion_controller",
|
||||
"+modules/pacing",
|
||||
"+modules/remote_bitrate_estimator",
|
||||
"+modules/rtp_rtcp",
|
||||
"+modules/utility",
|
||||
"+system_wrappers",
|
||||
|
||||
@ -97,10 +97,10 @@ rtc_library("rtc_event_bwe") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"../api:network_state_predictor_api",
|
||||
"../api:scoped_refptr",
|
||||
"../api/rtc_event_log",
|
||||
"../api/units:data_rate",
|
||||
"../modules/remote_bitrate_estimator",
|
||||
]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
@ -229,8 +229,8 @@ rtc_library("rtc_event_log_impl_encoder") {
|
||||
":rtc_event_video",
|
||||
":rtc_stream_config",
|
||||
"../api:array_view",
|
||||
"../api:network_state_predictor_api",
|
||||
"../modules/audio_coding:audio_network_adaptor",
|
||||
"../modules/remote_bitrate_estimator",
|
||||
"../modules/rtp_rtcp:rtp_rtcp_format",
|
||||
]
|
||||
sources += [
|
||||
@ -323,6 +323,7 @@ if (rtc_enable_protobuf) {
|
||||
":rtc_event_log_proto",
|
||||
":rtc_stream_config",
|
||||
"../api:function_view",
|
||||
"../api:network_state_predictor_api",
|
||||
"../api:rtp_headers",
|
||||
"../api:rtp_parameters",
|
||||
"../api/rtc_event_log",
|
||||
@ -334,7 +335,6 @@ if (rtc_enable_protobuf) {
|
||||
"../modules:module_api",
|
||||
"../modules:module_api_public",
|
||||
"../modules/audio_coding:audio_network_adaptor",
|
||||
"../modules/remote_bitrate_estimator",
|
||||
"../modules/rtp_rtcp",
|
||||
"../modules/rtp_rtcp:rtp_rtcp_format",
|
||||
"../rtc_base:checks",
|
||||
@ -379,6 +379,7 @@ if (rtc_enable_protobuf) {
|
||||
":rtc_event_video",
|
||||
":rtc_stream_config",
|
||||
"../api:array_view",
|
||||
"../api:network_state_predictor_api",
|
||||
"../api:rtc_event_log_output_file",
|
||||
"../api:rtp_headers",
|
||||
"../api:rtp_parameters",
|
||||
@ -388,7 +389,6 @@ if (rtc_enable_protobuf) {
|
||||
"../call",
|
||||
"../call:call_interfaces",
|
||||
"../modules/audio_coding:audio_network_adaptor",
|
||||
"../modules/remote_bitrate_estimator",
|
||||
"../modules/rtp_rtcp:rtp_rtcp_format",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
|
||||
@ -2,7 +2,6 @@ include_rules = [
|
||||
"+call",
|
||||
"+modules/audio_coding/audio_network_adaptor",
|
||||
"+modules/congestion_controller",
|
||||
"+modules/remote_bitrate_estimator/include",
|
||||
"+modules/rtp_rtcp",
|
||||
"+system_wrappers",
|
||||
]
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/rtp_parameters.h"
|
||||
#include "api/transport/network_types.h"
|
||||
@ -38,7 +39,6 @@
|
||||
#include "logging/rtc_event_log/events/rtc_event_video_send_stream_config.h"
|
||||
#include "logging/rtc_event_log/rtc_stream_config.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/app.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/bye.h"
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/array_view.h"
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "logging/rtc_event_log/encoder/blob_encoding.h"
|
||||
#include "logging/rtc_event_log/encoder/delta_encoding.h"
|
||||
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_common.h"
|
||||
@ -43,7 +44,6 @@
|
||||
#include "logging/rtc_event_log/events/rtc_event_video_send_stream_config.h"
|
||||
#include "logging/rtc_event_log/rtc_stream_config.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_cvo.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/app.h"
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
#include "logging/rtc_event_log/rtc_event_log_parser.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log_unittest_helper.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/bye.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#include "logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h"
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "api/network_state_predictor.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/units/data_rate.h"
|
||||
#include "api/units/time_delta.h"
|
||||
@ -25,7 +26,6 @@
|
||||
#include "logging/rtc_event_log/events/rtc_event_probe_result_failure.h"
|
||||
#include "logging/rtc_event_log/rtc_stream_config.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/extended_reports.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/fir.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/loss_notification.h"
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "api/rtc_event_log/rtc_event_log.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/rtp_parameters.h"
|
||||
@ -32,7 +33,6 @@
|
||||
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
|
||||
#include "modules/include/module_common_types.h"
|
||||
#include "modules/include/module_common_types_public.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_cvo.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/byte_io.h"
|
||||
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/array_view.h"
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/rtp_parameters.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_cvo.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/dlrr.h"
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include "api/rtc_event_log/rtc_event_log.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h"
|
||||
#include "modules/congestion_controller/goog_cc/trendline_estimator.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/remote_bitrate_estimator/test/bwe_test_logging.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
#include "modules/congestion_controller/goog_cc/delay_increase_detector_interface.h"
|
||||
#include "modules/congestion_controller/goog_cc/probe_bitrate_estimator.h"
|
||||
#include "modules/remote_bitrate_estimator/aimd_rate_control.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/remote_bitrate_estimator/inter_arrival.h"
|
||||
#include "rtc_base/experiments/struct_parameters_parser.h"
|
||||
#include "rtc_base/race_checker.h"
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "modules/remote_bitrate_estimator/test/bwe_test_logging.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/experiments/struct_parameters_parser.h"
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "api/transport/webrtc_key_value_config.h"
|
||||
#include "modules/congestion_controller/goog_cc/delay_increase_detector_interface.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
#include "rtc_base/experiments/struct_parameters_parser.h"
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ AimdRateControl::AimdRateControl(const WebRtcKeyValueConfig* key_value_config,
|
||||
current_bitrate_(max_configured_bitrate_),
|
||||
latest_estimated_throughput_(current_bitrate_),
|
||||
link_capacity_(),
|
||||
rate_control_state_(kRcHold),
|
||||
rate_control_state_(RateControlState::kRcHold),
|
||||
time_last_bitrate_change_(Timestamp::MinusInfinity()),
|
||||
time_last_bitrate_decrease_(Timestamp::MinusInfinity()),
|
||||
time_first_throughput_estimate_(Timestamp::MinusInfinity()),
|
||||
@ -280,10 +280,10 @@ void AimdRateControl::ChangeBitrate(const RateControlInput& input,
|
||||
1.5 * estimated_throughput + DataRate::KilobitsPerSec(10);
|
||||
|
||||
switch (rate_control_state_) {
|
||||
case kRcHold:
|
||||
case RateControlState::kRcHold:
|
||||
break;
|
||||
|
||||
case kRcIncrease:
|
||||
case RateControlState::kRcIncrease:
|
||||
if (estimated_throughput > link_capacity_.UpperBound())
|
||||
link_capacity_.Reset();
|
||||
|
||||
@ -316,7 +316,7 @@ void AimdRateControl::ChangeBitrate(const RateControlInput& input,
|
||||
time_last_bitrate_change_ = at_time;
|
||||
break;
|
||||
|
||||
case kRcDecrease: {
|
||||
case RateControlState::kRcDecrease: {
|
||||
DataRate decreased_bitrate = DataRate::PlusInfinity();
|
||||
|
||||
// Set bit rate to something slightly lower than the measured throughput
|
||||
@ -356,7 +356,7 @@ void AimdRateControl::ChangeBitrate(const RateControlInput& input,
|
||||
bitrate_is_initialized_ = true;
|
||||
link_capacity_.OnOveruseDetected(estimated_throughput);
|
||||
// Stay on hold until the pipes are cleared.
|
||||
rate_control_state_ = kRcHold;
|
||||
rate_control_state_ = RateControlState::kRcHold;
|
||||
time_last_bitrate_change_ = at_time;
|
||||
time_last_bitrate_decrease_ = at_time;
|
||||
break;
|
||||
@ -403,18 +403,18 @@ void AimdRateControl::ChangeState(const RateControlInput& input,
|
||||
Timestamp at_time) {
|
||||
switch (input.bw_state) {
|
||||
case BandwidthUsage::kBwNormal:
|
||||
if (rate_control_state_ == kRcHold) {
|
||||
if (rate_control_state_ == RateControlState::kRcHold) {
|
||||
time_last_bitrate_change_ = at_time;
|
||||
rate_control_state_ = kRcIncrease;
|
||||
rate_control_state_ = RateControlState::kRcIncrease;
|
||||
}
|
||||
break;
|
||||
case BandwidthUsage::kBwOverusing:
|
||||
if (rate_control_state_ != kRcDecrease) {
|
||||
rate_control_state_ = kRcDecrease;
|
||||
if (rate_control_state_ != RateControlState::kRcDecrease) {
|
||||
rate_control_state_ = RateControlState::kRcDecrease;
|
||||
}
|
||||
break;
|
||||
case BandwidthUsage::kBwUnderusing:
|
||||
rate_control_state_ = kRcHold;
|
||||
rate_control_state_ = RateControlState::kRcHold;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
|
||||
@ -65,6 +65,8 @@ class AimdRateControl {
|
||||
TimeDelta GetExpectedBandwidthPeriod() const;
|
||||
|
||||
private:
|
||||
enum class RateControlState { kRcHold, kRcIncrease, kRcDecrease };
|
||||
|
||||
friend class GoogCcStatePrinter;
|
||||
// Update the target bitrate based on, among other things, the current rate
|
||||
// control state, the current target bitrate and the estimated throughput.
|
||||
|
||||
@ -17,9 +17,6 @@
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "api/units/data_rate.h"
|
||||
|
||||
#define BWE_MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define BWE_MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
namespace congestion_controller {
|
||||
@ -39,8 +36,6 @@ enum BweNames {
|
||||
kBweNamesMax = 4
|
||||
};
|
||||
|
||||
enum RateControlState { kRcHold, kRcIncrease, kRcDecrease };
|
||||
|
||||
struct RateControlInput {
|
||||
RateControlInput(BandwidthUsage bw_state,
|
||||
const absl::optional<DataRate>& estimated_throughput);
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/remote_bitrate_estimator/test/bwe_test_logging.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/numerics/safe_minmax.h"
|
||||
|
||||
@ -12,8 +12,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "api/transport/webrtc_key_value_config.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "modules/remote_bitrate_estimator/test/bwe_test_logging.h"
|
||||
#include "rtc_base/logging.h"
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "api/transport/field_trial_based_config.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/call/transport.h"
|
||||
#include "api/video/video_bitrate_allocation.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
|
||||
#include "modules/rtp_rtcp/include/receive_statistics.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
|
||||
@ -340,6 +340,7 @@ if (!build_with_chromium) {
|
||||
deps = [
|
||||
":chart_proto",
|
||||
"../api:function_view",
|
||||
"../api:network_state_predictor_api",
|
||||
"../rtc_base:deprecation",
|
||||
"../rtc_base:ignore_wundef",
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
#include "absl/algorithm/container.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/function_view.h"
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "api/transport/field_trial_based_config.h"
|
||||
#include "api/transport/goog_cc_factory.h"
|
||||
#include "call/audio_receive_stream.h"
|
||||
@ -38,7 +39,6 @@
|
||||
#include "modules/congestion_controller/rtp/transport_feedback_adapter.h"
|
||||
#include "modules/pacing/paced_sender.h"
|
||||
#include "modules/pacing/packet_router.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user