diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs | 17 |
2 files changed, 21 insertions, 14 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index 30d4f21..2bbc6c7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | |||
@@ -56,9 +56,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
56 | public IAssetService AssetService; | 56 | public IAssetService AssetService; |
57 | public UUID AgentID; | 57 | public UUID AgentID; |
58 | public IInventoryAccessModule InventoryAccessModule; | 58 | public IInventoryAccessModule InventoryAccessModule; |
59 | public OpenJPEG.J2KLayerInfo[] Layers; | 59 | private OpenJPEG.J2KLayerInfo[] m_layers; |
60 | public bool IsDecoded; | 60 | public bool IsDecoded { get; private set; } |
61 | public bool HasAsset; | 61 | public bool HasAsset { get; private set; } |
62 | public C5.IPriorityQueueHandle<J2KImage> PriorityQueueHandle; | 62 | public C5.IPriorityQueueHandle<J2KImage> PriorityQueueHandle; |
63 | 63 | ||
64 | private uint m_currentPacket; | 64 | private uint m_currentPacket; |
@@ -170,14 +170,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
170 | if (DiscardLevel >= 0 || m_stopPacket == 0) | 170 | if (DiscardLevel >= 0 || m_stopPacket == 0) |
171 | { | 171 | { |
172 | // This shouldn't happen, but if it does, we really can't proceed | 172 | // This shouldn't happen, but if it does, we really can't proceed |
173 | if (Layers == null) | 173 | if (m_layers == null) |
174 | { | 174 | { |
175 | m_log.Warn("[J2KIMAGE]: RunUpdate() called with missing Layers. Canceling texture transfer"); | 175 | m_log.Warn("[J2KIMAGE]: RunUpdate() called with missing Layers. Canceling texture transfer"); |
176 | m_currentPacket = m_stopPacket; | 176 | m_currentPacket = m_stopPacket; |
177 | return; | 177 | return; |
178 | } | 178 | } |
179 | 179 | ||
180 | int maxDiscardLevel = Math.Max(0, Layers.Length - 1); | 180 | int maxDiscardLevel = Math.Max(0, m_layers.Length - 1); |
181 | 181 | ||
182 | // Treat initial texture downloads with a DiscardLevel of -1 a request for the highest DiscardLevel | 182 | // Treat initial texture downloads with a DiscardLevel of -1 a request for the highest DiscardLevel |
183 | if (DiscardLevel < 0 && m_stopPacket == 0) | 183 | if (DiscardLevel < 0 && m_stopPacket == 0) |
@@ -187,9 +187,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
187 | DiscardLevel = (sbyte)Math.Min(DiscardLevel, maxDiscardLevel); | 187 | DiscardLevel = (sbyte)Math.Min(DiscardLevel, maxDiscardLevel); |
188 | 188 | ||
189 | //Calculate the m_stopPacket | 189 | //Calculate the m_stopPacket |
190 | if (Layers.Length > 0) | 190 | if (m_layers.Length > 0) |
191 | { | 191 | { |
192 | m_stopPacket = (uint)GetPacketForBytePosition(Layers[(Layers.Length - 1) - DiscardLevel].End); | 192 | m_stopPacket = (uint)GetPacketForBytePosition(m_layers[(m_layers.Length - 1) - DiscardLevel].End); |
193 | //I don't know why, but the viewer seems to expect the final packet if the file | 193 | //I don't know why, but the viewer seems to expect the final packet if the file |
194 | //is just one packet bigger. | 194 | //is just one packet bigger. |
195 | if (TexturePacketCount() == m_stopPacket + 1) | 195 | if (TexturePacketCount() == m_stopPacket + 1) |
@@ -203,7 +203,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
203 | } | 203 | } |
204 | 204 | ||
205 | //Give them at least two packets, to play nice with some broken viewers (SL also behaves this way) | 205 | //Give them at least two packets, to play nice with some broken viewers (SL also behaves this way) |
206 | if (m_stopPacket == 1 && Layers[0].End > FIRST_PACKET_SIZE) m_stopPacket++; | 206 | if (m_stopPacket == 1 && m_layers[0].End > FIRST_PACKET_SIZE) m_stopPacket++; |
207 | 207 | ||
208 | m_currentPacket = StartPacket; | 208 | m_currentPacket = StartPacket; |
209 | } | 209 | } |
@@ -344,7 +344,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
344 | 344 | ||
345 | private void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers) | 345 | private void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers) |
346 | { | 346 | { |
347 | Layers = layers; | 347 | m_layers = layers; |
348 | IsDecoded = true; | 348 | IsDecoded = true; |
349 | RunUpdate(); | 349 | RunUpdate(); |
350 | } | 350 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index 9e0db12..e3a881f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs | |||
@@ -39,6 +39,9 @@ using log4net; | |||
39 | 39 | ||
40 | namespace OpenSim.Region.ClientStack.LindenUDP | 40 | namespace OpenSim.Region.ClientStack.LindenUDP |
41 | { | 41 | { |
42 | /// <summary> | ||
43 | /// This class handles UDP texture requests. | ||
44 | /// </summary> | ||
42 | public class LLImageManager | 45 | public class LLImageManager |
43 | { | 46 | { |
44 | private sealed class J2KImageComparer : IComparer<J2KImage> | 47 | private sealed class J2KImageComparer : IComparer<J2KImage> |
@@ -208,7 +211,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
208 | 211 | ||
209 | #region Priority Queue Helpers | 212 | #region Priority Queue Helpers |
210 | 213 | ||
211 | J2KImage GetHighestPriorityImage() | 214 | private J2KImage GetHighestPriorityImage() |
212 | { | 215 | { |
213 | J2KImage image = null; | 216 | J2KImage image = null; |
214 | 217 | ||
@@ -223,23 +226,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
223 | return image; | 226 | return image; |
224 | } | 227 | } |
225 | 228 | ||
226 | void AddImageToQueue(J2KImage image) | 229 | private void AddImageToQueue(J2KImage image) |
227 | { | 230 | { |
228 | image.PriorityQueueHandle = null; | 231 | image.PriorityQueueHandle = null; |
229 | 232 | ||
230 | lock (m_syncRoot) | 233 | lock (m_syncRoot) |
234 | { | ||
231 | try { m_priorityQueue.Add(ref image.PriorityQueueHandle, image); } | 235 | try { m_priorityQueue.Add(ref image.PriorityQueueHandle, image); } |
232 | catch (Exception) { } | 236 | catch (Exception) { } |
237 | } | ||
233 | } | 238 | } |
234 | 239 | ||
235 | void RemoveImageFromQueue(J2KImage image) | 240 | private void RemoveImageFromQueue(J2KImage image) |
236 | { | 241 | { |
237 | lock (m_syncRoot) | 242 | lock (m_syncRoot) |
243 | { | ||
238 | try { m_priorityQueue.Delete(image.PriorityQueueHandle); } | 244 | try { m_priorityQueue.Delete(image.PriorityQueueHandle); } |
239 | catch (Exception) { } | 245 | catch (Exception) { } |
246 | } | ||
240 | } | 247 | } |
241 | 248 | ||
242 | void UpdateImageInQueue(J2KImage image) | 249 | private void UpdateImageInQueue(J2KImage image) |
243 | { | 250 | { |
244 | lock (m_syncRoot) | 251 | lock (m_syncRoot) |
245 | { | 252 | { |
@@ -254,4 +261,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
254 | 261 | ||
255 | #endregion Priority Queue Helpers | 262 | #endregion Priority Queue Helpers |
256 | } | 263 | } |
257 | } | 264 | } \ No newline at end of file |