aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Agent
diff options
context:
space:
mode:
authorTeravus Ovares2009-01-21 11:16:33 +0000
committerTeravus Ovares2009-01-21 11:16:33 +0000
commit1a55dd11f1e0c17452c3264ff02496d8ced8a421 (patch)
treea358deb7a59b1a46075b1dc5adf7f359edb3151c /OpenSim/Region/Environment/Modules/Agent
parent- remove extra "; in http_loginform.html.example; fix issue 3025 (diff)
downloadopensim-SC_OLD-1a55dd11f1e0c17452c3264ff02496d8ced8a421.zip
opensim-SC_OLD-1a55dd11f1e0c17452c3264ff02496d8ced8a421.tar.gz
opensim-SC_OLD-1a55dd11f1e0c17452c3264ff02496d8ced8a421.tar.bz2
opensim-SC_OLD-1a55dd11f1e0c17452c3264ff02496d8ced8a421.tar.xz
* 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)
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Agent')
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/TextureSender/J2KDecoderModule.cs74
1 files changed, 45 insertions, 29 deletions
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
49 /// Cached Decoded Layers 49 /// Cached Decoded Layers
50 /// </summary> 50 /// </summary>
51 private readonly Dictionary<UUID, OpenJPEG.J2KLayerInfo[]> m_cacheddecode = new Dictionary<UUID, OpenJPEG.J2KLayerInfo[]>(); 51 private readonly Dictionary<UUID, OpenJPEG.J2KLayerInfo[]> m_cacheddecode = new Dictionary<UUID, OpenJPEG.J2KLayerInfo[]>();
52 private bool OpenJpegFail = false;
52 53
53 /// <summary> 54 /// <summary>
54 /// List of client methods to notify of results of decode 55 /// List of client methods to notify of results of decode
@@ -147,49 +148,64 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
147 int DecodeTime = 0; 148 int DecodeTime = 0;
148 DecodeTime = System.Environment.TickCount; 149 DecodeTime = System.Environment.TickCount;
149 OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[0]; // Dummy result for if it fails. Informs that there's only full quality 150 OpenJPEG.J2KLayerInfo[] layers = new OpenJPEG.J2KLayerInfo[0]; // Dummy result for if it fails. Informs that there's only full quality
150 try
151 {
152 151
153 AssetTexture texture = new AssetTexture(AssetId, j2kdata); 152 if (!OpenJpegFail)
154 if (texture.DecodeLayerBoundaries()) 153 {
154 try
155 { 155 {
156 bool sane = true;
157 156
158 // Sanity check all of the layers 157 AssetTexture texture = new AssetTexture(AssetId, j2kdata);
159 for (int i = 0; i < texture.LayerInfo.Length; i++) 158 if (texture.DecodeLayerBoundaries())
160 { 159 {
161 if (texture.LayerInfo[i].End > texture.AssetData.Length) 160 bool sane = true;
161
162 // Sanity check all of the layers
163 for (int i = 0; i < texture.LayerInfo.Length; i++)
162 { 164 {
163 sane = false; 165 if (texture.LayerInfo[i].End > texture.AssetData.Length)
164 break; 166 {
167 sane = false;
168 break;
169 }
170 }
171
172 if (sane)
173 {
174 layers = texture.LayerInfo;
175 }
176 else
177 {
178 m_log.WarnFormat(
179 "[J2KDecoderModule]: JPEG2000 texture decoding succeeded, but sanity check failed for {0}",
180 AssetId);
165 } 181 }
166 } 182 }
167 183
168 if (sane)
169 {
170 layers = texture.LayerInfo;
171 }
172 else 184 else
173 { 185 {
174 m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding succeeded, but sanity check failed for {0}", 186 m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}", AssetId);
175 AssetId);
176 } 187 }
188 texture = null; // dereference and dispose of ManagedImage
189 }
190 catch (DllNotFoundException)
191 {
192 m_log.Error(
193 "[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!");
194 OpenJpegFail = true;
195 }
196 catch (Exception ex)
197 {
198 m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding threw an exception for {0}, {1}",
199 AssetId, ex);
177 } 200 }
178
179 else
180 {
181 m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}", AssetId);
182 }
183 texture = null; // dereference and dispose of ManagedImage
184 } 201 }
185 catch (Exception ex) 202
203 if (!OpenJpegFail)
186 { 204 {
187 m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding threw an exception for {0}, {1}", AssetId, ex); 205 // Write out decode time
206 m_log.InfoFormat("[J2KDecoderModule]: {0} Decode Time: {1}", System.Environment.TickCount - DecodeTime,
207 AssetId);
188 } 208 }
189
190 // Write out decode time
191 m_log.InfoFormat("[J2KDecoderModule]: {0} Decode Time: {1}", System.Environment.TickCount - DecodeTime, AssetId);
192
193 // Cache Decoded layers 209 // Cache Decoded layers
194 lock (m_cacheddecode) 210 lock (m_cacheddecode)
195 { 211 {