Fix a few small issues with the progressive texture-download:

- The initial priority wasn't passed in, so a discardLevel of -1 in the first
  request automatically cancelled texture-download.
- One-packet textures weren't handled, as CurrentPacket starts at 1 and
  StopPacket == 0 in that case.
- Increased MAX_ALLOWED_TEXTURE_REQUESTS to 15; incremental texture downloads
  will cause more requests.
0.6.1-post-fixes
Homer Horwitz 2008-11-17 22:15:02 +00:00
parent a8e40bed52
commit 5972eb8848
2 changed files with 12 additions and 11 deletions

View File

@ -57,11 +57,10 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
/// <summary> /// <summary>
/// We will allow the client to request the same texture n times before dropping further requests /// We will allow the client to request the same texture n times before dropping further requests
/// ///
/// This number includes repeated requests for the same texture at different resolutions (which we don't /// This number contains repeated requests for the same texture at different resolutions (which
/// currently handle properly as far as I know). However, this situation should be handled in a more /// are handled since r7368). However, this situation should be handled in a more sophisticated way.
/// sophisticated way.
/// </summary> /// </summary>
private static readonly int MAX_ALLOWED_TEXTURE_REQUESTS = 5; private static readonly int MAX_ALLOWED_TEXTURE_REQUESTS = 15;
/// <summary> /// <summary>
/// XXX Also going to limit requests for found textures. /// XXX Also going to limit requests for found textures.
@ -150,7 +149,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
m_scene.AddPendingDownloads(1); m_scene.AddPendingDownloads(1);
TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber); TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber, e.Priority);
m_textureSenders.Add(e.RequestedAssetID, requestHandler); m_textureSenders.Add(e.RequestedAssetID, requestHandler);
m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true); m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true);

View File

@ -146,15 +146,17 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
private bool sendFirstPacket = false; private bool sendFirstPacket = false;
private int initialDiscardLevel = 0; private int initialDiscardLevel = 0;
private int initialPacketNum = 0; private int initialPacketNum = 0;
private float initialPriority = 0.0f;
private ImageDownload download; private ImageDownload download;
private IClientAPI RequestUser; private IClientAPI RequestUser;
public TextureSender(IClientAPI client, int discardLevel, uint packetNumber) public TextureSender(IClientAPI client, int discardLevel, uint packetNumber, float priority)
{ {
RequestUser = client; RequestUser = client;
initialDiscardLevel = discardLevel; initialDiscardLevel = discardLevel;
initialPacketNum = (int)packetNumber; initialPacketNum = (int)packetNumber;
initialPriority = priority;
} }
#region ITextureSender Members #region ITextureSender Members
@ -193,7 +195,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
// See ITextureSender // See ITextureSender
public bool SendTexturePacket() public bool SendTexturePacket()
{ {
if (!m_cancel && download.CurrentPacket <= download.StopPacket) if (!m_cancel && (sendFirstPacket || download.CurrentPacket <= download.StopPacket))
{ {
SendPacket(); SendPacket();
return false; return false;
@ -224,7 +226,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
OpenMetaverse.AssetTexture texture = new OpenMetaverse.AssetTexture(m_asset.FullID, m_asset.Data); OpenMetaverse.AssetTexture texture = new OpenMetaverse.AssetTexture(m_asset.FullID, m_asset.Data);
if (texture.DecodeLayerBoundaries()) if (texture.DecodeLayerBoundaries())
{ {
download = new ImageDownload(texture, initialDiscardLevel, 0.0f, initialPacketNum); download = new ImageDownload(texture, initialDiscardLevel, initialPriority, initialPacketNum);
ImageLoaded = true; ImageLoaded = true;
m_sending = true; m_sending = true;
m_cancel = false; m_cancel = false;
@ -258,15 +260,15 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
{ {
sendFirstPacket = false; sendFirstPacket = false;
if (m_asset.Data.Length <= 600) if (m_asset.Data.Length <= ImageDownload.FIRST_IMAGE_PACKET_SIZE)
{ {
RequestUser.SendImageFirstPart(1, m_asset.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2); RequestUser.SendImageFirstPart(1, m_asset.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2);
return; return;
} }
else else
{ {
byte[] firstImageData = new byte[600]; byte[] firstImageData = new byte[ImageDownload.FIRST_IMAGE_PACKET_SIZE];
Buffer.BlockCopy(m_asset.Data, 0, firstImageData, 0, 600); Buffer.BlockCopy(m_asset.Data, 0, firstImageData, 0, ImageDownload.FIRST_IMAGE_PACKET_SIZE);
RequestUser.SendImageFirstPart((ushort)download.TexturePacketCount(), m_asset.FullID, (uint)m_asset.Data.Length, firstImageData, 2); RequestUser.SendImageFirstPart((ushort)download.TexturePacketCount(), m_asset.FullID, (uint)m_asset.Data.Length, firstImageData, 2);
} }
} }