Detach RemoteEstimatorProxy from RemoteBitrateEstimator interface

Bug: None
Change-Id: I47b7c83320b0c7327c0d2ee59f7a0a30704cd331
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266540
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37354}
This commit is contained in:
Danil Chapovalov
2022-06-27 11:41:16 +02:00
committed by WebRTC LUCI CQ
parent 7769dc87d7
commit 08c7e75892
6 changed files with 61 additions and 112 deletions

View File

@ -47,11 +47,6 @@ class ReceiveSideCongestionController : public CallStatsObserver {
const RTPHeader& header);
void SetSendPeriodicFeedback(bool send_periodic_feedback);
// TODO(nisse): Delete these methods, design a more specific interface.
[[deprecated]] virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator(
bool send_side_bwe);
[[deprecated]] virtual const RemoteBitrateEstimator*
GetRemoteBitrateEstimator(bool send_side_bwe) const;
// Implements CallStatsObserver.
void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;
@ -122,6 +117,7 @@ class ReceiveSideCongestionController : public CallStatsObserver {
int min_bitrate_bps_;
};
Clock& clock_;
const FieldTrialBasedConfig field_trial_config_;
RembThrottler remb_throttler_;
WrappingBitrateEstimator remote_bitrate_estimator_;

View File

@ -124,10 +124,10 @@ ReceiveSideCongestionController::ReceiveSideCongestionController(
RemoteEstimatorProxy::TransportFeedbackSender feedback_sender,
RembThrottler::RembSender remb_sender,
NetworkStateEstimator* network_state_estimator)
: remb_throttler_(std::move(remb_sender), clock),
: clock_(*clock),
remb_throttler_(std::move(remb_sender), clock),
remote_bitrate_estimator_(&remb_throttler_, clock),
remote_estimator_proxy_(clock,
std::move(feedback_sender),
remote_estimator_proxy_(std::move(feedback_sender),
&field_trial_config_,
network_state_estimator) {}
@ -148,25 +148,6 @@ void ReceiveSideCongestionController::SetSendPeriodicFeedback(
remote_estimator_proxy_.SetSendPeriodicFeedback(send_periodic_feedback);
}
RemoteBitrateEstimator*
ReceiveSideCongestionController::GetRemoteBitrateEstimator(bool send_side_bwe) {
if (send_side_bwe) {
return &remote_estimator_proxy_;
} else {
return &remote_bitrate_estimator_;
}
}
const RemoteBitrateEstimator*
ReceiveSideCongestionController::GetRemoteBitrateEstimator(
bool send_side_bwe) const {
if (send_side_bwe) {
return &remote_estimator_proxy_;
} else {
return &remote_bitrate_estimator_;
}
}
DataRate ReceiveSideCongestionController::LatestReceiveSideEstimate() const {
std::vector<uint32_t> unused_ssrcs;
uint32_t bitrate_bps = 0;
@ -199,18 +180,16 @@ void ReceiveSideCongestionController::Process() {
}
TimeDelta ReceiveSideCongestionController::MaybeProcess() {
Timestamp now = clock_.CurrentTime();
int64_t time_until_rbe_ms = remote_bitrate_estimator_.TimeUntilNextProcess();
if (time_until_rbe_ms <= 0) {
remote_bitrate_estimator_.Process();
time_until_rbe_ms = remote_bitrate_estimator_.TimeUntilNextProcess();
}
int64_t time_until_rep_ms = remote_estimator_proxy_.TimeUntilNextProcess();
if (time_until_rep_ms <= 0) {
remote_estimator_proxy_.Process();
time_until_rep_ms = remote_estimator_proxy_.TimeUntilNextProcess();
}
int64_t time_until_next_ms = std::min(time_until_rbe_ms, time_until_rep_ms);
return TimeDelta::Millis(std::max<int64_t>(time_until_next_ms, 0));
TimeDelta time_until_rbe = TimeDelta::Millis(time_until_rbe_ms);
TimeDelta time_until_rep = remote_estimator_proxy_.Process(now);
TimeDelta time_until = std::min(time_until_rbe, time_until_rep);
return std::max(time_until, TimeDelta::Zero());
}
void ReceiveSideCongestionController::SetMaxDesiredReceiveBitrate(

View File

@ -16,7 +16,7 @@
#include "api/units/data_rate.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "modules/remote_bitrate_estimator/remote_estimator_proxy.h"
#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
#include "rtc_base/synchronization/mutex.h"
namespace webrtc {