diff options
-rw-r--r-- | indra/newview/lltexturefetch.cpp | 6 | ||||
-rw-r--r-- | indra/newview/lltextureview.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llviewerthrottle.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llviewerthrottle.h | 1 |
4 files changed, 16 insertions, 5 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index cc187a1f98..93b5806acf 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -49,6 +49,7 @@ #include "llviewerregion.h" #include "llviewerstats.h" #include "llviewerstatsrecorder.h" +#include "llviewerthrottle.h" #include "llviewerassetstats.h" #include "llworld.h" #include "llsdparam.h" @@ -2434,7 +2435,7 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, bool threaded, bool qa_mod mOriginFetchSource(LLTextureFetch::FROM_ALL), mTextureInfoMainThread(false) { - mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS"); + mMaxBandwidth = LLViewerThrottle::getMaxBandwidthKbps(); mTextureInfo.setLogging(true); LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp()); @@ -2953,11 +2954,10 @@ void LLTextureFetch::commonUpdate() size_t LLTextureFetch::update(F32 max_time_ms) { LL_PROFILE_ZONE_SCOPED; - static LLCachedControl<F32> band_width(gSavedSettings,"ThrottleBandwidthKBPS", 3000.0); { mNetworkQueueMutex.lock(); // +Mfnq - mMaxBandwidth = band_width(); + mMaxBandwidth = LLViewerThrottle::getMaxBandwidthKbps(); add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, mHTTPTextureBits); mHTTPTextureBits = (U32Bits)0; diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 8560a01c4b..8cbede8303 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -49,6 +49,7 @@ #include "llviewerobjectlist.h" #include "llviewertexture.h" #include "llviewertexturelist.h" +#include "llviewerthrottle.h" #include "llviewerwindow.h" #include "llwindow.h" #include "llvovolume.h" @@ -633,7 +634,7 @@ void LLGLTexMemBar::draw() LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &x_right); F32Kilobits bandwidth(LLAppViewer::getTextureFetch()->getTextureBandwidth()); - F32Kilobits max_bandwidth(gSavedSettings.getF32("ThrottleBandwidthKBPS")); + F32Kilobits max_bandwidth(LLViewerThrottle::getMaxBandwidthKbps()); color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth*.75f ? LLColor4::yellow : text_color; color[VALPHA] = text_color[VALPHA]; text = llformat("BW:%.0f/%.0f",bandwidth.value(), max_bandwidth.value()); diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index 8d935e4243..3ccfbea6e2 100644 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -225,7 +225,7 @@ void LLViewerThrottle::setMaxBandwidth(F32 kbits_per_second, bool from_event) void LLViewerThrottle::load() { - mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS")*1024; + mMaxBandwidth = getMaxBandwidthKbps() * 1024; resetDynamicThrottle(); mCurrent.dump(); } @@ -242,6 +242,15 @@ void LLViewerThrottle::sendToSim() const mCurrent.sendToSim(); } +F32 LLViewerThrottle::getMaxBandwidthKbps() +{ + constexpr F32 MIN_BANDWIDTH = 100.0f; // 100 Kbps + constexpr F32 MAX_BANDWIDTH = 10000.0f; // 10 Mbps + + static LLCachedControl<F32> bandwidth(gSavedSettings, "ThrottleBandwidthKBPS", 3000.0); + return llclamp(bandwidth(), MIN_BANDWIDTH, MAX_BANDWIDTH); +} + LLViewerThrottleGroup LLViewerThrottle::getThrottleGroup(const F32 bandwidth_kbps) { diff --git a/indra/newview/llviewerthrottle.h b/indra/newview/llviewerthrottle.h index 9973c88549..ef898a97d7 100644 --- a/indra/newview/llviewerthrottle.h +++ b/indra/newview/llviewerthrottle.h @@ -64,6 +64,7 @@ public: void save() const; void sendToSim() const; + static F32 getMaxBandwidthKbps(); F32 getMaxBandwidth()const { return mMaxBandwidth; } F32 getCurrentBandwidth() const { return mCurrentBandwidth; } |