[vlc-commits] demux: adaptative: don't flag eof if still demuxed data in buffer

Francois Cartegnie git at videolan.org
Fri Jul 24 15:09:27 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jul 22 16:11:42 2015 +0200| [cccdd7e34152186fdd2f0d44ea8cdee8eecee2ea] | committer: Francois Cartegnie

demux: adaptative: don't flag eof if still demuxed data in buffer

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

 modules/demux/adaptative/Streams.cpp |   24 +++++++++++++++++++++---
 modules/demux/adaptative/Streams.hpp |    2 ++
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/modules/demux/adaptative/Streams.cpp b/modules/demux/adaptative/Streams.cpp
index f465470..33fa5ba 100644
--- a/modules/demux/adaptative/Streams.cpp
+++ b/modules/demux/adaptative/Streams.cpp
@@ -180,14 +180,19 @@ Stream::status Stream::demux(HTTPConnectionManager *connManager, mtime_t nz_dead
     {
         /* need to read, demuxer still buffering, ... */
         if(read(connManager) <= 0)
-            return Stream::status_eof;
-
-        if(nz_deadline + VLC_TS_0 > output->getPCR()) /* need to read more */
+        {
+            if(output->isEmpty())
+                return Stream::status_eof;
+        }
+        else if(nz_deadline + VLC_TS_0 > output->getPCR()) /* need to read more */
+        {
             return Stream::status_buffering;
+        }
     }
 
     if(send)
         output->sendToDecoder(nz_deadline);
+
     return Stream::status_demuxed;
 }
 
@@ -487,6 +492,19 @@ bool BaseStreamOutput::isSelected() const
     return b_selected;
 }
 
+bool BaseStreamOutput::isEmpty() const
+{
+    bool b_empty = true;
+    vlc_mutex_lock(const_cast<vlc_mutex_t *>(&lock));
+    std::list<Demuxed *>::const_iterator it;
+    for(it=queues.begin(); it!=queues.end() && b_empty; ++it)
+    {
+        b_empty = !(*it)->p_queue;
+    }
+    vlc_mutex_unlock(const_cast<vlc_mutex_t *>(&lock));
+    return b_empty;
+}
+
 void BaseStreamOutput::sendToDecoder(mtime_t nzdeadline)
 {
     vlc_mutex_lock(&lock);
diff --git a/modules/demux/adaptative/Streams.hpp b/modules/demux/adaptative/Streams.hpp
index ff7fb3b..1c0be95 100644
--- a/modules/demux/adaptative/Streams.hpp
+++ b/modules/demux/adaptative/Streams.hpp
@@ -114,6 +114,7 @@ namespace adaptative
         virtual bool seekAble() const = 0;
         virtual void setPosition(mtime_t) = 0;
         virtual void sendToDecoder(mtime_t) = 0;
+        virtual bool isEmpty() const = 0;
         virtual bool reinitsOnSeek() const = 0;
         virtual bool switchAllowed() const = 0;
         virtual bool isSelected() const = 0;
@@ -145,6 +146,7 @@ namespace adaptative
         virtual bool seekAble() const; /* reimpl */
         virtual void setPosition(mtime_t); /* reimpl */
         virtual void sendToDecoder(mtime_t); /* reimpl */
+        virtual bool isEmpty() const; /* reimpl */
         virtual bool reinitsOnSeek() const; /* reimpl */
         virtual bool switchAllowed() const; /* reimpl */
         virtual bool isSelected() const; /* reimpl */



More information about the vlc-commits mailing list