diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2012-04-27 12:43:14 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2012-04-27 12:43:14 -0600 |
commit | ed78cc00008b13e4a108635e851b9936688647d0 (patch) | |
tree | 2ff397577184a01cd037a53a5720b9dc0770eb2f /indra | |
parent | 793d8a4f62952fa4fa482a5f43dc1b422c195dc2 (diff) |
fix some flaws for SH-3104
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/lltexturefetch.cpp | 46 | ||||
-rw-r--r-- | indra/newview/lltexturefetch.h | 8 |
2 files changed, 40 insertions, 14 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 0906626743..f2d8c27db7 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -3448,6 +3448,7 @@ void LLTextureFetchDebugger::debugHTTP() { mFetchingHistory[i].mCurlState = FetchEntry::CURL_NOT_DONE; mFetchingHistory[i].mCurlReceivedSize = 0; + mFetchingHistory[i].mHTTPFailCount = 0; } mNbCurlRequests = 0; mNbCurlCompleted = 0; @@ -3487,7 +3488,7 @@ S32 LLTextureFetchDebugger::fillCurlQueue() break; } } - llinfos << "Fetch Debugger : Having " << mNbCurlRequests << " requests through the curl thread." << llendl; + //llinfos << "Fetch Debugger : Having " << mNbCurlRequests << " requests through the curl thread." << llendl; return mNbCurlRequests; } @@ -3513,7 +3514,8 @@ void LLTextureFetchDebugger::debugGLTextureCreation() mTimer.reset(); S32 j = 0 ; - for(S32 i = 0 ; i < size ; i++) + S32 size1 = tex_list.size(); + for(S32 i = 0 ; i < size && j < size1; i++) { if(mFetchingHistory[i].mRawImage.notNull()) { @@ -3597,7 +3599,7 @@ bool LLTextureFetchDebugger::update() case HTTP_FETCHING: mCurlGetRequest->process(); LLCurl::getCurlThread()->update(1); - if (!fillCurlQueue()) + if (!fillCurlQueue() && mNbCurlCompleted == mFetchingHistory.size()) { mHTTPTime = mTimer.getElapsedTimeF32() ; mState = IDLE; @@ -3663,19 +3665,45 @@ void LLTextureFetchDebugger::callbackHTTP(S32 id, const LLChannelDescriptors& ch mNbCurlRequests--; if (success) { + mFetchingHistory[id].mCurlState = FetchEntry::CURL_DONE; + mNbCurlCompleted++; + S32 data_size = buffer->countAfter(channels.in(), NULL); mFetchingHistory[id].mCurlReceivedSize += data_size; - llinfos << "Fetch Debugger : got results for " << id << ", data_size = " << data_size << ", received = " << mFetchingHistory[id].mCurlReceivedSize << ", requested = " << mFetchingHistory[id].mRequestedSize << ", partial = " << partial << llendl; + //llinfos << "Fetch Debugger : got results for " << id << ", data_size = " << data_size << ", received = " << mFetchingHistory[id].mCurlReceivedSize << ", requested = " << mFetchingHistory[id].mRequestedSize << ", partial = " << partial << llendl; if ((mFetchingHistory[id].mCurlReceivedSize >= mFetchingHistory[id].mRequestedSize) || !partial || (mFetchingHistory[id].mRequestedSize == 600)) { - mFetchingHistory[id].mCurlState = FetchEntry::CURL_DONE; - mNbCurlCompleted++; + U8* d_buffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), data_size); + buffer->readAfter(channels.in(), NULL, d_buffer, data_size); + + llassert_always(mFetchingHistory[id].mFormattedImage.isNull()); + { + // For now, create formatted image based on extension + std::string texture_url = mHTTPUrl + "/?texture_id=" + mFetchingHistory[id].mID.asString().c_str(); + std::string extension = gDirUtilp->getExtension(texture_url); + mFetchingHistory[id].mFormattedImage = LLImageFormatted::createFromType(LLImageBase::getCodecFromExtension(extension)); + if (mFetchingHistory[id].mFormattedImage.isNull()) + { + mFetchingHistory[id].mFormattedImage = new LLImageJ2C; // default + } + } + + mFetchingHistory[id].mFormattedImage->setData(d_buffer, data_size); } } - else + else //failed { - // Fetch will have to be redone - mFetchingHistory[id].mCurlState = FetchEntry::CURL_NOT_DONE; + mFetchingHistory[id].mHTTPFailCount++; + if(mFetchingHistory[id].mHTTPFailCount < 5) + { + // Fetch will have to be redone + mFetchingHistory[id].mCurlState = FetchEntry::CURL_NOT_DONE; + } + else //skip + { + mFetchingHistory[id].mCurlState = FetchEntry::CURL_DONE; + mNbCurlCompleted++; + } } } diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 1538fd78ab..3b08389042 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -261,8 +261,6 @@ private: }; LLUUID mID; S32 mRequestedSize; - //S32 mFetchedDiscard; - //S32 mComponents; S32 mDecodedLevel; S32 mFetchedSize; S32 mDecodedSize; @@ -272,6 +270,7 @@ private: LLPointer<LLImageRaw> mRawImage; e_curl_state mCurlState; S32 mCurlReceivedSize; + S32 mHTTPFailCount; FetchEntry() : mDecodedLevel(-1), @@ -281,12 +280,11 @@ private: FetchEntry(LLUUID& id, S32 r_size, /*S32 f_discard, S32 c,*/ S32 level, S32 f_size, S32 d_size) : mID(id), mRequestedSize(r_size), - //mFetchedDiscard(f_discard), - //mComponents(c), mDecodedLevel(level), mFetchedSize(f_size), mDecodedSize(d_size), - mNeedsAux(false) + mNeedsAux(false), + mHTTPFailCount(0) {} }; std::vector<FetchEntry> mFetchingHistory; |