Commit 1afd4f37 authored by Francois Cartegnie's avatar Francois Cartegnie

stream_filter: dash: bytes to read != length

parent 6a8ddb34
......@@ -36,6 +36,7 @@ Chunk::Chunk () :
isHostname (false),
length (0),
bytesRead (0),
bytesToRead (0),
connection (NULL)
{
}
......@@ -55,10 +56,14 @@ const std::string& Chunk::getUrl () const
void Chunk::setEndByte (size_t endByte)
{
this->endByte = endByte;
if (endByte > startByte)
bytesToRead = endByte - startByte;
}
void Chunk::setStartByte (size_t startByte)
{
this->startByte = startByte;
if (endByte > startByte)
bytesToRead = endByte - startByte;
}
void Chunk::setUrl (const std::string& url )
{
......@@ -129,10 +134,17 @@ void Chunk::setBytesRead (uint64_t bytes)
{
this->bytesRead = bytes;
}
void Chunk::setBytesToRead (uint64_t bytes)
{
bytesToRead = bytes;
}
uint64_t Chunk::getBytesToRead () const
{
return this->length - this->bytesRead;
return length - bytesRead;
}
size_t Chunk::getPercentDownloaded () const
{
return (size_t)(((float)this->bytesRead / this->length) * 100);
......
......@@ -63,6 +63,7 @@ namespace dash
void setConnection (IHTTPConnection *connection);
void setBytesRead (uint64_t bytes);
void setBytesToRead (uint64_t bytes);
void setLength (uint64_t length);
void setEndByte (size_t endByte);
void setStartByte (size_t startByte);
......@@ -86,6 +87,7 @@ namespace dash
bool isHostname;
uint64_t length;
uint64_t bytesRead;
uint64_t bytesToRead;
IHTTPConnection *connection;
};
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment