[vlc-commits] demux: adaptative: handle end of period

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:55:28 2015 +0200| [23d44ceb6b760af015238a64ba45fb24ddf491e7] | committer: Francois Cartegnie

demux: adaptative: handle end of period

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

 modules/demux/adaptative/PlaylistManager.cpp |    8 ++++++++
 modules/demux/adaptative/Streams.hpp         |    2 +-
 modules/demux/dash/dash.cpp                  |    5 +++++
 modules/demux/hls/hls.cpp                    |    4 ++++
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/modules/demux/adaptative/PlaylistManager.cpp b/modules/demux/adaptative/PlaylistManager.cpp
index 82dc63c..d65bede 100644
--- a/modules/demux/adaptative/PlaylistManager.cpp
+++ b/modules/demux/adaptative/PlaylistManager.cpp
@@ -157,6 +157,14 @@ Stream::status PlaylistManager::demux(mtime_t nzdeadline, bool send)
         }
     }
 
+    /* might be end of current period */
+    if(i_return == Stream::status_eof && currentPeriod)
+    {
+        unsetPeriod();
+        currentPeriod = playlist->getNextPeriod(currentPeriod);
+        i_return = (setupPeriod()) ? Stream::status_eop : Stream::status_eof;
+    }
+
     return i_return;
 }
 
diff --git a/modules/demux/adaptative/Streams.hpp b/modules/demux/adaptative/Streams.hpp
index 1c0be95..b567ccd 100644
--- a/modules/demux/adaptative/Streams.hpp
+++ b/modules/demux/adaptative/Streams.hpp
@@ -77,7 +77,7 @@ namespace adaptative
         bool isSelected() const;
         bool reactivate(mtime_t);
         bool isDisabled() const;
-        typedef enum {status_eof, status_buffering, status_demuxed} status;
+        typedef enum {status_eof, status_eop, status_buffering, status_demuxed} status;
         status demux(HTTPConnectionManager *, mtime_t, bool);
         bool setPosition(mtime_t, bool);
         mtime_t getPosition() const;
diff --git a/modules/demux/dash/dash.cpp b/modules/demux/dash/dash.cpp
index fb996f0..82d6298 100644
--- a/modules/demux/dash/dash.cpp
+++ b/modules/demux/dash/dash.cpp
@@ -197,12 +197,17 @@ static int Demux(demux_t *p_demux)
 
     Stream::status status =
             p_sys->p_dashManager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT, true);
+
     switch(status)
     {
     case Stream::status_eof:
         return VLC_DEMUXER_EOF;
     case Stream::status_buffering:
         break;
+    case Stream::status_eop:
+        p_sys->i_nzpcr = VLC_TS_INVALID;
+        es_out_Control(p_demux->out, ES_OUT_RESET_PCR);
+        break;
     case Stream::status_demuxed:
         if( p_sys->i_nzpcr != VLC_TS_INVALID )
         {
diff --git a/modules/demux/hls/hls.cpp b/modules/demux/hls/hls.cpp
index 19984dd..2e85ca3 100644
--- a/modules/demux/hls/hls.cpp
+++ b/modules/demux/hls/hls.cpp
@@ -241,6 +241,10 @@ static int Demux(demux_t *p_demux)
         return VLC_DEMUXER_EOF;
     case Stream::status_buffering:
         break;
+    case Stream::status_eop:
+        p_sys->i_nzpcr = VLC_TS_INVALID;
+        es_out_Control(p_demux->out, ES_OUT_RESET_PCR);
+        break;
     case Stream::status_demuxed:
         if( p_sys->i_nzpcr != VLC_TS_INVALID )
         {



More information about the vlc-commits mailing list