[vlc-commits] stream_filter: dash: bytes to read != length

Francois Cartegnie git at videolan.org
Thu Dec 18 22:39:50 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Nov 24 13:18:49 2014 +0100| [1afd4f374d05eadc4dbaff0ca714a58e66105c36] | committer: Francois Cartegnie

stream_filter: dash: bytes to read != length

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1afd4f374d05eadc4dbaff0ca714a58e66105c36
---

 modules/stream_filter/dash/http/Chunk.cpp |   14 +++++++++++++-
 modules/stream_filter/dash/http/Chunk.h   |    2 ++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/modules/stream_filter/dash/http/Chunk.cpp b/modules/stream_filter/dash/http/Chunk.cpp
index 301a0c6..74c4327 100644
--- a/modules/stream_filter/dash/http/Chunk.cpp
+++ b/modules/stream_filter/dash/http/Chunk.cpp
@@ -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);
diff --git a/modules/stream_filter/dash/http/Chunk.h b/modules/stream_filter/dash/http/Chunk.h
index 8853adf..8e0cd10 100644
--- a/modules/stream_filter/dash/http/Chunk.h
+++ b/modules/stream_filter/dash/http/Chunk.h
@@ -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;
         };
     }



More information about the vlc-commits mailing list