[vlc-commits] demux: adaptive: don't wait min rebuffering on discontinuity
Francois Cartegnie
git at videolan.org
Fri Feb 26 09:15:31 UTC 2021
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Feb 25 19:06:52 2021 +0100| [3c3536afd72bc2a380b801764b221f5c76948979] | committer: Francois Cartegnie
demux: adaptive: don't wait min rebuffering on discontinuity
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3c3536afd72bc2a380b801764b221f5c76948979
---
modules/demux/adaptive/PlaylistManager.cpp | 9 ++++++++-
modules/demux/adaptive/PlaylistManager.h | 7 +++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index 283c3f780b..bca4b59739 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -74,6 +74,7 @@ PlaylistManager::PlaylistManager( demux_t *p_demux_,
nextPlaylistupdate = 0;
demux.i_nzpcr = VLC_TICK_INVALID;
demux.i_firstpcr = VLC_TICK_INVALID;
+ demux.pcr_syncpoint = TimestampSynchronizationPoint::RandomAccess;
vlc_mutex_init(&demux.lock);
vlc_cond_init(&demux.cond);
vlc_mutex_init(&cached.lock);
@@ -266,7 +267,10 @@ AbstractStream::BufferingStatus PlaylistManager::bufferize(vlc_tick_t i_nzdeadli
vlc_mutex_lock(&demux.lock);
if(demux.i_nzpcr == VLC_TICK_INVALID &&
- i_return != AbstractStream::BufferingStatus::Lessthanmin /* prevents starting before buffering is reached */ )
+ /* don't wait minbuffer on simple discontinuity or restart */
+ (demux.pcr_syncpoint == TimestampSynchronizationPoint::Discontinuity ||
+ /* prevents starting before buffering is reached */
+ i_return != AbstractStream::BufferingStatus::Lessthanmin ))
{
demux.i_nzpcr = getFirstDTS();
}
@@ -485,6 +489,7 @@ int PlaylistManager::doDemux(vlc_tick_t increment)
vlc_mutex_lock(&demux.lock);
demux.i_nzpcr = VLC_TICK_INVALID;
demux.i_firstpcr = VLC_TICK_INVALID;
+ demux.pcr_syncpoint = TimestampSynchronizationPoint::Discontinuity;
es_out_Control(p_demux->out, ES_OUT_RESET_PCR);
vlc_mutex_unlock(&demux.lock);
break;
@@ -603,6 +608,7 @@ int PlaylistManager::doControl(int i_query, va_list args)
return VLC_EGENERIC;
}
+ demux.pcr_syncpoint = TimestampSynchronizationPoint::RandomAccess;
demux.i_nzpcr = VLC_TICK_INVALID;
cached.lastupdate = 0;
setBufferingRunState(true);
@@ -621,6 +627,7 @@ int PlaylistManager::doControl(int i_query, va_list args)
}
vlc_mutex_locker locker(&cached.lock);
+ demux.pcr_syncpoint = TimestampSynchronizationPoint::RandomAccess;
demux.i_nzpcr = VLC_TICK_INVALID;
cached.lastupdate = 0;
setBufferingRunState(true);
diff --git a/modules/demux/adaptive/PlaylistManager.h b/modules/demux/adaptive/PlaylistManager.h
index 3eb900fdff..3de091a5f5 100644
--- a/modules/demux/adaptive/PlaylistManager.h
+++ b/modules/demux/adaptive/PlaylistManager.h
@@ -106,9 +106,16 @@ namespace adaptive
std::vector<AbstractStream *> streams;
BasePeriod *currentPeriod;
+ enum class TimestampSynchronizationPoint
+ {
+ RandomAccess,
+ Discontinuity,
+ };
+
/* shared with demux/buffering */
struct
{
+ TimestampSynchronizationPoint pcr_syncpoint;
vlc_tick_t i_nzpcr;
vlc_tick_t i_firstpcr;
mutable vlc_mutex_t lock;
More information about the vlc-commits
mailing list