summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp1
-rw-r--r--indra/newview/llviewerthrottle.cpp14
-rw-r--r--indra/newview/llviewerthrottle.h3
3 files changed, 15 insertions, 3 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index a05c2376a0..4cf651de33 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -5443,6 +5443,7 @@ void LLAppViewer::idleNetwork()
// Retransmit unacknowledged packets.
gXferManager->retransmitUnackedPackets();
gAssetStorage->checkForTimeouts();
+ gViewerThrottle.setBufferLoadRate(gMessageSystem->getBufferLoadRate());
gViewerThrottle.updateDynamicThrottle();
// Check that the circuit between the viewer and the agent's current
diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp
index b0a00c29a4..8d935e4243 100644
--- a/indra/newview/llviewerthrottle.cpp
+++ b/indra/newview/llviewerthrottle.cpp
@@ -48,6 +48,8 @@ const F32 MIN_FRACTIONAL = 0.2f;
const F32 MIN_BANDWIDTH = 50.f;
const F32 MAX_BANDWIDTH = 6000.f;
const F32 STEP_FRACTIONAL = 0.1f;
+const F32 HIGH_BUFFER_LOAD_TRESHOLD = 1.f;
+const F32 LOW_BUFFER_LOAD_TRESHOLD = 0.8f;
const LLUnit<F32, LLUnits::Percent> TIGHTEN_THROTTLE_THRESHOLD(3.0f); // packet loss % per s
const LLUnit<F32, LLUnits::Percent> EASE_THROTTLE_THRESHOLD(0.5f); // packet loss % per s
const F32 DYNAMIC_UPDATE_DURATION = 5.0f; // seconds
@@ -146,7 +148,7 @@ LLViewerThrottleGroup LLViewerThrottleGroup::operator-(const LLViewerThrottleGro
void LLViewerThrottleGroup::sendToSim() const
{
- LL_INFOS() << "Sending throttle settings, total BW " << mThrottleTotal << LL_ENDL;
+ LL_DEBUGS("Throttle") << "Sending throttle settings, total BW " << mThrottleTotal << LL_ENDL;
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_AgentThrottle);
@@ -305,7 +307,10 @@ void LLViewerThrottle::updateDynamicThrottle()
mUpdateTimer.reset();
LLUnit<F32, LLUnits::Percent> mean_packets_lost = LLViewerStats::instance().getRecording().getMean(LLStatViewer::PACKETS_LOST_PERCENT);
- if (mean_packets_lost > TIGHTEN_THROTTLE_THRESHOLD)
+ if (
+ mean_packets_lost > TIGHTEN_THROTTLE_THRESHOLD // already losing packets
+ || mBufferLoadRate >= HIGH_BUFFER_LOAD_TRESHOLD // let viewer sort through the backlog before it starts dropping packets
+ )
{
if (mThrottleFrac <= MIN_FRACTIONAL || mCurrentBandwidth / 1024.0f <= MIN_BANDWIDTH)
{
@@ -318,7 +323,8 @@ void LLViewerThrottle::updateDynamicThrottle()
mCurrent.sendToSim();
LL_INFOS() << "Tightening network throttle to " << mCurrentBandwidth << LL_ENDL;
}
- else if (mean_packets_lost <= EASE_THROTTLE_THRESHOLD)
+ else if (mean_packets_lost <= EASE_THROTTLE_THRESHOLD
+ && mBufferLoadRate < LOW_BUFFER_LOAD_TRESHOLD)
{
if (mThrottleFrac >= MAX_FRACTIONAL || mCurrentBandwidth / 1024.0f >= MAX_BANDWIDTH)
{
@@ -331,4 +337,6 @@ void LLViewerThrottle::updateDynamicThrottle()
mCurrent.sendToSim();
LL_INFOS() << "Easing network throttle to " << mCurrentBandwidth << LL_ENDL;
}
+
+ mBufferLoadRate = 0;
}
diff --git a/indra/newview/llviewerthrottle.h b/indra/newview/llviewerthrottle.h
index 28a24d04fc..9973c88549 100644
--- a/indra/newview/llviewerthrottle.h
+++ b/indra/newview/llviewerthrottle.h
@@ -70,12 +70,15 @@ public:
void updateDynamicThrottle();
void resetDynamicThrottle();
+ void setBufferLoadRate(F32 rate) { mBufferLoadRate = llmax(mBufferLoadRate, rate); }
+
LLViewerThrottleGroup getThrottleGroup(const F32 bandwidth_kbps);
static const std::string sNames[TC_EOF];
protected:
F32 mMaxBandwidth;
F32 mCurrentBandwidth;
+ F32 mBufferLoadRate = 0;
LLViewerThrottleGroup mCurrent;