[vlc-commits] demux: adaptative: always set first pcr to lowest dts

Francois Cartegnie git at videolan.org
Thu Jun 18 17:32:48 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jun 18 16:17:44 2015 +0200| [3dc73d5d7262161134f7ed4c9813864e2e090844] | committer: Francois Cartegnie

demux: adaptative: always set first pcr to lowest dts

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

 modules/demux/adaptative/PlaylistManager.cpp |    4 ++--
 modules/demux/adaptative/PlaylistManager.h   |    2 +-
 modules/demux/adaptative/Streams.cpp         |    5 +++--
 modules/demux/adaptative/Streams.hpp         |    2 +-
 modules/demux/dash/dash.cpp                  |   23 +++++++++++++++++------
 modules/demux/hls/hls.cpp                    |   23 +++++++++++++++++------
 6 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/modules/demux/adaptative/PlaylistManager.cpp b/modules/demux/adaptative/PlaylistManager.cpp
index b6b1657..a65bfe5 100644
--- a/modules/demux/adaptative/PlaylistManager.cpp
+++ b/modules/demux/adaptative/PlaylistManager.cpp
@@ -111,7 +111,7 @@ bool PlaylistManager::start(demux_t *demux)
     return true;
 }
 
-Stream::status PlaylistManager::demux(mtime_t nzdeadline)
+Stream::status PlaylistManager::demux(mtime_t nzdeadline, bool send)
 {
     Stream::status i_return = Stream::status_eof;
 
@@ -121,7 +121,7 @@ Stream::status PlaylistManager::demux(mtime_t nzdeadline)
             continue;
 
         Stream::status i_ret =
-                streams[type]->demux(conManager, nzdeadline);
+                streams[type]->demux(conManager, nzdeadline, send);
 
         if(i_ret == Stream::status_buffering)
         {
diff --git a/modules/demux/adaptative/PlaylistManager.h b/modules/demux/adaptative/PlaylistManager.h
index 4cfd5de..d8adebc 100644
--- a/modules/demux/adaptative/PlaylistManager.h
+++ b/modules/demux/adaptative/PlaylistManager.h
@@ -52,7 +52,7 @@ namespace adaptative
 
             bool    start(demux_t *);
 
-            Stream::status demux(mtime_t);
+            Stream::status demux(mtime_t, bool);
             mtime_t getDuration() const;
             mtime_t getPCR() const;
             mtime_t getFirstDTS() const;
diff --git a/modules/demux/adaptative/Streams.cpp b/modules/demux/adaptative/Streams.cpp
index a338c71..c786e65 100644
--- a/modules/demux/adaptative/Streams.cpp
+++ b/modules/demux/adaptative/Streams.cpp
@@ -143,7 +143,7 @@ bool Stream::seekAble() const
     return (output && output->seekAble());
 }
 
-Stream::status Stream::demux(HTTPConnectionManager *connManager, mtime_t nz_deadline)
+Stream::status Stream::demux(HTTPConnectionManager *connManager, mtime_t nz_deadline, bool send)
 {
     if(nz_deadline + VLC_TS_0 > output->getPCR()) /* not already demuxed */
     {
@@ -155,7 +155,8 @@ Stream::status Stream::demux(HTTPConnectionManager *connManager, mtime_t nz_dead
             return Stream::status_buffering;
     }
 
-    output->sendToDecoder(nz_deadline);
+    if(send)
+        output->sendToDecoder(nz_deadline);
     return Stream::status_demuxed;
 }
 
diff --git a/modules/demux/adaptative/Streams.hpp b/modules/demux/adaptative/Streams.hpp
index 29144d6..da0e5b5 100644
--- a/modules/demux/adaptative/Streams.hpp
+++ b/modules/demux/adaptative/Streams.hpp
@@ -70,7 +70,7 @@ namespace adaptative
         int esCount() const;
         bool seekAble() const;
         typedef enum {status_eof, status_buffering, status_demuxed} status;
-        status demux(HTTPConnectionManager *, mtime_t);
+        status demux(HTTPConnectionManager *, mtime_t, bool);
         bool setPosition(mtime_t, bool);
         mtime_t getPosition() const;
         void prune();
diff --git a/modules/demux/dash/dash.cpp b/modules/demux/dash/dash.cpp
index bb3a0a7..52af59d 100644
--- a/modules/demux/dash/dash.cpp
+++ b/modules/demux/dash/dash.cpp
@@ -182,8 +182,19 @@ static int Demux(demux_t *p_demux)
 {
     demux_sys_t *p_sys = p_demux->p_sys;
 
+    if(p_sys->i_nzpcr == VLC_TS_INVALID)
+    {
+        if( Stream::status_eof ==
+            p_sys->p_dashManager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT, false) )
+        {
+            return VLC_DEMUXER_EOF;
+        }
+        mtime_t i_dts = p_sys->p_dashManager->getFirstDTS();
+        p_sys->i_nzpcr = i_dts;
+    }
+
     Stream::status status =
-            p_sys->p_dashManager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT);
+            p_sys->p_dashManager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT, true);
     switch(status)
     {
     case Stream::status_eof:
@@ -191,12 +202,12 @@ static int Demux(demux_t *p_demux)
     case Stream::status_buffering:
         break;
     case Stream::status_demuxed:
-        if(p_sys->i_nzpcr == VLC_TS_INVALID)
-            p_sys->i_nzpcr = p_sys->p_dashManager->getPCR();
-        else
+        if( p_sys->i_nzpcr != VLC_TS_INVALID )
+        {
             p_sys->i_nzpcr += DEMUX_INCREMENT;
-        int group = p_sys->p_dashManager->getGroup();
-        es_out_Control(p_demux->out, ES_OUT_SET_GROUP_PCR, group, VLC_TS_0 + p_sys->i_nzpcr);
+            int group = p_sys->p_dashManager->getGroup();
+            es_out_Control(p_demux->out, ES_OUT_SET_GROUP_PCR, group, VLC_TS_0 + p_sys->i_nzpcr);
+        }
         break;
     }
 
