Calculate chunkcount with the real file size, not the size saved in the database (might be wrong and results in corrupted download).

This commit is contained in:
Andreas 2013-11-29 13:59:48 +01:00
parent d053039f80
commit 42d9a86ff0
1 changed files with 4 additions and 4 deletions

View File

@ -628,10 +628,6 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song,
if (!(song.url().scheme() == "file"))
return;
// Calculate the number of chunks
int chunk_count = qRound((song.filesize() / kFileChunkSize) + 0.5);
int chunk_number = 1;
// Open the file
QFile file(song.url().toLocalFile());
file.open(QIODevice::ReadOnly);
@ -643,6 +639,10 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song,
QImage null_image;
// Calculate the number of chunks
int chunk_count = qRound((file.size() / kFileChunkSize) + 0.5);
int chunk_number = 1;
while (!file.atEnd()) {
// Read file chunk
data = file.read(kFileChunkSize);