Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Unified Diff: webrtc/modules/bitrate_controller/bitrate_controller_impl.cc

Issue 1947873002: Reland of Remove SendPacer from ViEEncoder (patchset #13 id:240001 of https://codereview.we… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed CongestionController backwards compatibility Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/bitrate_controller/bitrate_controller_impl.cc
diff --git a/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc b/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc
index 3c0d37c3b04c66c974f9b8830ba7a4cb47c127db..09652d84194207b9742f10e0bb67690a1dd1a27b 100644
--- a/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc
+++ b/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc
@@ -83,6 +83,10 @@ BitrateController* BitrateController::CreateBitrateController(
return new BitrateControllerImpl(clock, observer);
}
+BitrateController* BitrateController::CreateBitrateController(Clock* clock) {
+ return new BitrateControllerImpl(clock, nullptr);
+}
+
BitrateControllerImpl::BitrateControllerImpl(Clock* clock,
BitrateObserver* observer)
: clock_(clock),
@@ -94,8 +98,8 @@ BitrateControllerImpl::BitrateControllerImpl(Clock* clock,
last_fraction_loss_(0),
last_rtt_ms_(0),
last_reserved_bitrate_bps_(0) {
- // This calls the observer_, which means that the observer provided by the
- // user must be ready to accept a bitrate update when it constructs the
+ // This calls the observer_ if set, which means that the observer provided by
+ // the user must be ready to accept a bitrate update when it constructs the
// controller. We do this to avoid having to keep synchronized initial values
// in both the controller and the allocator.
MaybeTriggerOnNetworkChanged();
@@ -199,11 +203,15 @@ void BitrateControllerImpl::OnReceivedRtcpReceiverReport(
}
void BitrateControllerImpl::MaybeTriggerOnNetworkChanged() {
- uint32_t bitrate;
+ if (!observer_)
+ return;
+
+ uint32_t bitrate_bps;
uint8_t fraction_loss;
int64_t rtt;
- if (GetNetworkParameters(&bitrate, &fraction_loss, &rtt))
- observer_->OnNetworkChanged(bitrate, fraction_loss, rtt);
+
+ if (GetNetworkParameters(&bitrate_bps, &fraction_loss, &rtt))
+ observer_->OnNetworkChanged(bitrate_bps, fraction_loss, rtt);
}
bool BitrateControllerImpl::GetNetworkParameters(uint32_t* bitrate,

Powered by Google App Engine
This is Rietveld 408576698