2016-06-17 09:21:34 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-02-14 09:08:28 +00:00
|
|
|
#include "modules/congestion_controller/delay_based_bwe.h"
|
2016-06-17 09:21:34 -07:00
|
|
|
|
|
|
|
|
#include <algorithm>
|
2016-10-27 17:19:20 +02:00
|
|
|
#include <cmath>
|
2017-12-12 12:09:31 +01:00
|
|
|
#include <cstdio>
|
2016-11-17 03:48:18 -08:00
|
|
|
#include <string>
|
2016-06-17 09:21:34 -07:00
|
|
|
|
2017-10-03 16:11:34 +02:00
|
|
|
#include "logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "logging/rtc_event_log/rtc_event_log.h"
|
2018-02-14 09:08:28 +00:00
|
|
|
#include "modules/congestion_controller/trendline_estimator.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/pacing/paced_sender.h"
|
|
|
|
|
#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
|
|
|
|
|
#include "modules/remote_bitrate_estimator/test/bwe_test_logging.h"
|
|
|
|
|
#include "rtc_base/checks.h"
|
|
|
|
|
#include "rtc_base/constructormagic.h"
|
|
|
|
|
#include "rtc_base/logging.h"
|
2017-10-03 16:11:34 +02:00
|
|
|
#include "rtc_base/ptr_util.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/thread_annotations.h"
|
|
|
|
|
#include "system_wrappers/include/field_trial.h"
|
|
|
|
|
#include "system_wrappers/include/metrics.h"
|
2017-09-15 13:58:09 +02:00
|
|
|
#include "typedefs.h" // NOLINT(build/include)
|
2016-06-17 09:21:34 -07:00
|
|
|
|
|
|
|
|
namespace {
|
2016-08-16 10:59:36 +02:00
|
|
|
constexpr int kTimestampGroupLengthMs = 5;
|
|
|
|
|
constexpr int kAbsSendTimeFraction = 18;
|
|
|
|
|
constexpr int kAbsSendTimeInterArrivalUpshift = 8;
|
|
|
|
|
constexpr int kInterArrivalShift =
|
|
|
|
|
kAbsSendTimeFraction + kAbsSendTimeInterArrivalUpshift;
|
|
|
|
|
constexpr double kTimestampToMs =
|
2016-06-17 09:21:34 -07:00
|
|
|
1000.0 / static_cast<double>(1 << kInterArrivalShift);
|
2016-08-16 10:59:36 +02:00
|
|
|
// This ssrc is used to fulfill the current API but will be removed
|
|
|
|
|
// after the API has been changed.
|
|
|
|
|
constexpr uint32_t kFixedSsrc = 0;
|
2016-10-27 17:19:20 +02:00
|
|
|
|
2016-12-09 05:50:01 -08:00
|
|
|
// Parameters for linear least squares fit of regression line to noisy data.
|
2017-04-01 06:51:09 -07:00
|
|
|
constexpr size_t kDefaultTrendlineWindowSize = 20;
|
2016-11-17 03:48:18 -08:00
|
|
|
constexpr double kDefaultTrendlineSmoothingCoeff = 0.9;
|
|
|
|
|
constexpr double kDefaultTrendlineThresholdGain = 4.0;
|
|
|
|
|
|
2017-02-13 09:08:22 -08:00
|
|
|
constexpr int kMaxConsecutiveFailedLookups = 5;
|
|
|
|
|
|
2017-10-06 08:43:34 +02:00
|
|
|
const char kBweWindowSizeInPacketsExperiment[] =
|
|
|
|
|
"WebRTC-BweWindowSizeInPackets";
|
2017-05-02 01:04:26 -07:00
|
|
|
|
2017-10-06 08:43:34 +02:00
|
|
|
size_t ReadTrendlineFilterWindowSize() {
|
2017-05-02 01:04:26 -07:00
|
|
|
std::string experiment_string =
|
2017-10-06 08:43:34 +02:00
|
|
|
webrtc::field_trial::FindFullName(kBweWindowSizeInPacketsExperiment);
|
|
|
|
|
size_t window_size;
|
|
|
|
|
int parsed_values =
|
|
|
|
|
sscanf(experiment_string.c_str(), "Enabled-%zu", &window_size);
|
|
|
|
|
if (parsed_values == 1) {
|
|
|
|
|
if (window_size > 1)
|
|
|
|
|
return window_size;
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(WARNING) << "Window size must be greater than 1.";
|
2017-10-06 08:43:34 +02:00
|
|
|
}
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_WARNING) << "Failed to parse parameters for BweTrendlineFilter "
|
|
|
|
|
"experiment from field trial string. Using default.";
|
2017-10-06 08:43:34 +02:00
|
|
|
return kDefaultTrendlineWindowSize;
|
2017-05-02 01:04:26 -07:00
|
|
|
}
|
2016-06-17 09:21:34 -07:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
2016-11-17 03:48:18 -08:00
|
|
|
|
2017-07-31 04:23:25 -07:00
|
|
|
DelayBasedBwe::Result::Result()
|
|
|
|
|
: updated(false),
|
|
|
|
|
probe(false),
|
|
|
|
|
target_bitrate_bps(0),
|
|
|
|
|
recovered_from_overuse(false) {}
|
|
|
|
|
|
|
|
|
|
DelayBasedBwe::Result::Result(bool probe, uint32_t target_bitrate_bps)
|
|
|
|
|
: updated(true),
|
|
|
|
|
probe(probe),
|
|
|
|
|
target_bitrate_bps(target_bitrate_bps),
|
|
|
|
|
recovered_from_overuse(false) {}
|
|
|
|
|
|
|
|
|
|
DelayBasedBwe::Result::~Result() {}
|
|
|
|
|
|
Revert "Revert "Revert "Reland "Moved congestion controller to task queue.""""
This reverts commit 65792c5a5c542201f7b9feefded505842692e6ed.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Revert "Reland "Moved congestion controller to task queue."""
>
> This reverts commit 4e849f6925b2ac44b0957a228d7131fc391fca54.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Revert "Reland "Moved congestion controller to task queue.""
> >
> > This reverts commit 57daeb7ac7f3d80992905b53fea500953fcfd793.
> >
> > Reason for revert: Cause increased congestion and deadlocks in downstream project
> >
> > Original change's description:
> > > Reland "Moved congestion controller to task queue."
> > >
> > > This is a reland of 0cbcba7ea0dced1a7f353c64d6cf91d46ccb29f9.
> > >
> > > Original change's description:
> > > > Moved congestion controller to task queue.
> > > >
> > > > The goal of this work is to make it easier to experiment with the
> > > > bandwidth estimation implementation. For this reason network control
> > > > functionality is moved from SendSideCongestionController(SSCC),
> > > > PacedSender and BitrateController to the newly created
> > > > GoogCcNetworkController which implements the newly created
> > > > NetworkControllerInterface. This allows the implementation to be
> > > > replaced at runtime in the future.
> > > >
> > > > This is the first part of a split of a larger CL, see:
> > > > https://webrtc-review.googlesource.com/c/src/+/39788/8
> > > > For further explanations.
> > > >
> > > > Bug: webrtc:8415
> > > > Change-Id: I770189c04cc31b313bd4e57821acff55fbcb1ad3
> > > > Reviewed-on: https://webrtc-review.googlesource.com/43840
> > > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > > Cr-Commit-Position: refs/heads/master@{#21868}
> > >
> > > Bug: webrtc:8415
> > > Change-Id: I1d1756a30deed5b421b1c91c1918a13b6bb455da
> > > Reviewed-on: https://webrtc-review.googlesource.com/48000
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#21899}
> >
> > TBR=terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: webrtc:8415
> > Change-Id: Ida8074dcac2cc28b3629228eb22846d8a8e81b83
> > Reviewed-on: https://webrtc-review.googlesource.com/52980
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22017}
>
> TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
>
> Change-Id: I3393b74370c4f4d0955f50728005b2b925be169b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8415
> Reviewed-on: https://webrtc-review.googlesource.com/53262
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22023}
TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
Change-Id: Id68ad986ee51142b7be3381d0793709b4392fe2c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8415
Reviewed-on: https://webrtc-review.googlesource.com/53360
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22024}
2018-02-14 16:53:38 +00:00
|
|
|
DelayBasedBwe::DelayBasedBwe(RtcEventLog* event_log, const Clock* clock)
|
2017-04-01 06:51:09 -07:00
|
|
|
: event_log_(event_log),
|
Revert "Revert "Revert "Reland "Moved congestion controller to task queue.""""
This reverts commit 65792c5a5c542201f7b9feefded505842692e6ed.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Revert "Reland "Moved congestion controller to task queue."""
>
> This reverts commit 4e849f6925b2ac44b0957a228d7131fc391fca54.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Revert "Reland "Moved congestion controller to task queue.""
> >
> > This reverts commit 57daeb7ac7f3d80992905b53fea500953fcfd793.
> >
> > Reason for revert: Cause increased congestion and deadlocks in downstream project
> >
> > Original change's description:
> > > Reland "Moved congestion controller to task queue."
> > >
> > > This is a reland of 0cbcba7ea0dced1a7f353c64d6cf91d46ccb29f9.
> > >
> > > Original change's description:
> > > > Moved congestion controller to task queue.
> > > >
> > > > The goal of this work is to make it easier to experiment with the
> > > > bandwidth estimation implementation. For this reason network control
> > > > functionality is moved from SendSideCongestionController(SSCC),
> > > > PacedSender and BitrateController to the newly created
> > > > GoogCcNetworkController which implements the newly created
> > > > NetworkControllerInterface. This allows the implementation to be
> > > > replaced at runtime in the future.
> > > >
> > > > This is the first part of a split of a larger CL, see:
> > > > https://webrtc-review.googlesource.com/c/src/+/39788/8
> > > > For further explanations.
> > > >
> > > > Bug: webrtc:8415
> > > > Change-Id: I770189c04cc31b313bd4e57821acff55fbcb1ad3
> > > > Reviewed-on: https://webrtc-review.googlesource.com/43840
> > > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > > Cr-Commit-Position: refs/heads/master@{#21868}
> > >
> > > Bug: webrtc:8415
> > > Change-Id: I1d1756a30deed5b421b1c91c1918a13b6bb455da
> > > Reviewed-on: https://webrtc-review.googlesource.com/48000
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#21899}
> >
> > TBR=terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: webrtc:8415
> > Change-Id: Ida8074dcac2cc28b3629228eb22846d8a8e81b83
> > Reviewed-on: https://webrtc-review.googlesource.com/52980
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22017}
>
> TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
>
> Change-Id: I3393b74370c4f4d0955f50728005b2b925be169b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8415
> Reviewed-on: https://webrtc-review.googlesource.com/53262
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22023}
TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
Change-Id: Id68ad986ee51142b7be3381d0793709b4392fe2c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8415
Reviewed-on: https://webrtc-review.googlesource.com/53360
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22024}
2018-02-14 16:53:38 +00:00
|
|
|
clock_(clock),
|
2016-06-17 09:21:34 -07:00
|
|
|
inter_arrival_(),
|
2018-02-01 15:48:14 +01:00
|
|
|
delay_detector_(),
|
2016-08-16 10:59:36 +02:00
|
|
|
last_seen_packet_ms_(-1),
|
2016-11-17 03:48:18 -08:00
|
|
|
uma_recorded_(false),
|
2017-03-28 04:18:02 -07:00
|
|
|
probe_bitrate_estimator_(event_log),
|
2017-10-06 08:43:34 +02:00
|
|
|
trendline_window_size_(
|
|
|
|
|
webrtc::field_trial::IsEnabled(kBweWindowSizeInPacketsExperiment)
|
|
|
|
|
? ReadTrendlineFilterWindowSize()
|
|
|
|
|
: kDefaultTrendlineWindowSize),
|
2016-11-17 03:48:18 -08:00
|
|
|
trendline_smoothing_coeff_(kDefaultTrendlineSmoothingCoeff),
|
|
|
|
|
trendline_threshold_gain_(kDefaultTrendlineThresholdGain),
|
2017-02-17 03:38:28 -08:00
|
|
|
consecutive_delayed_feedbacks_(0),
|
2017-10-02 14:00:13 +02:00
|
|
|
prev_bitrate_(0),
|
2017-12-14 11:58:19 +01:00
|
|
|
prev_state_(BandwidthUsage::kBwNormal) {
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_INFO)
|
2017-10-06 08:43:34 +02:00
|
|
|
<< "Using Trendline filter for delay change estimation with window size "
|
|
|
|
|
<< trendline_window_size_;
|
2018-02-01 15:48:14 +01:00
|
|
|
delay_detector_.reset(new TrendlineEstimator(trendline_window_size_,
|
|
|
|
|
trendline_smoothing_coeff_,
|
|
|
|
|
trendline_threshold_gain_));
|
2016-06-17 09:21:34 -07:00
|
|
|
}
|
|
|
|
|
|
2017-05-31 02:24:52 -07:00
|
|
|
DelayBasedBwe::~DelayBasedBwe() {}
|
|
|
|
|
|
2016-09-30 10:06:51 +02:00
|
|
|
DelayBasedBwe::Result DelayBasedBwe::IncomingPacketFeedbackVector(
|
2017-06-11 23:57:17 -07:00
|
|
|
const std::vector<PacketFeedback>& packet_feedback_vector,
|
Revert "Revert "Revert "Reland "Moved congestion controller to task queue.""""
This reverts commit 65792c5a5c542201f7b9feefded505842692e6ed.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Revert "Reland "Moved congestion controller to task queue."""
>
> This reverts commit 4e849f6925b2ac44b0957a228d7131fc391fca54.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Revert "Reland "Moved congestion controller to task queue.""
> >
> > This reverts commit 57daeb7ac7f3d80992905b53fea500953fcfd793.
> >
> > Reason for revert: Cause increased congestion and deadlocks in downstream project
> >
> > Original change's description:
> > > Reland "Moved congestion controller to task queue."
> > >
> > > This is a reland of 0cbcba7ea0dced1a7f353c64d6cf91d46ccb29f9.
> > >
> > > Original change's description:
> > > > Moved congestion controller to task queue.
> > > >
> > > > The goal of this work is to make it easier to experiment with the
> > > > bandwidth estimation implementation. For this reason network control
> > > > functionality is moved from SendSideCongestionController(SSCC),
> > > > PacedSender and BitrateController to the newly created
> > > > GoogCcNetworkController which implements the newly created
> > > > NetworkControllerInterface. This allows the implementation to be
> > > > replaced at runtime in the future.
> > > >
> > > > This is the first part of a split of a larger CL, see:
> > > > https://webrtc-review.googlesource.com/c/src/+/39788/8
> > > > For further explanations.
> > > >
> > > > Bug: webrtc:8415
> > > > Change-Id: I770189c04cc31b313bd4e57821acff55fbcb1ad3
> > > > Reviewed-on: https://webrtc-review.googlesource.com/43840
> > > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > > Cr-Commit-Position: refs/heads/master@{#21868}
> > >
> > > Bug: webrtc:8415
> > > Change-Id: I1d1756a30deed5b421b1c91c1918a13b6bb455da
> > > Reviewed-on: https://webrtc-review.googlesource.com/48000
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#21899}
> >
> > TBR=terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: webrtc:8415
> > Change-Id: Ida8074dcac2cc28b3629228eb22846d8a8e81b83
> > Reviewed-on: https://webrtc-review.googlesource.com/52980
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22017}
>
> TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
>
> Change-Id: I3393b74370c4f4d0955f50728005b2b925be169b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8415
> Reviewed-on: https://webrtc-review.googlesource.com/53262
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22023}
TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
Change-Id: Id68ad986ee51142b7be3381d0793709b4392fe2c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8415
Reviewed-on: https://webrtc-review.googlesource.com/53360
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22024}
2018-02-14 16:53:38 +00:00
|
|
|
rtc::Optional<uint32_t> acked_bitrate_bps) {
|
2017-06-11 23:57:17 -07:00
|
|
|
RTC_DCHECK(std::is_sorted(packet_feedback_vector.begin(),
|
|
|
|
|
packet_feedback_vector.end(),
|
|
|
|
|
PacketFeedbackComparator()));
|
2017-06-16 05:02:05 -07:00
|
|
|
RTC_DCHECK_RUNS_SERIALIZED(&network_race_);
|
2017-03-08 05:03:53 -08:00
|
|
|
|
2017-04-18 06:45:12 -07:00
|
|
|
// TOOD(holmer): An empty feedback vector here likely means that
|
|
|
|
|
// all acks were too late and that the send time history had
|
|
|
|
|
// timed out. We should reduce the rate when this occurs.
|
2017-06-11 23:57:17 -07:00
|
|
|
if (packet_feedback_vector.empty()) {
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_WARNING) << "Very late feedback received.";
|
2017-04-18 06:45:12 -07:00
|
|
|
return DelayBasedBwe::Result();
|
|
|
|
|
}
|
2017-03-08 05:03:53 -08:00
|
|
|
|
2016-08-03 00:29:03 -07:00
|
|
|
if (!uma_recorded_) {
|
2016-09-09 22:40:25 -07:00
|
|
|
RTC_HISTOGRAM_ENUMERATION(kBweTypeHistogram,
|
|
|
|
|
BweNames::kSendSideTransportSeqNum,
|
|
|
|
|
BweNames::kBweNamesMax);
|
2016-08-03 00:29:03 -07:00
|
|
|
uma_recorded_ = true;
|
|
|
|
|
}
|
2017-02-13 09:08:22 -08:00
|
|
|
bool delayed_feedback = true;
|
2017-07-31 04:23:25 -07:00
|
|
|
bool recovered_from_overuse = false;
|
2018-02-01 15:48:14 +01:00
|
|
|
BandwidthUsage prev_detector_state = delay_detector_->State();
|
2017-06-11 23:57:17 -07:00
|
|
|
for (const auto& packet_feedback : packet_feedback_vector) {
|
2017-03-06 05:32:21 -08:00
|
|
|
if (packet_feedback.send_time_ms < 0)
|
2017-02-13 09:08:22 -08:00
|
|
|
continue;
|
|
|
|
|
delayed_feedback = false;
|
Revert "Revert "Revert "Reland "Moved congestion controller to task queue.""""
This reverts commit 65792c5a5c542201f7b9feefded505842692e6ed.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Revert "Reland "Moved congestion controller to task queue."""
>
> This reverts commit 4e849f6925b2ac44b0957a228d7131fc391fca54.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Revert "Reland "Moved congestion controller to task queue.""
> >
> > This reverts commit 57daeb7ac7f3d80992905b53fea500953fcfd793.
> >
> > Reason for revert: Cause increased congestion and deadlocks in downstream project
> >
> > Original change's description:
> > > Reland "Moved congestion controller to task queue."
> > >
> > > This is a reland of 0cbcba7ea0dced1a7f353c64d6cf91d46ccb29f9.
> > >
> > > Original change's description:
> > > > Moved congestion controller to task queue.
> > > >
> > > > The goal of this work is to make it easier to experiment with the
> > > > bandwidth estimation implementation. For this reason network control
> > > > functionality is moved from SendSideCongestionController(SSCC),
> > > > PacedSender and BitrateController to the newly created
> > > > GoogCcNetworkController which implements the newly created
> > > > NetworkControllerInterface. This allows the implementation to be
> > > > replaced at runtime in the future.
> > > >
> > > > This is the first part of a split of a larger CL, see:
> > > > https://webrtc-review.googlesource.com/c/src/+/39788/8
> > > > For further explanations.
> > > >
> > > > Bug: webrtc:8415
> > > > Change-Id: I770189c04cc31b313bd4e57821acff55fbcb1ad3
> > > > Reviewed-on: https://webrtc-review.googlesource.com/43840
> > > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > > Cr-Commit-Position: refs/heads/master@{#21868}
> > >
> > > Bug: webrtc:8415
> > > Change-Id: I1d1756a30deed5b421b1c91c1918a13b6bb455da
> > > Reviewed-on: https://webrtc-review.googlesource.com/48000
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#21899}
> >
> > TBR=terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: webrtc:8415
> > Change-Id: Ida8074dcac2cc28b3629228eb22846d8a8e81b83
> > Reviewed-on: https://webrtc-review.googlesource.com/52980
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22017}
>
> TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
>
> Change-Id: I3393b74370c4f4d0955f50728005b2b925be169b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8415
> Reviewed-on: https://webrtc-review.googlesource.com/53262
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22023}
TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
Change-Id: Id68ad986ee51142b7be3381d0793709b4392fe2c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8415
Reviewed-on: https://webrtc-review.googlesource.com/53360
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22024}
2018-02-14 16:53:38 +00:00
|
|
|
IncomingPacketFeedback(packet_feedback);
|
2017-07-31 04:23:25 -07:00
|
|
|
if (prev_detector_state == BandwidthUsage::kBwUnderusing &&
|
2018-02-01 15:48:14 +01:00
|
|
|
delay_detector_->State() == BandwidthUsage::kBwNormal) {
|
2017-07-31 04:23:25 -07:00
|
|
|
recovered_from_overuse = true;
|
|
|
|
|
}
|
2018-02-01 15:48:14 +01:00
|
|
|
prev_detector_state = delay_detector_->State();
|
2016-06-17 09:21:34 -07:00
|
|
|
}
|
2017-07-31 04:23:25 -07:00
|
|
|
|
2017-02-13 09:08:22 -08:00
|
|
|
if (delayed_feedback) {
|
|
|
|
|
++consecutive_delayed_feedbacks_;
|
2017-04-20 10:10:10 -07:00
|
|
|
if (consecutive_delayed_feedbacks_ >= kMaxConsecutiveFailedLookups) {
|
|
|
|
|
consecutive_delayed_feedbacks_ = 0;
|
2017-06-11 23:57:17 -07:00
|
|
|
return OnLongFeedbackDelay(packet_feedback_vector.back().arrival_time_ms);
|
2017-04-20 10:10:10 -07:00
|
|
|
}
|
2017-02-13 09:08:22 -08:00
|
|
|
} else {
|
|
|
|
|
consecutive_delayed_feedbacks_ = 0;
|
Revert "Revert "Revert "Reland "Moved congestion controller to task queue.""""
This reverts commit 65792c5a5c542201f7b9feefded505842692e6ed.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Revert "Reland "Moved congestion controller to task queue."""
>
> This reverts commit 4e849f6925b2ac44b0957a228d7131fc391fca54.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Revert "Reland "Moved congestion controller to task queue.""
> >
> > This reverts commit 57daeb7ac7f3d80992905b53fea500953fcfd793.
> >
> > Reason for revert: Cause increased congestion and deadlocks in downstream project
> >
> > Original change's description:
> > > Reland "Moved congestion controller to task queue."
> > >
> > > This is a reland of 0cbcba7ea0dced1a7f353c64d6cf91d46ccb29f9.
> > >
> > > Original change's description:
> > > > Moved congestion controller to task queue.
> > > >
> > > > The goal of this work is to make it easier to experiment with the
> > > > bandwidth estimation implementation. For this reason network control
> > > > functionality is moved from SendSideCongestionController(SSCC),
> > > > PacedSender and BitrateController to the newly created
> > > > GoogCcNetworkController which implements the newly created
> > > > NetworkControllerInterface. This allows the implementation to be
> > > > replaced at runtime in the future.
> > > >
> > > > This is the first part of a split of a larger CL, see:
> > > > https://webrtc-review.googlesource.com/c/src/+/39788/8
> > > > For further explanations.
> > > >
> > > > Bug: webrtc:8415
> > > > Change-Id: I770189c04cc31b313bd4e57821acff55fbcb1ad3
> > > > Reviewed-on: https://webrtc-review.googlesource.com/43840
> > > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > > Cr-Commit-Position: refs/heads/master@{#21868}
> > >
> > > Bug: webrtc:8415
> > > Change-Id: I1d1756a30deed5b421b1c91c1918a13b6bb455da
> > > Reviewed-on: https://webrtc-review.googlesource.com/48000
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#21899}
> >
> > TBR=terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: webrtc:8415
> > Change-Id: Ida8074dcac2cc28b3629228eb22846d8a8e81b83
> > Reviewed-on: https://webrtc-review.googlesource.com/52980
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22017}
>
> TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
>
> Change-Id: I3393b74370c4f4d0955f50728005b2b925be169b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8415
> Reviewed-on: https://webrtc-review.googlesource.com/53262
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22023}
TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
Change-Id: Id68ad986ee51142b7be3381d0793709b4392fe2c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8415
Reviewed-on: https://webrtc-review.googlesource.com/53360
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22024}
2018-02-14 16:53:38 +00:00
|
|
|
return MaybeUpdateEstimate(acked_bitrate_bps, recovered_from_overuse);
|
2017-02-13 09:08:22 -08:00
|
|
|
}
|
2017-04-20 10:10:10 -07:00
|
|
|
return Result();
|
2016-06-17 09:21:34 -07:00
|
|
|
}
|
|
|
|
|
|
2017-02-13 09:08:22 -08:00
|
|
|
DelayBasedBwe::Result DelayBasedBwe::OnLongFeedbackDelay(
|
|
|
|
|
int64_t arrival_time_ms) {
|
|
|
|
|
// Estimate should always be valid since a start bitrate always is set in the
|
|
|
|
|
// Call constructor. An alternative would be to return an empty Result here,
|
|
|
|
|
// or to estimate the throughput based on the feedback we received.
|
|
|
|
|
RTC_DCHECK(rate_control_.ValidEstimate());
|
|
|
|
|
rate_control_.SetEstimate(rate_control_.LatestEstimate() / 2,
|
|
|
|
|
arrival_time_ms);
|
|
|
|
|
Result result;
|
|
|
|
|
result.updated = true;
|
|
|
|
|
result.probe = false;
|
|
|
|
|
result.target_bitrate_bps = rate_control_.LatestEstimate();
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_WARNING) << "Long feedback delay detected, reducing BWE to "
|
|
|
|
|
<< result.target_bitrate_bps;
|
2017-02-13 09:08:22 -08:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-20 10:10:10 -07:00
|
|
|
void DelayBasedBwe::IncomingPacketFeedback(
|
Revert "Revert "Revert "Reland "Moved congestion controller to task queue.""""
This reverts commit 65792c5a5c542201f7b9feefded505842692e6ed.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Revert "Reland "Moved congestion controller to task queue."""
>
> This reverts commit 4e849f6925b2ac44b0957a228d7131fc391fca54.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Revert "Reland "Moved congestion controller to task queue.""
> >
> > This reverts commit 57daeb7ac7f3d80992905b53fea500953fcfd793.
> >
> > Reason for revert: Cause increased congestion and deadlocks in downstream project
> >
> > Original change's description:
> > > Reland "Moved congestion controller to task queue."
> > >
> > > This is a reland of 0cbcba7ea0dced1a7f353c64d6cf91d46ccb29f9.
> > >
> > > Original change's description:
> > > > Moved congestion controller to task queue.
> > > >
> > > > The goal of this work is to make it easier to experiment with the
> > > > bandwidth estimation implementation. For this reason network control
> > > > functionality is moved from SendSideCongestionController(SSCC),
> > > > PacedSender and BitrateController to the newly created
> > > > GoogCcNetworkController which implements the newly created
> > > > NetworkControllerInterface. This allows the implementation to be
> > > > replaced at runtime in the future.
> > > >
> > > > This is the first part of a split of a larger CL, see:
> > > > https://webrtc-review.googlesource.com/c/src/+/39788/8
> > > > For further explanations.
> > > >
> > > > Bug: webrtc:8415
> > > > Change-Id: I770189c04cc31b313bd4e57821acff55fbcb1ad3
> > > > Reviewed-on: https://webrtc-review.googlesource.com/43840
> > > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > > Cr-Commit-Position: refs/heads/master@{#21868}
> > >
> > > Bug: webrtc:8415
> > > Change-Id: I1d1756a30deed5b421b1c91c1918a13b6bb455da
> > > Reviewed-on: https://webrtc-review.googlesource.com/48000
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#21899}
> >
> > TBR=terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: webrtc:8415
> > Change-Id: Ida8074dcac2cc28b3629228eb22846d8a8e81b83
> > Reviewed-on: https://webrtc-review.googlesource.com/52980
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22017}
>
> TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
>
> Change-Id: I3393b74370c4f4d0955f50728005b2b925be169b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8415
> Reviewed-on: https://webrtc-review.googlesource.com/53262
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22023}
TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
Change-Id: Id68ad986ee51142b7be3381d0793709b4392fe2c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8415
Reviewed-on: https://webrtc-review.googlesource.com/53360
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22024}
2018-02-14 16:53:38 +00:00
|
|
|
const PacketFeedback& packet_feedback) {
|
|
|
|
|
int64_t now_ms = clock_->TimeInMilliseconds();
|
2016-09-30 10:06:51 +02:00
|
|
|
// Reset if the stream has timed out.
|
|
|
|
|
if (last_seen_packet_ms_ == -1 ||
|
|
|
|
|
now_ms - last_seen_packet_ms_ > kStreamTimeOutMs) {
|
|
|
|
|
inter_arrival_.reset(
|
|
|
|
|
new InterArrival((kTimestampGroupLengthMs << kInterArrivalShift) / 1000,
|
|
|
|
|
kTimestampToMs, true));
|
2018-02-01 15:48:14 +01:00
|
|
|
delay_detector_.reset(new TrendlineEstimator(trendline_window_size_,
|
|
|
|
|
trendline_smoothing_coeff_,
|
|
|
|
|
trendline_threshold_gain_));
|
2016-09-30 10:06:51 +02:00
|
|
|
}
|
|
|
|
|
last_seen_packet_ms_ = now_ms;
|
|
|
|
|
|
|
|
|
|
uint32_t send_time_24bits =
|
|
|
|
|
static_cast<uint32_t>(
|
2017-03-06 05:32:21 -08:00
|
|
|
((static_cast<uint64_t>(packet_feedback.send_time_ms)
|
|
|
|
|
<< kAbsSendTimeFraction) +
|
2016-09-30 10:06:51 +02:00
|
|
|
500) /
|
|
|
|
|
1000) &
|
|
|
|
|
0x00FFFFFF;
|
|
|
|
|
// Shift up send time to use the full 32 bits that inter_arrival works with,
|
|
|
|
|
// so wrapping works properly.
|
|
|
|
|
uint32_t timestamp = send_time_24bits << kAbsSendTimeInterArrivalUpshift;
|
|
|
|
|
|
|
|
|
|
uint32_t ts_delta = 0;
|
|
|
|
|
int64_t t_delta = 0;
|
|
|
|
|
int size_delta = 0;
|
2017-03-06 05:32:21 -08:00
|
|
|
if (inter_arrival_->ComputeDeltas(timestamp, packet_feedback.arrival_time_ms,
|
|
|
|
|
now_ms, packet_feedback.payload_size,
|
|
|
|
|
&ts_delta, &t_delta, &size_delta)) {
|
2016-09-30 10:06:51 +02:00
|
|
|
double ts_delta_ms = (1000.0 * ts_delta) / (1 << kInterArrivalShift);
|
2018-02-01 15:48:14 +01:00
|
|
|
delay_detector_->Update(t_delta, ts_delta_ms,
|
|
|
|
|
packet_feedback.arrival_time_ms);
|
2016-09-30 10:06:51 +02:00
|
|
|
}
|
2017-03-06 05:32:21 -08:00
|
|
|
if (packet_feedback.pacing_info.probe_cluster_id !=
|
|
|
|
|
PacedPacketInfo::kNotAProbe) {
|
2017-04-20 10:10:10 -07:00
|
|
|
probe_bitrate_estimator_.HandleProbeAndEstimateBitrate(packet_feedback);
|
2016-09-30 10:06:51 +02:00
|
|
|
}
|
2017-04-20 10:10:10 -07:00
|
|
|
}
|
|
|
|
|
|
2017-06-11 23:57:17 -07:00
|
|
|
DelayBasedBwe::Result DelayBasedBwe::MaybeUpdateEstimate(
|
2017-07-31 04:23:25 -07:00
|
|
|
rtc::Optional<uint32_t> acked_bitrate_bps,
|
Revert "Revert "Revert "Reland "Moved congestion controller to task queue.""""
This reverts commit 65792c5a5c542201f7b9feefded505842692e6ed.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Revert "Reland "Moved congestion controller to task queue."""
>
> This reverts commit 4e849f6925b2ac44b0957a228d7131fc391fca54.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Revert "Reland "Moved congestion controller to task queue.""
> >
> > This reverts commit 57daeb7ac7f3d80992905b53fea500953fcfd793.
> >
> > Reason for revert: Cause increased congestion and deadlocks in downstream project
> >
> > Original change's description:
> > > Reland "Moved congestion controller to task queue."
> > >
> > > This is a reland of 0cbcba7ea0dced1a7f353c64d6cf91d46ccb29f9.
> > >
> > > Original change's description:
> > > > Moved congestion controller to task queue.
> > > >
> > > > The goal of this work is to make it easier to experiment with the
> > > > bandwidth estimation implementation. For this reason network control
> > > > functionality is moved from SendSideCongestionController(SSCC),
> > > > PacedSender and BitrateController to the newly created
> > > > GoogCcNetworkController which implements the newly created
> > > > NetworkControllerInterface. This allows the implementation to be
> > > > replaced at runtime in the future.
> > > >
> > > > This is the first part of a split of a larger CL, see:
> > > > https://webrtc-review.googlesource.com/c/src/+/39788/8
> > > > For further explanations.
> > > >
> > > > Bug: webrtc:8415
> > > > Change-Id: I770189c04cc31b313bd4e57821acff55fbcb1ad3
> > > > Reviewed-on: https://webrtc-review.googlesource.com/43840
> > > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > > Cr-Commit-Position: refs/heads/master@{#21868}
> > >
> > > Bug: webrtc:8415
> > > Change-Id: I1d1756a30deed5b421b1c91c1918a13b6bb455da
> > > Reviewed-on: https://webrtc-review.googlesource.com/48000
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#21899}
> >
> > TBR=terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: webrtc:8415
> > Change-Id: Ida8074dcac2cc28b3629228eb22846d8a8e81b83
> > Reviewed-on: https://webrtc-review.googlesource.com/52980
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22017}
>
> TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
>
> Change-Id: I3393b74370c4f4d0955f50728005b2b925be169b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8415
> Reviewed-on: https://webrtc-review.googlesource.com/53262
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22023}
TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
Change-Id: Id68ad986ee51142b7be3381d0793709b4392fe2c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8415
Reviewed-on: https://webrtc-review.googlesource.com/53360
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22024}
2018-02-14 16:53:38 +00:00
|
|
|
bool recovered_from_overuse) {
|
2017-04-20 10:10:10 -07:00
|
|
|
Result result;
|
Revert "Revert "Revert "Reland "Moved congestion controller to task queue.""""
This reverts commit 65792c5a5c542201f7b9feefded505842692e6ed.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Revert "Reland "Moved congestion controller to task queue."""
>
> This reverts commit 4e849f6925b2ac44b0957a228d7131fc391fca54.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Revert "Reland "Moved congestion controller to task queue.""
> >
> > This reverts commit 57daeb7ac7f3d80992905b53fea500953fcfd793.
> >
> > Reason for revert: Cause increased congestion and deadlocks in downstream project
> >
> > Original change's description:
> > > Reland "Moved congestion controller to task queue."
> > >
> > > This is a reland of 0cbcba7ea0dced1a7f353c64d6cf91d46ccb29f9.
> > >
> > > Original change's description:
> > > > Moved congestion controller to task queue.
> > > >
> > > > The goal of this work is to make it easier to experiment with the
> > > > bandwidth estimation implementation. For this reason network control
> > > > functionality is moved from SendSideCongestionController(SSCC),
> > > > PacedSender and BitrateController to the newly created
> > > > GoogCcNetworkController which implements the newly created
> > > > NetworkControllerInterface. This allows the implementation to be
> > > > replaced at runtime in the future.
> > > >
> > > > This is the first part of a split of a larger CL, see:
> > > > https://webrtc-review.googlesource.com/c/src/+/39788/8
> > > > For further explanations.
> > > >
> > > > Bug: webrtc:8415
> > > > Change-Id: I770189c04cc31b313bd4e57821acff55fbcb1ad3
> > > > Reviewed-on: https://webrtc-review.googlesource.com/43840
> > > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > > Cr-Commit-Position: refs/heads/master@{#21868}
> > >
> > > Bug: webrtc:8415
> > > Change-Id: I1d1756a30deed5b421b1c91c1918a13b6bb455da
> > > Reviewed-on: https://webrtc-review.googlesource.com/48000
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#21899}
> >
> > TBR=terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: webrtc:8415
> > Change-Id: Ida8074dcac2cc28b3629228eb22846d8a8e81b83
> > Reviewed-on: https://webrtc-review.googlesource.com/52980
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22017}
>
> TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
>
> Change-Id: I3393b74370c4f4d0955f50728005b2b925be169b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8415
> Reviewed-on: https://webrtc-review.googlesource.com/53262
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22023}
TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
Change-Id: Id68ad986ee51142b7be3381d0793709b4392fe2c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8415
Reviewed-on: https://webrtc-review.googlesource.com/53360
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22024}
2018-02-14 16:53:38 +00:00
|
|
|
int64_t now_ms = clock_->TimeInMilliseconds();
|
2017-04-20 10:10:10 -07:00
|
|
|
|
|
|
|
|
rtc::Optional<int> probe_bitrate_bps =
|
|
|
|
|
probe_bitrate_estimator_.FetchAndResetLastEstimatedBitrateBps();
|
2016-09-30 10:06:51 +02:00
|
|
|
// Currently overusing the bandwidth.
|
2018-02-01 15:48:14 +01:00
|
|
|
if (delay_detector_->State() == BandwidthUsage::kBwOverusing) {
|
2016-10-27 17:19:20 +02:00
|
|
|
if (acked_bitrate_bps &&
|
|
|
|
|
rate_control_.TimeToReduceFurther(now_ms, *acked_bitrate_bps)) {
|
2017-12-14 11:58:19 +01:00
|
|
|
result.updated =
|
|
|
|
|
UpdateEstimate(now_ms, acked_bitrate_bps, &result.target_bitrate_bps);
|
2017-07-04 04:52:58 -07:00
|
|
|
} else if (!acked_bitrate_bps && rate_control_.ValidEstimate() &&
|
|
|
|
|
rate_control_.TimeToReduceFurther(
|
|
|
|
|
now_ms, rate_control_.LatestEstimate() / 2 - 1)) {
|
|
|
|
|
// Overusing before we have a measured acknowledged bitrate. We check
|
|
|
|
|
// TimeToReduceFurther (with a fake acknowledged bitrate) to avoid
|
|
|
|
|
// reducing too often.
|
|
|
|
|
// TODO(tschumim): Improve this and/or the acknowledged bitrate estimator
|
|
|
|
|
// so that we (almost) always have a bitrate estimate.
|
|
|
|
|
rate_control_.SetEstimate(rate_control_.LatestEstimate() / 2, now_ms);
|
|
|
|
|
result.updated = true;
|
|
|
|
|
result.probe = false;
|
|
|
|
|
result.target_bitrate_bps = rate_control_.LatestEstimate();
|
2016-06-17 09:21:34 -07:00
|
|
|
}
|
2017-04-20 10:10:10 -07:00
|
|
|
} else {
|
|
|
|
|
if (probe_bitrate_bps) {
|
|
|
|
|
result.probe = true;
|
2017-06-27 07:50:31 -07:00
|
|
|
result.updated = true;
|
|
|
|
|
result.target_bitrate_bps = *probe_bitrate_bps;
|
|
|
|
|
rate_control_.SetEstimate(*probe_bitrate_bps, now_ms);
|
|
|
|
|
} else {
|
2017-12-14 11:58:19 +01:00
|
|
|
result.updated =
|
|
|
|
|
UpdateEstimate(now_ms, acked_bitrate_bps, &result.target_bitrate_bps);
|
2017-07-31 04:23:25 -07:00
|
|
|
result.recovered_from_overuse = recovered_from_overuse;
|
2017-04-20 10:10:10 -07:00
|
|
|
}
|
2016-09-29 04:19:38 -07:00
|
|
|
}
|
2018-02-01 15:48:14 +01:00
|
|
|
BandwidthUsage detector_state = delay_detector_->State();
|
2017-10-02 14:00:13 +02:00
|
|
|
if ((result.updated && prev_bitrate_ != result.target_bitrate_bps) ||
|
2018-02-01 15:48:14 +01:00
|
|
|
detector_state != prev_state_) {
|
2017-10-02 14:00:13 +02:00
|
|
|
uint32_t bitrate_bps =
|
|
|
|
|
result.updated ? result.target_bitrate_bps : prev_bitrate_;
|
|
|
|
|
|
|
|
|
|
BWE_TEST_LOGGING_PLOT(1, "target_bitrate_bps", now_ms, bitrate_bps);
|
|
|
|
|
|
2017-10-03 16:11:34 +02:00
|
|
|
if (event_log_) {
|
|
|
|
|
event_log_->Log(rtc::MakeUnique<RtcEventBweUpdateDelayBased>(
|
2018-02-01 15:48:14 +01:00
|
|
|
bitrate_bps, detector_state));
|
2017-10-03 16:11:34 +02:00
|
|
|
}
|
2017-10-02 14:00:13 +02:00
|
|
|
|
|
|
|
|
prev_bitrate_ = bitrate_bps;
|
2018-02-01 15:48:14 +01:00
|
|
|
prev_state_ = detector_state;
|
2016-12-09 05:50:01 -08:00
|
|
|
}
|
2016-09-30 10:06:51 +02:00
|
|
|
return result;
|
2016-06-17 09:21:34 -07:00
|
|
|
}
|
|
|
|
|
|
2017-04-20 10:10:10 -07:00
|
|
|
bool DelayBasedBwe::UpdateEstimate(int64_t now_ms,
|
2016-10-27 17:19:20 +02:00
|
|
|
rtc::Optional<uint32_t> acked_bitrate_bps,
|
2016-09-12 12:28:54 -07:00
|
|
|
uint32_t* target_bitrate_bps) {
|
2016-11-17 03:48:18 -08:00
|
|
|
// TODO(terelius): RateControlInput::noise_var is deprecated and will be
|
|
|
|
|
// removed. In the meantime, we set it to zero.
|
2018-02-01 15:48:14 +01:00
|
|
|
const RateControlInput input(delay_detector_->State(), acked_bitrate_bps, 0);
|
2017-04-03 02:27:08 -07:00
|
|
|
*target_bitrate_bps = rate_control_.Update(&input, now_ms);
|
2017-11-08 14:41:12 +01:00
|
|
|
return rate_control_.ValidEstimate();
|
2016-09-12 12:28:54 -07:00
|
|
|
}
|
|
|
|
|
|
Revert "Revert "Revert "Reland "Moved congestion controller to task queue.""""
This reverts commit 65792c5a5c542201f7b9feefded505842692e6ed.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Revert "Reland "Moved congestion controller to task queue."""
>
> This reverts commit 4e849f6925b2ac44b0957a228d7131fc391fca54.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Revert "Reland "Moved congestion controller to task queue.""
> >
> > This reverts commit 57daeb7ac7f3d80992905b53fea500953fcfd793.
> >
> > Reason for revert: Cause increased congestion and deadlocks in downstream project
> >
> > Original change's description:
> > > Reland "Moved congestion controller to task queue."
> > >
> > > This is a reland of 0cbcba7ea0dced1a7f353c64d6cf91d46ccb29f9.
> > >
> > > Original change's description:
> > > > Moved congestion controller to task queue.
> > > >
> > > > The goal of this work is to make it easier to experiment with the
> > > > bandwidth estimation implementation. For this reason network control
> > > > functionality is moved from SendSideCongestionController(SSCC),
> > > > PacedSender and BitrateController to the newly created
> > > > GoogCcNetworkController which implements the newly created
> > > > NetworkControllerInterface. This allows the implementation to be
> > > > replaced at runtime in the future.
> > > >
> > > > This is the first part of a split of a larger CL, see:
> > > > https://webrtc-review.googlesource.com/c/src/+/39788/8
> > > > For further explanations.
> > > >
> > > > Bug: webrtc:8415
> > > > Change-Id: I770189c04cc31b313bd4e57821acff55fbcb1ad3
> > > > Reviewed-on: https://webrtc-review.googlesource.com/43840
> > > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > > Cr-Commit-Position: refs/heads/master@{#21868}
> > >
> > > Bug: webrtc:8415
> > > Change-Id: I1d1756a30deed5b421b1c91c1918a13b6bb455da
> > > Reviewed-on: https://webrtc-review.googlesource.com/48000
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#21899}
> >
> > TBR=terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: webrtc:8415
> > Change-Id: Ida8074dcac2cc28b3629228eb22846d8a8e81b83
> > Reviewed-on: https://webrtc-review.googlesource.com/52980
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22017}
>
> TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
>
> Change-Id: I3393b74370c4f4d0955f50728005b2b925be169b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8415
> Reviewed-on: https://webrtc-review.googlesource.com/53262
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22023}
TBR=danilchap@webrtc.org,terelius@webrtc.org,stefan@webrtc.org,srte@webrtc.org
Change-Id: Id68ad986ee51142b7be3381d0793709b4392fe2c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8415
Reviewed-on: https://webrtc-review.googlesource.com/53360
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22024}
2018-02-14 16:53:38 +00:00
|
|
|
void DelayBasedBwe::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) {
|
2016-10-18 05:55:30 -07:00
|
|
|
rate_control_.SetRtt(avg_rtt_ms);
|
2016-06-17 09:21:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DelayBasedBwe::LatestEstimate(std::vector<uint32_t>* ssrcs,
|
|
|
|
|
uint32_t* bitrate_bps) const {
|
|
|
|
|
// Currently accessed from both the process thread (see
|
|
|
|
|
// ModuleRtpRtcpImpl::Process()) and the configuration thread (see
|
|
|
|
|
// Call::GetStats()). Should in the future only be accessed from a single
|
|
|
|
|
// thread.
|
|
|
|
|
RTC_DCHECK(ssrcs);
|
|
|
|
|
RTC_DCHECK(bitrate_bps);
|
2016-10-18 05:55:30 -07:00
|
|
|
if (!rate_control_.ValidEstimate())
|
2016-06-17 09:21:34 -07:00
|
|
|
return false;
|
2016-08-16 10:59:36 +02:00
|
|
|
|
|
|
|
|
*ssrcs = {kFixedSsrc};
|
2016-10-18 05:55:30 -07:00
|
|
|
*bitrate_bps = rate_control_.LatestEstimate();
|
2016-06-17 09:21:34 -07:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-27 06:43:18 -08:00
|
|
|
void DelayBasedBwe::SetStartBitrate(int start_bitrate_bps) {
|
2018-02-20 11:33:37 +01:00
|
|
|
RTC_LOG(LS_INFO) << "BWE Setting start bitrate to: " << start_bitrate_bps;
|
2017-01-27 06:43:18 -08:00
|
|
|
rate_control_.SetStartBitrate(start_bitrate_bps);
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-17 09:21:34 -07:00
|
|
|
void DelayBasedBwe::SetMinBitrate(int min_bitrate_bps) {
|
|
|
|
|
// Called from both the configuration thread and the network thread. Shouldn't
|
|
|
|
|
// be called from the network thread in the future.
|
2016-10-18 05:55:30 -07:00
|
|
|
rate_control_.SetMinBitrate(min_bitrate_bps);
|
2016-06-17 09:21:34 -07:00
|
|
|
}
|
2016-11-30 04:47:39 -08:00
|
|
|
|
2017-04-19 09:15:04 -07:00
|
|
|
int64_t DelayBasedBwe::GetExpectedBwePeriodMs() const {
|
|
|
|
|
return rate_control_.GetExpectedBandwidthPeriodMs();
|
2016-11-30 04:47:39 -08:00
|
|
|
}
|
2016-06-17 09:21:34 -07:00
|
|
|
} // namespace webrtc
|