[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 149248] First and last chunk download priority
From:       Joris Guisson <joris.guisson () gmail ! com>
Date:       2007-08-31 16:57:24
Message-ID: 20070831165724.9959.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=149248         
joris.guisson gmail com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From joris.guisson gmail com  2007-08-31 18:57 -------
SVN commit 706964 by guisson:

Prioritise at least 1 % of multimedia files instead of the 1 chunk we currently do.

Initial patch was provided by Byte Smythe with some modifications from myself.

BUG: 149248



 M  +32 -10    chunkmanager.cpp  


--- branches/extragear/kde3/network/ktorrent/libktorrent/torrent/chunkmanager.cpp #706963:706964
 @ -93,22 +93,38  @
 			for(Uint32 i=0; i<tor.getNumFiles(); ++i)
 			{
 				bt::TorrentFile & file = tor.getFile(i);
-				if (file.isMultimedia() && file.getPriority() != bt::ONLY_SEED_PRIORITY) 
+				if (!file.isMultimedia() || file.getPriority() == bt::ONLY_SEED_PRIORITY) 
+					continue;
+
+				if (file.getFirstChunk() == file.getLastChunk())
 				{
-					prioritise(file.getFirstChunk(), file.getFirstChunk()+1, PREVIEW_PRIORITY);
-					if (file.getLastChunk() - file.getFirstChunk() > 2)
-						prioritise(file.getLastChunk() -1,file.getLastChunk(), PREVIEW_PRIORITY);
+					// prioritise whole file 
+					prioritise(file.getFirstChunk(),file.getLastChunk(),PREVIEW_PRIORITY);
 				}
+				else
+				{
+					Uint32 chunkOffset;
+					chunkOffset = ((file.getLastChunk() - file.getFirstChunk()) / 100) + 1;
+					prioritise(file.getFirstChunk(), file.getFirstChunk()+chunkOffset, PREVIEW_PRIORITY);
+					if (file.getLastChunk() - file.getFirstChunk() > chunkOffset)
+					{
+						prioritise(file.getLastChunk() - chunkOffset, file.getLastChunk(), PREVIEW_PRIORITY);
+					}
+				}
 			}
 		}
 		else
 		{
 			if(tor.isMultimedia())
 			{
-				prioritise(0,1,PREVIEW_PRIORITY);
-				if (tor.getNumChunks() > 2)
-					prioritise(tor.getNumChunks() - 2,tor.getNumChunks() - 1,PREVIEW_PRIORITY);
-				//this->prioritise(getNumChunks()-2, getNumChunks()-1);
+				Uint32 chunkOffset;
+				chunkOffset = (tor.getNumChunks() / 100) + 1;
+
+				prioritise(0,chunkOffset,PREVIEW_PRIORITY);
+				if (tor.getNumChunks() > chunkOffset)
+				{
+					prioritise(tor.getNumChunks() - chunkOffset, tor.getNumChunks() - 1,PREVIEW_PRIORITY);
+				}
 			}
 		}
 	}
 @ -791,9 +807,15  @
 			// if it is a multimedia file, prioritise first and last chunks of file
 			if (tf->isMultimedia())
 			{
-				prioritise(first,first+1,PREVIEW_PRIORITY);
+				Uint32 chunkOffset;
+				chunkOffset = ((last - first) / 100) + 1;
+
+				prioritise(first,first+chunkOffset,PREVIEW_PRIORITY);
 				if (last - first > 2)
-					prioritise(last -1,last, PREVIEW_PRIORITY);
+				{
+					prioritise(last - chunkOffset, last, PREVIEW_PRIORITY);
+					//prioritise(last -1,last, PREVIEW_PRIORITY);
+				}
 			}
 		}
 		else
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic