Revert "Reland "Using units in SendSideBandwidthEstimation.""
This reverts commit e2cb26cb4fa2a3ce7c12636225ba9c720d7c7e56.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Reland "Using units in SendSideBandwidthEstimation."
>
> This reverts commit 917e5967a597fa8d6e6cae9ffccb21e3d35d553b.
>
> Reason for revert: Handling downstream use case.
>
> Original change's description:
> > Revert "Using units in SendSideBandwidthEstimation."
> >
> > This reverts commit 35b5e5f3b0dc409bf571b3609860ad5bb8e00c29.
> >
> > Reason for revert: Breaks downstream project
> >
> > Original change's description:
> > > Using units in SendSideBandwidthEstimation.
> > >
> > > This CL moves SendSideBandwidthEstimation to use the unit types
> > > DataRate, TimeDelta and Timestamp. This prepares for upcoming changes.
> > >
> > > Bug: webrtc:9718
> > > Change-Id: If10e329920dda037b53055ff3352ae7f8d7e32b8
> > > Reviewed-on: https://webrtc-review.googlesource.com/c/104021
> > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#25029}
> >
> > TBR=terelius@webrtc.org,srte@webrtc.org
> >
> > No-Try: True
> > Bug: webrtc:9718
> > Change-Id: Iaf470f1eec9911ee6fc7c1b4f5db9675d89d3780
> > Reviewed-on: https://webrtc-review.googlesource.com/c/104480
> > Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
> > Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#25035}
>
> TBR=oprypin@webrtc.org,terelius@webrtc.org,srte@webrtc.org
>
> Change-Id: I0940791fcd1e196598b0f0a2ec779c49931ee5df
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:9718
> Reviewed-on: https://webrtc-review.googlesource.com/c/104520
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25036}
TBR=oprypin@webrtc.org,terelius@webrtc.org,srte@webrtc.org
Change-Id: I6628771c79fc78dfd856649ae92232e95df63495
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9718
Reviewed-on: https://webrtc-review.googlesource.com/c/104540
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25037}
diff --git a/modules/bitrate_controller/bitrate_controller_impl.cc b/modules/bitrate_controller/bitrate_controller_impl.cc
index 93045b7..9b816f6 100644
--- a/modules/bitrate_controller/bitrate_controller_impl.cc
+++ b/modules/bitrate_controller/bitrate_controller_impl.cc
@@ -20,18 +20,7 @@
#include "rtc_base/logging.h"
namespace webrtc {
-namespace {
-absl::optional<DataRate> ToOptionalDataRate(int start_bitrate_bps) {
- if (start_bitrate_bps == -1)
- return absl::nullopt;
- return DataRate::bps(start_bitrate_bps);
-}
-DataRate MaxRate(int max_bitrate_bps) {
- if (max_bitrate_bps == -1)
- return DataRate::Infinity();
- return DataRate::bps(max_bitrate_bps);
-}
-} // namespace
+
class BitrateControllerImpl::RtcpBandwidthObserverImpl
: public RtcpBandwidthObserver {
public:
@@ -91,9 +80,7 @@
void BitrateControllerImpl::SetStartBitrate(int start_bitrate_bps) {
{
rtc::CritScope cs(&critsect_);
- bandwidth_estimation_.SetSendBitrate(
- DataRate::bps(start_bitrate_bps),
- Timestamp::ms(clock_->TimeInMilliseconds()));
+ bandwidth_estimation_.SetSendBitrate(start_bitrate_bps);
}
MaybeTriggerOnNetworkChanged();
}
@@ -102,8 +89,7 @@
int max_bitrate_bps) {
{
rtc::CritScope cs(&critsect_);
- bandwidth_estimation_.SetMinMaxBitrate(DataRate::bps(min_bitrate_bps),
- DataRate::bps(max_bitrate_bps));
+ bandwidth_estimation_.SetMinMaxBitrate(min_bitrate_bps, max_bitrate_bps);
}
MaybeTriggerOnNetworkChanged();
}
@@ -113,9 +99,8 @@
int max_bitrate_bps) {
{
rtc::CritScope cs(&critsect_);
- bandwidth_estimation_.SetBitrates(
- ToOptionalDataRate(start_bitrate_bps), DataRate::bps(min_bitrate_bps),
- MaxRate(max_bitrate_bps), Timestamp::ms(clock_->TimeInMilliseconds()));
+ bandwidth_estimation_.SetBitrates(start_bitrate_bps, min_bitrate_bps,
+ max_bitrate_bps);
}
MaybeTriggerOnNetworkChanged();
}
@@ -126,9 +111,8 @@
{
rtc::CritScope cs(&critsect_);
bandwidth_estimation_ = SendSideBandwidthEstimation(event_log_);
- bandwidth_estimation_.SetBitrates(
- ToOptionalDataRate(bitrate_bps), DataRate::bps(min_bitrate_bps),
- MaxRate(max_bitrate_bps), Timestamp::ms(clock_->TimeInMilliseconds()));
+ bandwidth_estimation_.SetBitrates(bitrate_bps, min_bitrate_bps,
+ max_bitrate_bps);
}
MaybeTriggerOnNetworkChanged();
}
@@ -137,8 +121,8 @@
void BitrateControllerImpl::OnReceivedEstimatedBitrate(uint32_t bitrate) {
{
rtc::CritScope cs(&critsect_);
- bandwidth_estimation_.UpdateReceiverEstimate(
- Timestamp::ms(clock_->TimeInMilliseconds()), DataRate::bps(bitrate));
+ bandwidth_estimation_.UpdateReceiverEstimate(clock_->TimeInMilliseconds(),
+ bitrate);
BWE_TEST_LOGGING_PLOT(1, "REMB_kbps", clock_->TimeInMilliseconds(),
bitrate / 1000);
}
@@ -152,15 +136,12 @@
{
rtc::CritScope cs(&critsect_);
if (result.probe) {
- bandwidth_estimation_.SetSendBitrate(
- DataRate::bps(result.target_bitrate_bps),
- Timestamp::ms(clock_->TimeInMilliseconds()));
+ bandwidth_estimation_.SetSendBitrate(result.target_bitrate_bps);
}
// Since SetSendBitrate now resets the delay-based estimate, we have to call
// UpdateDelayBasedEstimate after SetSendBitrate.
- bandwidth_estimation_.UpdateDelayBasedEstimate(
- Timestamp::ms(clock_->TimeInMilliseconds()),
- DataRate::bps(result.target_bitrate_bps));
+ bandwidth_estimation_.UpdateDelayBasedEstimate(clock_->TimeInMilliseconds(),
+ result.target_bitrate_bps);
}
MaybeTriggerOnNetworkChanged();
}
@@ -177,8 +158,7 @@
void BitrateControllerImpl::Process() {
{
rtc::CritScope cs(&critsect_);
- bandwidth_estimation_.UpdateEstimate(
- Timestamp::ms(clock_->TimeInMilliseconds()));
+ bandwidth_estimation_.UpdateEstimate(clock_->TimeInMilliseconds());
}
MaybeTriggerOnNetworkChanged();
last_bitrate_update_ms_ = clock_->TimeInMilliseconds();
@@ -233,9 +213,8 @@
RTC_DCHECK_GE(total_number_of_packets, 0);
- bandwidth_estimation_.UpdateReceiverBlock(
- fraction_lost_aggregate, TimeDelta::ms(rtt), total_number_of_packets,
- Timestamp::ms(now_ms));
+ bandwidth_estimation_.UpdateReceiverBlock(fraction_lost_aggregate, rtt,
+ total_number_of_packets, now_ms);
}
MaybeTriggerOnNetworkChanged();
}