Improved ImageSequence's handling of seek() and added a simply hack to ImagePager to prevent the number of requests accumulating.

This commit is contained in:
Robert Osfield
2012-10-05 10:37:36 +00:00
parent 77bd6cbfe9
commit 47c5ddbce5
2 changed files with 49 additions and 8 deletions

View File

@@ -80,12 +80,17 @@ void ImagePager::ReadQueue::clear()
void ImagePager::ReadQueue::add(ImagePager::ImageRequest* databaseRequest)
{
// tempo hack to avoid the ImagePager accumulating requests when it can keep up,
// note this will mean that only one ImageSequence can be properly managed at one time,
// this hack will be removed once a better system for managing expiry of requests is introduced.
clear();
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_requestMutex);
_requestList.push_back(databaseRequest);
databaseRequest->_requestQueue = this;
OSG_INFO<<"ImagePager::ReadQueue::add(..), size()="<<size()<<std::endl;
OSG_INFO<<"ImagePager::ReadQueue::add(..), size()="<<_requestList.size()<<std::endl;
updateBlock();
}
@@ -98,6 +103,8 @@ void ImagePager::ReadQueue::takeFirst(osg::ref_ptr<ImageRequest>& databaseReques
{
sort();
OSG_INFO<<"ImagePager::ReadQueue::takeFirst(..), size()="<<_requestList.size()<<std::endl;
databaseRequest = _requestList.front();
databaseRequest->_requestQueue = 0;
_requestList.erase(_requestList.begin());