diff --git a/modules/demux/hls/hls.cpp b/modules/demux/hls/hls.cpp
index 943b585..78812b5 100644
--- a/modules/demux/hls/hls.cpp
+++ b/modules/demux/hls/hls.cpp
@@ -218,8 +218,19 @@ static int Demux(demux_t *p_demux)
 {
     demux_sys_t *p_sys = p_demux->p_sys;
 
+    if(p_sys->i_nzpcr == VLC_TS_INVALID)
+    {
+        if( Stream::status_eof ==
+            p_sys->p_manager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT, false) )
+        {
+            return VLC_DEMUXER_EOF;
+        }
+        mtime_t i_dts = p_sys->p_manager->getFirstDTS();
+        p_sys->i_nzpcr = i_dts;
+    }
+
     Stream::status status =
-            p_sys->p_manager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT);
+            p_sys->p_manager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT, true);
     switch(status)
     {
     case Stream::status_eof:
@@ -227,12 +238,12 @@ static int Demux(demux_t *p_demux)
     case Stream::status_buffering:
         break;
     case Stream::status_demuxed:
-        if(p_sys->i_nzpcr == VLC_TS_INVALID)
-            p_sys->i_nzpcr = p_sys->p_manager->getPCR();
-        else
+        if( p_sys->i_nzpcr != VLC_TS_INVALID )
+        {
             p_sys->i_nzpcr += DEMUX_INCREMENT;
-        int group = p_sys->p_manager->getGroup();
-        es_out_Control(p_demux->out, ES_OUT_SET_GROUP_PCR, group, VLC_TS_0 + p_sys->i_nzpcr);
+            int group = p_sys->p_manager->getGroup();
+            es_out_Control(p_demux->out, ES_OUT_SET_GROUP_PCR, group, VLC_TS_0 + p_sys->i_nzpcr);
+        }
         break;
     }
 



More information about the vlc-commits mailing list