demux/adaptive: ensure monotonically increasing PCR
authorFilip Roséen <filip@atch.se>
Thu, 13 Oct 2016 18:30:53 +0000 (20:30 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Fri, 14 Oct 2016 09:15:53 +0000 (11:15 +0200)
Modified-by: Francois Cartegnie <fcvlcdev@free.fr>
Signed-off-by: Francois Cartegnie <fcvlcdev@free.fr>
modules/demux/adaptive/PlaylistManager.cpp
modules/demux/adaptive/PlaylistManager.h

index 9662257..58056ce 100644 (file)
@@ -236,7 +236,7 @@ AbstractStream::buffering_status PlaylistManager::bufferize(mtime_t i_nzdeadline
     return i_return;
 }
 
-AbstractStream::status PlaylistManager::dequeue(mtime_t *pi_nzbarrier)
+AbstractStream::status PlaylistManager::dequeue(mtime_t i_floor, mtime_t *pi_nzbarrier)
 {
     AbstractStream::status i_return = AbstractStream::status_eof;
 
@@ -252,7 +252,7 @@ AbstractStream::status PlaylistManager::dequeue(mtime_t *pi_nzbarrier)
         if( i_ret > i_return )
             i_return = i_ret;
 
-        if( i_pcr > VLC_TS_INVALID )
+        if( i_pcr > i_floor )
             *pi_nzbarrier = std::min( *pi_nzbarrier, i_pcr - VLC_TS_0 );
     }
 
@@ -422,7 +422,7 @@ int PlaylistManager::doDemux(int64_t increment)
     mtime_t i_nzbarrier = demux.i_nzpcr + increment;
     vlc_mutex_unlock(&demux.lock);
 
-    AbstractStream::status status = dequeue(&i_nzbarrier);
+    AbstractStream::status status = dequeue(demux.i_nzpcr, &i_nzbarrier);
 
     updateControlsContentType();
     updateControlsPosition();
index a39371b..ac5a872 100644 (file)
@@ -55,7 +55,7 @@ namespace adaptive
             void    stop();
 
             AbstractStream::buffering_status bufferize(mtime_t, unsigned, unsigned);
-            AbstractStream::status dequeue(mtime_t *);
+            AbstractStream::status dequeue(mtime_t, mtime_t *);
             void drain();
 
             virtual bool needsUpdate() const;