]> git.sesse.net Git - vlc/commitdiff
stream_filter: dash: bytes to read != length
authorFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 24 Nov 2014 12:18:49 +0000 (13:18 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 18 Dec 2014 20:23:49 +0000 (21:23 +0100)
modules/stream_filter/dash/http/Chunk.cpp
modules/stream_filter/dash/http/Chunk.h

index 301a0c689348fce75e8c8f712db6e3dd4966409d..74c43270fa709d7d88b46c331ac03f6d543121c5 100644 (file)
@@ -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);
index 8853adf27d15e84d6af9f900d4470baf168cceff..8e0cd108d9e016b77785a33e2a35a4af6fdb2254 100644 (file)
@@ -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;
         };
     }