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

Unified Diff: webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc

Issue 2532113002: Only create |remote_rate| when needed in RemoteBitrateEstimatorSingleStream. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc
diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc
index 6730cbb611a1a94431d5e9d464a001f44a5a1bff..b689aa62b844b4a49019772fc54d630cfcfa3433 100644
--- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc
+++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc
@@ -133,7 +133,7 @@ void RemoteBitrateEstimatorSingleStream::IncomingPacket(
incoming_bitrate_.Rate(now_ms);
if (incoming_bitrate_bps &&
(prior_state != kBwOverusing ||
- remote_rate_->TimeToReduceFurther(now_ms, *incoming_bitrate_bps))) {
+ GetRemoteRate()->TimeToReduceFurther(now_ms, *incoming_bitrate_bps))) {
brandtr 2016/11/28 13:17:18 This change (and the one at the end) do not seem t
// The first overuse should immediately trigger a new estimate.
// We also have to update the estimate immediately if we are overusing
// and the target bitrate is too high compared to what we are receiving.
@@ -189,19 +189,19 @@ void RemoteBitrateEstimatorSingleStream::UpdateEstimate(int64_t now_ms) {
}
// We can't update the estimate if we don't have any active streams.
if (overuse_detectors_.empty()) {
- remote_rate_.reset(new AimdRateControl());
return;
}
+ AimdRateControl* remote_rate = GetRemoteRate();
double mean_noise_var = sum_var_noise /
static_cast<double>(overuse_detectors_.size());
const RateControlInput input(bw_state,
incoming_bitrate_.Rate(now_ms),
mean_noise_var);
- remote_rate_->Update(&input, now_ms);
- uint32_t target_bitrate = remote_rate_->UpdateBandwidthEstimate(now_ms);
- if (remote_rate_->ValidEstimate()) {
- process_interval_ms_ = remote_rate_->GetFeedbackInterval();
+ remote_rate->Update(&input, now_ms);
+ uint32_t target_bitrate = remote_rate->UpdateBandwidthEstimate(now_ms);
+ if (remote_rate->ValidEstimate()) {
+ process_interval_ms_ = remote_rate->GetFeedbackInterval();
std::vector<uint32_t> ssrcs;
GetSsrcs(&ssrcs);
observer_->OnReceiveBitrateChanged(ssrcs, target_bitrate);
@@ -211,7 +211,7 @@ void RemoteBitrateEstimatorSingleStream::UpdateEstimate(int64_t now_ms) {
void RemoteBitrateEstimatorSingleStream::OnRttUpdate(int64_t avg_rtt_ms,
int64_t max_rtt_ms) {
CriticalSectionScoped cs(crit_sect_.get());
- remote_rate_->SetRtt(avg_rtt_ms);
+ GetRemoteRate()->SetRtt(avg_rtt_ms);
}
void RemoteBitrateEstimatorSingleStream::RemoveStream(unsigned int ssrc) {
@@ -250,6 +250,12 @@ void RemoteBitrateEstimatorSingleStream::GetSsrcs(
}
}
+AimdRateControl* RemoteBitrateEstimatorSingleStream::GetRemoteRate() {
+ if (!remote_rate_)
+ remote_rate_.reset(new AimdRateControl());
+ return remote_rate_.get();
+}
+
void RemoteBitrateEstimatorSingleStream::SetMinBitrate(int min_bitrate_bps) {
CriticalSectionScoped cs(crit_sect_.get());
remote_rate_->SetMinBitrate(min_bitrate_bps);
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698