Opened 18 years ago

Closed 18 years ago

#1681 closed patch (fixed)

size limit for the OSD image cache

Reported by: Pekka Jääskeläinen <pekka.jaaskelainen@…> Owned by: danielk
Priority: minor Milestone: 0.20
Component: mythtv Version: head
Severity: medium Keywords: OSD image cache
Cc: Ticket locked: no

Description

This patch cleans up the implementation of the OSD image cache and introduces a size limit for the in-memory OSD image cache. The implementation is converted to use the Qt's cache structure (QAsciiCache) which provides automatic resizing of the cache when the limit has been reached. The resizing is done by deleting least recently used items (images) from the cache.

The cache is moved as a static class member to OSDTypeImage. Each OSDTypeImage, when finds its image data from cache becomes the owner of the cache item. This is to avoid double frees and freeing of the cache image by the automatism when the image is in use by a OSDTypeImage. When the OSDTypeImage is reinitialized with a new image, the ownership of the old cached image is given back to the cache.

I placed a default size limit of 5 MiB, which seems to allow caching two-three sets of OSD images in memory.

Attached are 0.19-fixes and HEAD patches.

Attachments (4)

osdimagecache-sizelimit-0.19-fixes.diff (17.1 KB) - added by Pekka Jääskeläinen <pekka.jaaskelainen@…> 18 years ago.
0.19-fixes
osdimagecache-sizelimit-HEAD.diff (17.2 KB) - added by Pekka Jääskeläinen <pekka.jaaskelainen@…> 18 years ago.
HEAD
osdimagecache-sizelimit-0.19-fixes.v2.diff (17.6 KB) - added by Pekka Jääskeläinen <pekka.jaaskelainen@…> 18 years ago.
0.19
osdimagecache-sizelimit-HEAD.v2.diff (17.8 KB) - added by Pekka Jääskeläinen <pekka.jaaskelainen@…> 18 years ago.
HEAD

Download all attachments as: .zip

Change History (8)

Changed 18 years ago by Pekka Jääskeläinen <pekka.jaaskelainen@…>

0.19-fixes

Changed 18 years ago by Pekka Jääskeläinen <pekka.jaaskelainen@…>

HEAD

comment:1 Changed 18 years ago by Pekka Jääskeläinen <pekka.jaaskelainen@…>

The submited patch has a small bug in it: if the source OSD image had underscore in its file name, the detection that checked whether the OSD image file is newer than the cached file failed because the file name reconstructed from the cache key was cut at the underscore position (e.g., 'edit_background.png' -> 'edit').

The updated patches are indentical to the original ones except fixing this bug. For the record, I have been testing this patch for about a week now in the fixes branch and it seems to be stable.

Changed 18 years ago by Pekka Jääskeläinen <pekka.jaaskelainen@…>

0.19

Changed 18 years ago by Pekka Jääskeläinen <pekka.jaaskelainen@…>

HEAD

comment:2 Changed 18 years ago by danielk

(In [9753]) References #1681. Adds LRU cache eviction to OSD image cache by applying Pekka's patch. The cache size limit is set at 5MB.

comment:3 Changed 18 years ago by danielk

Milestone: 0.20
Version: head

comment:4 Changed 18 years ago by danielk

Resolution: fixed
Status: newclosed

(In [9899]) Fixes #1681. Backport of LRU cache expire for OSD cache from SVN-head.

It's been in head for 2 weeks without complaint...

Note: See TracTickets for help on using tickets.