delta: don't clear keyframes from the cache that have deltas coming.

These will get newer wids later of course.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I906f47255854eb065d41e629508867ffa6e9f953
This commit is contained in:
Michael Meeks 2022-06-16 14:42:40 +01:00
parent 3f17e5e502
commit 7ff4c9ffcd
2 changed files with 18 additions and 4 deletions

View file

@ -2745,7 +2745,8 @@ void DocumentBroker::handleTileCombinedRequest(TileCombined& tileCombined, bool
assert(!tileCombined.hasDuplicates());
LOG_TRC("TileCombined request for " << tileCombined.serialize());
LOG_TRC("TileCombined request for " << tileCombined.serialize() << " from " <<
(forceKeyframe ? "client" : "wsd"));
if (!hasTileCache())
{
LOG_WRN("Combined tile request without a loaded document?");
@ -2767,6 +2768,7 @@ void DocumentBroker::handleTileCombinedRequest(TileCombined& tileCombined, bool
// case; so forget what we last sent.
LOG_TRC("forcing a keyframe for tilecombined tile");
session->resetTileSeq(tile);
tile.setOldWireId(0); // forceKeyframe in the request
}
Tile cachedTile = _tileCache->lookupTile(tile);

View file

@ -588,6 +588,7 @@ void TileCache::ensureCacheSize()
if (wids.back()._wid - wids.front()._wid > 256 * 256 * 256)
{
maxToRemove = wids.back()._wid;
LOG_TRC("Rare wid wrap-around detected, clear tile cache");
}
else
{
@ -608,9 +609,20 @@ void TileCache::ensureCacheSize()
{
if (it->first.getWireId() <= maxToRemove)
{
LOG_TRC("cleaned out tile: " << it->first.serialize());
_cacheSize -= itemCacheSize(it->second);
it = _cache.erase(it);
auto rit = _tilesBeingRendered.find(it->first);
if (rit != _tilesBeingRendered.end())
{
// avoid getting a delta instead of a keyframe at the bottom.
LOG_TRC("skip cleaning tile we are waiting on: " << it->first.serialize() <<
" which has " << rit->second->getSubscribers().size() << " waiting");
++it;
}
else
{
LOG_TRC("cleaned out tile: " << it->first.serialize());
_cacheSize -= itemCacheSize(it->second);
it = _cache.erase(it);
}
}
else
{