Cleanup ReceiveSideCongestionController internal dependency on RTPHeader
Bug: webrtc:14859
Change-Id: Ic7d1c904cfd0a68b3ec45e5cee6eace95667b239
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/296824
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39532}
diff --git a/modules/congestion_controller/include/receive_side_congestion_controller.h b/modules/congestion_controller/include/receive_side_congestion_controller.h
index 82f098c..8e0f755 100644
--- a/modules/congestion_controller/include/receive_side_congestion_controller.h
+++ b/modules/congestion_controller/include/receive_side_congestion_controller.h
@@ -74,9 +74,8 @@
TimeDelta MaybeProcess();
private:
- void PickEstimatorFromHeader(const RTPHeader& header)
+ void PickEstimator(bool has_absolute_send_time)
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
- void PickEstimator() RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
Clock& clock_;
RembThrottler remb_throttler_;
diff --git a/modules/congestion_controller/receive_side_congestion_controller.cc b/modules/congestion_controller/receive_side_congestion_controller.cc
index 9352e50..cc31469 100644
--- a/modules/congestion_controller/receive_side_congestion_controller.cc
+++ b/modules/congestion_controller/receive_side_congestion_controller.cc
@@ -40,15 +40,16 @@
return rbe_->LatestEstimate();
}
-void ReceiveSideCongestionController::PickEstimatorFromHeader(
- const RTPHeader& header) {
- if (header.extension.hasAbsoluteSendTime) {
+void ReceiveSideCongestionController::PickEstimator(
+ bool has_absolute_send_time) {
+ if (has_absolute_send_time) {
// If we see AST in header, switch RBE strategy immediately.
if (!using_absolute_send_time_) {
RTC_LOG(LS_INFO)
<< "WrappingBitrateEstimator: Switching to absolute send time RBE.";
using_absolute_send_time_ = true;
- PickEstimator();
+ rbe_ = std::make_unique<RemoteBitrateEstimatorAbsSendTime>(
+ &remb_throttler_, &clock_);
}
packets_since_absolute_send_time_ = 0;
} else {
@@ -60,23 +61,13 @@
<< "WrappingBitrateEstimator: Switching to transmission "
"time offset RBE.";
using_absolute_send_time_ = false;
- PickEstimator();
+ rbe_ = std::make_unique<RemoteBitrateEstimatorSingleStream>(
+ &remb_throttler_, &clock_);
}
}
}
}
-// Instantiate RBE for Time Offset or Absolute Send Time extensions.
-void ReceiveSideCongestionController::PickEstimator() {
- if (using_absolute_send_time_) {
- rbe_ = std::make_unique<RemoteBitrateEstimatorAbsSendTime>(&remb_throttler_,
- &clock_);
- } else {
- rbe_ = std::make_unique<RemoteBitrateEstimatorSingleStream>(
- &remb_throttler_, &clock_);
- }
-}
-
ReceiveSideCongestionController::ReceiveSideCongestionController(
Clock* clock,
RemoteEstimatorProxy::TransportFeedbackSender feedback_sender,
@@ -109,7 +100,7 @@
MutexLock lock(&mutex_);
RTPHeader header;
packet.GetHeader(&header);
- PickEstimatorFromHeader(header);
+ PickEstimator(packet.HasExtension<AbsoluteSendTime>());
rbe_->IncomingPacket(packet.arrival_time().ms(),
packet.payload_size() + packet.padding_size(), header);
}
@@ -123,7 +114,7 @@
if (!header.extension.hasTransportSequenceNumber) {
// Receive-side BWE.
MutexLock lock(&mutex_);
- PickEstimatorFromHeader(header);
+ PickEstimator(header.extension.hasAbsoluteSendTime);
rbe_->IncomingPacket(arrival_time_ms, payload_size, header);
}
}