diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 2879154..a54fec7 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -55,6 +55,16 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
55 | private readonly Dictionary<UUID, List<DecodedCallback>> m_notifyList = new Dictionary<UUID, List<DecodedCallback>>(); | 55 | private readonly Dictionary<UUID, List<DecodedCallback>> m_notifyList = new Dictionary<UUID, List<DecodedCallback>>(); |
56 | /// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary> | 56 | /// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary> |
57 | private IImprovedAssetCache m_cache; | 57 | private IImprovedAssetCache m_cache; |
58 | private IImprovedAssetCache Cache | ||
59 | { | ||
60 | get | ||
61 | { | ||
62 | if (m_cache == null) | ||
63 | m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); | ||
64 | |||
65 | return m_cache; | ||
66 | } | ||
67 | } | ||
58 | /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary> | 68 | /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary> |
59 | private UUID m_CreatorID = UUID.Zero; | 69 | private UUID m_CreatorID = UUID.Zero; |
60 | private Scene m_scene; | 70 | private Scene m_scene; |
@@ -98,7 +108,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
98 | 108 | ||
99 | public void PostInitialise() | 109 | public void PostInitialise() |
100 | { | 110 | { |
101 | m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); | ||
102 | } | 111 | } |
103 | 112 | ||
104 | public void Close() | 113 | public void Close() |
@@ -297,7 +306,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
297 | { | 306 | { |
298 | m_decodedCache.AddOrUpdate(AssetId, Layers, TimeSpan.FromMinutes(10)); | 307 | m_decodedCache.AddOrUpdate(AssetId, Layers, TimeSpan.FromMinutes(10)); |
299 | 308 | ||
300 | if (m_cache != null) | 309 | if (Cache != null) |
301 | { | 310 | { |
302 | string assetID = "j2kCache_" + AssetId.ToString(); | 311 | string assetID = "j2kCache_" + AssetId.ToString(); |
303 | 312 | ||
@@ -321,7 +330,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
321 | 330 | ||
322 | #endregion Serialize Layer Data | 331 | #endregion Serialize Layer Data |
323 | 332 | ||
324 | m_cache.Cache(layerDecodeAsset); | 333 | Cache.Cache(layerDecodeAsset); |
325 | } | 334 | } |
326 | } | 335 | } |
327 | 336 | ||
@@ -331,10 +340,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
331 | { | 340 | { |
332 | return true; | 341 | return true; |
333 | } | 342 | } |
334 | else if (m_cache != null) | 343 | else if (Cache != null) |
335 | { | 344 | { |
336 | string assetName = "j2kCache_" + AssetId.ToString(); | 345 | string assetName = "j2kCache_" + AssetId.ToString(); |
337 | AssetBase layerDecodeAsset = m_cache.Get(assetName); | 346 | AssetBase layerDecodeAsset = Cache.Get(assetName); |
338 | 347 | ||
339 | if (layerDecodeAsset != null) | 348 | if (layerDecodeAsset != null) |
340 | { | 349 | { |
@@ -346,7 +355,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
346 | if (lines.Length == 0) | 355 | if (lines.Length == 0) |
347 | { | 356 | { |
348 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (empty) " + assetName); | 357 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (empty) " + assetName); |
349 | m_cache.Expire(assetName); | 358 | Cache.Expire(assetName); |
350 | return false; | 359 | return false; |
351 | } | 360 | } |
352 | 361 | ||
@@ -367,7 +376,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
367 | catch (FormatException) | 376 | catch (FormatException) |
368 | { | 377 | { |
369 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (format) " + assetName); | 378 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (format) " + assetName); |
370 | m_cache.Expire(assetName); | 379 | Cache.Expire(assetName); |
371 | return false; | 380 | return false; |
372 | } | 381 | } |
373 | 382 | ||
@@ -378,7 +387,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
378 | else | 387 | else |
379 | { | 388 | { |
380 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (layout) " + assetName); | 389 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (layout) " + assetName); |
381 | m_cache.Expire(assetName); | 390 | Cache.Expire(assetName); |
382 | return false; | 391 | return false; |
383 | } | 392 | } |
384 | } | 393 | } |