Reland of "Revert of Update the BWE when the network route changes. (patchset #5 id:180001 of https://… (patchset #1 id:1 of https://codereview.webrtc.org/2098703004/ )

Reason for revert:
It turns out this revert was not necessary because the connection-state mapping for turn-turn connections was not done in connection.

Original issue's description:
> Revert of Revert "Revert of Update the BWE when the network route changes. (patchset #5 id:180001 of https://… (patchset #5 id:120001 of https://codereview.webrtc.org/2041593002/ )
>
> Reason for revert:
> ReadyToSendMedia did not consider the new presumed_writable state.
>
> Original issue's description:
> > Revert "Revert of Update the BWE when the network route changes. (patchset #5 id:180001 of https://codereview.webrtc.org/2000063003/ )"
> >
> > This reverts commit 72d41aa6da94dacb8a8464d1abd4ca7d1afffc65.
> >
> > New change made:
> > Do not reset the BWE when the new network route is not ready to send media.
> >
> > BUG=
> > R=pthatcher@webrtc.org, stefan@webrtc.org
> >

TBR=pthatcher@webrtc.org,stefan@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review-Url: https://codereview.webrtc.org/2094863003
Cr-Commit-Position: refs/heads/master@{#13282}
This commit is contained in:
honghaiz
2016-06-24 11:03:55 -07:00
committed by Commit bot
parent ae4d0d922b
commit 059e183419
15 changed files with 102 additions and 19 deletions

View File

@ -33,6 +33,22 @@ namespace {
static const uint32_t kTimeOffsetSwitchThreshold = 30;
// Makes sure that the bitrate and the min, max values are in valid range.
static void ClampBitrates(int* bitrate_bps,
int* min_bitrate_bps,
int* max_bitrate_bps) {
// TODO(holmer): We should make sure the default bitrates are set to 10 kbps,
// and that we don't try to set the min bitrate to 0 from any applications.
// The congestion controller should allow a min bitrate of 0.
const int kMinBitrateBps = 10000;
if (*min_bitrate_bps < kMinBitrateBps)
*min_bitrate_bps = kMinBitrateBps;
if (*max_bitrate_bps > 0)
*max_bitrate_bps = std::max(*min_bitrate_bps, *max_bitrate_bps);
if (*bitrate_bps > 0)
*bitrate_bps = std::max(*min_bitrate_bps, *bitrate_bps);
}
class WrappingBitrateEstimator : public RemoteBitrateEstimator {
public:
WrappingBitrateEstimator(RemoteBitrateObserver* observer, Clock* clock)
@ -212,21 +228,10 @@ void CongestionController::Init() {
min_bitrate_bps_);
}
void CongestionController::SetBweBitrates(int min_bitrate_bps,
int start_bitrate_bps,
int max_bitrate_bps) {
// TODO(holmer): We should make sure the default bitrates are set to 10 kbps,
// and that we don't try to set the min bitrate to 0 from any applications.
// The congestion controller should allow a min bitrate of 0.
const int kMinBitrateBps = 10000;
if (min_bitrate_bps < kMinBitrateBps)
min_bitrate_bps = kMinBitrateBps;
if (max_bitrate_bps > 0)
max_bitrate_bps = std::max(min_bitrate_bps, max_bitrate_bps);
if (start_bitrate_bps > 0)
start_bitrate_bps = std::max(min_bitrate_bps, start_bitrate_bps);
ClampBitrates(&start_bitrate_bps, &min_bitrate_bps, &max_bitrate_bps);
bitrate_controller_->SetBitrates(start_bitrate_bps,
min_bitrate_bps,
max_bitrate_bps);
@ -239,6 +244,28 @@ void CongestionController::SetBweBitrates(int min_bitrate_bps,
MaybeTriggerOnNetworkChanged();
}
void CongestionController::ResetBweAndBitrates(int bitrate_bps,
int min_bitrate_bps,
int max_bitrate_bps) {
ClampBitrates(&bitrate_bps, &min_bitrate_bps, &max_bitrate_bps);
// TODO(honghaiz): Recreate this object once the bitrate controller is
// no longer exposed outside CongestionController.
bitrate_controller_->ResetBitrates(bitrate_bps, min_bitrate_bps,
max_bitrate_bps);
min_bitrate_bps_ = min_bitrate_bps;
// TODO(honghaiz): Recreate this object once the remote bitrate estimator is
// no longer exposed outside CongestionController.
if (remote_bitrate_estimator_)
remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps);
RemoteBitrateEstimator* rbe =
new RemoteBitrateEstimatorAbsSendTime(&transport_feedback_adapter_);
transport_feedback_adapter_.SetBitrateEstimator(rbe);
rbe->SetMinBitrate(min_bitrate_bps);
// TODO(holmer): Trigger a new probe once mid-call probing is implemented.
MaybeTriggerOnNetworkChanged();
}
BitrateController* CongestionController::GetBitrateController() const {
return bitrate_controller_.get();
}