Minor formatting changes and commented out log lines for future debugging of image manager (udp texture fetch). No significant functional changes.
parent
0ef16f9f5b
commit
de746cd987
|
@ -102,7 +102,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
m_currentPacket = 2;
|
m_currentPacket = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (sendMore && packetsSent < packetsToSend && m_currentPacket <= m_stopPacket)
|
while (sendMore && packetsSent < packetsToSend && m_currentPacket <= m_stopPacket)
|
||||||
{
|
{
|
||||||
sendMore = SendPacket(client);
|
sendMore = SendPacket(client);
|
||||||
|
@ -114,17 +114,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return (m_currentPacket > m_stopPacket);
|
return (m_currentPacket > m_stopPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is where we decide what we need to update
|
||||||
|
/// and assign the real discardLevel and packetNumber
|
||||||
|
/// assuming of course that the connected client might be bonkers
|
||||||
|
/// </summary>
|
||||||
public void RunUpdate()
|
public void RunUpdate()
|
||||||
{
|
{
|
||||||
//This is where we decide what we need to update
|
|
||||||
//and assign the real discardLevel and packetNumber
|
|
||||||
//assuming of course that the connected client might be bonkers
|
|
||||||
|
|
||||||
if (!HasAsset)
|
if (!HasAsset)
|
||||||
{
|
{
|
||||||
if (!m_assetRequested)
|
if (!m_assetRequested)
|
||||||
{
|
{
|
||||||
m_assetRequested = true;
|
m_assetRequested = true;
|
||||||
|
// m_log.DebugFormat("[J2KIMAGE]: Requesting asset {0}", TextureID);
|
||||||
AssetService.Get(TextureID.ToString(), this, AssetReceived);
|
AssetService.Get(TextureID.ToString(), this, AssetReceived);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,6 +139,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
//Request decode
|
//Request decode
|
||||||
m_decodeRequested = true;
|
m_decodeRequested = true;
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[J2KIMAGE]: Requesting decode of asset {0}", TextureID);
|
||||||
|
|
||||||
// Do we have a jpeg decoder?
|
// Do we have a jpeg decoder?
|
||||||
if (J2KDecoder != null)
|
if (J2KDecoder != null)
|
||||||
{
|
{
|
||||||
|
@ -149,7 +154,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// Send it off to the jpeg decoder
|
// Send it off to the jpeg decoder
|
||||||
J2KDecoder.BeginDecode(TextureID, m_asset, J2KDecodedCallback);
|
J2KDecoder.BeginDecode(TextureID, m_asset, J2KDecodedCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -328,14 +332,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
if (m_currentPacket == 0)
|
if (m_currentPacket == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (m_currentPacket == 1)
|
if (m_currentPacket == 1)
|
||||||
return FIRST_PACKET_SIZE;
|
return FIRST_PACKET_SIZE;
|
||||||
|
|
||||||
int result = FIRST_PACKET_SIZE + ((int)m_currentPacket - 2) * IMAGE_PACKET_SIZE;
|
int result = FIRST_PACKET_SIZE + ((int)m_currentPacket - 2) * IMAGE_PACKET_SIZE;
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
|
||||||
result = FIRST_PACKET_SIZE;
|
result = FIRST_PACKET_SIZE;
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +379,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
UUID assetID = UUID.Zero;
|
UUID assetID = UUID.Zero;
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
|
{
|
||||||
assetID = asset.FullID;
|
assetID = asset.FullID;
|
||||||
|
}
|
||||||
else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule))
|
else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule))
|
||||||
{
|
{
|
||||||
// Unfortunately we need this here, there's no other way.
|
// Unfortunately we need this here, there's no other way.
|
||||||
|
@ -392,7 +399,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetDataCallback(assetID, asset);
|
AssetDataCallback(assetID, asset);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -574,7 +574,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// Add a handler for the given packet type.
|
/// Add a handler for the given packet type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// The packet is handled on its own thread. If packets must be handled in the order in which thye
|
/// The packet is handled on its own thread. If packets must be handled in the order in which they
|
||||||
/// are received then please use the synchronous version of this method.
|
/// are received then please use the synchronous version of this method.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="packetType"></param>
|
/// <param name="packetType"></param>
|
||||||
|
|
|
@ -84,7 +84,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <param name="newRequest"></param>
|
/// <param name="newRequest"></param>
|
||||||
public void EnqueueReq(TextureRequestArgs newRequest)
|
public void EnqueueReq(TextureRequestArgs newRequest)
|
||||||
{
|
{
|
||||||
//Make sure we're not shutting down..
|
|
||||||
if (!m_shuttingdown)
|
if (!m_shuttingdown)
|
||||||
{
|
{
|
||||||
J2KImage imgrequest;
|
J2KImage imgrequest;
|
||||||
|
@ -99,19 +98,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
//m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID);
|
//m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lock (m_syncRoot)
|
lock (m_syncRoot)
|
||||||
m_priorityQueue.Delete(imgrequest.PriorityQueueHandle);
|
m_priorityQueue.Delete(imgrequest.PriorityQueueHandle);
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}",
|
||||||
|
// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name);
|
||||||
|
|
||||||
//m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}",
|
//m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}",
|
||||||
// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
|
// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
|
||||||
|
|
||||||
//Check the packet sequence to make sure this isn't older than
|
//Check the packet sequence to make sure this isn't older than
|
||||||
//one we've already received
|
//one we've already received
|
||||||
if (newRequest.requestSequence > imgrequest.LastSequence)
|
if (newRequest.requestSequence > imgrequest.LastSequence)
|
||||||
{
|
{
|
||||||
|
@ -126,11 +129,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
//Update the requested priority
|
//Update the requested priority
|
||||||
imgrequest.Priority = newRequest.Priority;
|
imgrequest.Priority = newRequest.Priority;
|
||||||
|
|
||||||
UpdateImageInQueue(imgrequest);
|
UpdateImageInQueue(imgrequest);
|
||||||
|
|
||||||
//Run an update
|
|
||||||
imgrequest.RunUpdate();
|
imgrequest.RunUpdate();
|
||||||
|
|
||||||
|
// J2KImage imgrequest2 = new J2KImage(this);
|
||||||
|
// imgrequest2.J2KDecoder = m_j2kDecodeModule;
|
||||||
|
// imgrequest2.AssetService = m_assetCache;
|
||||||
|
// imgrequest2.AgentID = m_client.AgentId;
|
||||||
|
// imgrequest2.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||||
|
// imgrequest2.DiscardLevel = newRequest.DiscardLevel;
|
||||||
|
// imgrequest2.StartPacket = Math.Max(1, newRequest.PacketNumber);
|
||||||
|
// imgrequest2.Priority = newRequest.Priority;
|
||||||
|
// imgrequest2.TextureID = newRequest.RequestedAssetID;
|
||||||
|
// imgrequest2.Priority = newRequest.Priority;
|
||||||
|
//
|
||||||
|
// //Add this download to the priority queue
|
||||||
|
// AddImageToQueue(imgrequest2);
|
||||||
|
//
|
||||||
|
// imgrequest2.RunUpdate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[LL IMAGE MANAGER]: Ignoring duplicate of existing request for {0} (sequence {1}) from {2} as its request sequence {3} is not greater",
|
||||||
|
// newRequest.RequestedAssetID, imgrequest.LastSequence, m_client.Name, newRequest.requestSequence);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -142,6 +168,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[LL IMAGE MANAGER]: Received request for {0}, start packet {1} from {2}",
|
||||||
|
// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name);
|
||||||
|
|
||||||
//m_log.DebugFormat("[TEX]: (NEW) ID={0}: D={1}, S={2}, P={3}",
|
//m_log.DebugFormat("[TEX]: (NEW) ID={0}: D={1}, S={2}, P={3}",
|
||||||
// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
|
// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
|
||||||
|
|
||||||
|
@ -159,7 +189,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
//Add this download to the priority queue
|
//Add this download to the priority queue
|
||||||
AddImageToQueue(imgrequest);
|
AddImageToQueue(imgrequest);
|
||||||
|
|
||||||
//Run an update
|
|
||||||
imgrequest.RunUpdate();
|
imgrequest.RunUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +205,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
// If null was returned, the texture priority queue is currently empty
|
// If null was returned, the texture priority queue is currently empty
|
||||||
if (image == null)
|
if (image == null)
|
||||||
return false;
|
break;
|
||||||
|
|
||||||
if (image.IsDecoded)
|
if (image.IsDecoded)
|
||||||
{
|
{
|
||||||
|
@ -194,10 +223,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// written. Undecoded textures should not be going into the priority
|
// written. Undecoded textures should not be going into the priority
|
||||||
// queue, because a high priority undecoded texture will clog up the
|
// queue, because a high priority undecoded texture will clog up the
|
||||||
// pipeline for a client
|
// pipeline for a client
|
||||||
return true;
|
// m_log.DebugFormat(
|
||||||
|
// "[LL IMAGE MANAGER]: Exiting image queue processing early on encountering undecoded image {0}",
|
||||||
|
// image.TextureID);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (packetsSent != 0)
|
||||||
|
// m_log.DebugFormat("[LL IMAGE MANAGER]: Processed {0} packets from image queue", packetsSent);
|
||||||
|
|
||||||
return m_priorityQueue.Count > 0;
|
return m_priorityQueue.Count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +255,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
if (m_priorityQueue.Count > 0)
|
if (m_priorityQueue.Count > 0)
|
||||||
{
|
{
|
||||||
try { image = m_priorityQueue.FindMax(); }
|
try
|
||||||
|
{
|
||||||
|
image = m_priorityQueue.FindMax();
|
||||||
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +271,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
lock (m_syncRoot)
|
lock (m_syncRoot)
|
||||||
{
|
{
|
||||||
try { m_priorityQueue.Add(ref image.PriorityQueueHandle, image); }
|
try
|
||||||
|
{
|
||||||
|
m_priorityQueue.Add(ref image.PriorityQueueHandle, image);
|
||||||
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,7 +283,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
lock (m_syncRoot)
|
lock (m_syncRoot)
|
||||||
{
|
{
|
||||||
try { m_priorityQueue.Delete(image.PriorityQueueHandle); }
|
try
|
||||||
|
{
|
||||||
|
m_priorityQueue.Delete(image.PriorityQueueHandle);
|
||||||
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,7 +295,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
lock (m_syncRoot)
|
lock (m_syncRoot)
|
||||||
{
|
{
|
||||||
try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); }
|
try
|
||||||
|
{
|
||||||
|
m_priorityQueue.Replace(image.PriorityQueueHandle, image);
|
||||||
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
image.PriorityQueueHandle = null;
|
image.PriorityQueueHandle = null;
|
||||||
|
|
|
@ -103,6 +103,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
// If it's cached, return the cached results
|
// If it's cached, return the cached results
|
||||||
if (m_decodedCache.TryGetValue(assetID, out result))
|
if (m_decodedCache.TryGetValue(assetID, out result))
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[J2KDecoderModule]: Returning existing cached {0} layers j2k decode for {1}",
|
||||||
|
// result.Length, assetID);
|
||||||
|
|
||||||
callback(assetID, result);
|
callback(assetID, result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue