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..deb9133b74945eaff443a7a3364ab082147e1e27 100644 |
--- a/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc |
+++ b/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc |
@@ -15,6 +15,8 @@ |
#include <map> |
#include <utility> |
+#include "webrtc/base/checks.h" |
+#include "webrtc/base/logging.h" |
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
namespace webrtc { |
@@ -83,6 +85,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 +100,10 @@ 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 |
+ // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC. |
+ // This is left for code that is not yet updated. |
stefan-webrtc
2016/05/02 12:56:47
Maybe move this to the .h file by the observer poi
perkj_webrtc
2016/05/02 14:45:35
Done.
|
+ // 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 +207,16 @@ 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, |
@@ -227,6 +240,7 @@ bool BitrateControllerImpl::GetNetworkParameters(uint32_t* bitrate, |
last_reserved_bitrate_bps_ = reserved_bitrate_bps_; |
new_bitrate = true; |
} |
+ |
return new_bitrate; |
} |