From 1a55dd11f1e0c17452c3264ff02496d8ced8a421 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 21 Jan 2009 11:16:33 +0000 Subject: * More friendly OpenJpeg error handling. * Often times now the only reason OpenJpeg doesn't work is because it requires Glibc 2.4 The error messages reflect that. * In J2kDecoder module, It stops trying to decode modules if it encounters a dllnotfound exception and instead sends a full resolution layer that causes the texture sender to only send the full resolution image. (big decrease in texture download speed, but it's better then nasty repeating error messages) --- .../Agent/TextureSender/J2KDecoderModule.cs | 74 +++++++++++++--------- 1 file changed, 45 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/Agent/TextureSender') diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs index 6b84880..dc46dc6 100644 --- a/OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs @@ -49,6 +49,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender /// Cached Decoded Layers /// private readonly Dictionary m_cacheddecode = new Dictionary(); + private bool OpenJpegFail = false; /// /// List of client methods to notify of results of decode @@ -147,49 +148,64 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender int DecodeTime = 0; DecodeTime = System.Environment.TickCount; OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[0]; // Dummy result for if it fails. Informs that there's only full quality - try - { - AssetTexture texture = new AssetTexture(AssetId, j2kdata); - if (texture.DecodeLayerBoundaries()) + if (!OpenJpegFail) + { + try { - bool sane = true; - // Sanity check all of the layers - for (int i = 0; i < texture.LayerInfo.Length; i++) + AssetTexture texture = new AssetTexture(AssetId, j2kdata); + if (texture.DecodeLayerBoundaries()) { - if (texture.LayerInfo[i].End > texture.AssetData.Length) + bool sane = true; + + // Sanity check all of the layers + for (int i = 0; i < texture.LayerInfo.Length; i++) { - sane = false; - break; + if (texture.LayerInfo[i].End > texture.AssetData.Length) + { + sane = false; + break; + } + } + + if (sane) + { + layers = texture.LayerInfo; + } + else + { + m_log.WarnFormat( + "[J2KDecoderModule]: JPEG2000 texture decoding succeeded, but sanity check failed for {0}", + AssetId); } } - - if (sane) - { - layers = texture.LayerInfo; - } + else { - m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding succeeded, but sanity check failed for {0}", - AssetId); + m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}", AssetId); } + texture = null; // dereference and dispose of ManagedImage + } + catch (DllNotFoundException) + { + m_log.Error( + "[J2KDecoderModule]: OpenJpeg is not installed properly. Decoding disabled! This will slow down texture performance! Often times this is because of an old version of GLIBC. You must have version 2.4 or above!"); + OpenJpegFail = true; + } + catch (Exception ex) + { + m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding threw an exception for {0}, {1}", + AssetId, ex); } - - else - { - m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}", AssetId); - } - texture = null; // dereference and dispose of ManagedImage } - catch (Exception ex) + + if (!OpenJpegFail) { - m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding threw an exception for {0}, {1}", AssetId, ex); + // Write out decode time + m_log.InfoFormat("[J2KDecoderModule]: {0} Decode Time: {1}", System.Environment.TickCount - DecodeTime, + AssetId); } - - // Write out decode time - m_log.InfoFormat("[J2KDecoderModule]: {0} Decode Time: {1}", System.Environment.TickCount - DecodeTime, AssetId); - // Cache Decoded layers lock (m_cacheddecode) { -- cgit v1.1