[vlc-commits] demux: hls: do proper schedule on update
Francois Cartegnie
git at videolan.org
Thu May 14 10:18:49 CEST 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed May 13 17:41:00 2020 +0200| [9ddcb1b5f9a83ce1250982c44a6b7df152cfec4c] | committer: Francois Cartegnie
demux: hls: do proper schedule on update
non playback point based update now appears
since closer to the edge buffering
reverts 390078318d4f62827a5f185bf922e9b03052a19b
refs #24701
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9ddcb1b5f9a83ce1250982c44a6b7df152cfec4c
---
modules/demux/adaptive/SegmentTracker.cpp | 7 +++----
modules/demux/adaptive/playlist/BaseRepresentation.cpp | 2 +-
modules/demux/adaptive/playlist/BaseRepresentation.h | 2 +-
modules/demux/hls/playlist/Parser.cpp | 8 --------
modules/demux/hls/playlist/Representation.cpp | 15 +++++++++++----
modules/demux/hls/playlist/Representation.hpp | 2 +-
6 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/modules/demux/adaptive/SegmentTracker.cpp b/modules/demux/adaptive/SegmentTracker.cpp
index 27d817ba1d..8d6e4981fe 100644
--- a/modules/demux/adaptive/SegmentTracker.cpp
+++ b/modules/demux/adaptive/SegmentTracker.cpp
@@ -227,8 +227,7 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed,
next = rep->translateSegmentNumber(next, prevRep);
}
- if(b_updated)
- curRepresentation->scheduleNextUpdate(next);
+ curRepresentation->scheduleNextUpdate(next, b_updated);
if(rep->getStreamFormat() != format)
{
@@ -423,8 +422,8 @@ void SegmentTracker::updateSelected()
{
if(curRepresentation && curRepresentation->needsUpdate())
{
- curRepresentation->runLocalUpdates(resources);
- curRepresentation->scheduleNextUpdate(curNumber);
+ bool b_updated = curRepresentation->runLocalUpdates(resources);
+ curRepresentation->scheduleNextUpdate(curNumber, b_updated);
}
}
diff --git a/modules/demux/adaptive/playlist/BaseRepresentation.cpp b/modules/demux/adaptive/playlist/BaseRepresentation.cpp
index ab81dd861f..c782a88d7d 100644
--- a/modules/demux/adaptive/playlist/BaseRepresentation.cpp
+++ b/modules/demux/adaptive/playlist/BaseRepresentation.cpp
@@ -98,7 +98,7 @@ bool BaseRepresentation::runLocalUpdates(SharedResources *)
return false;
}
-void BaseRepresentation::scheduleNextUpdate(uint64_t)
+void BaseRepresentation::scheduleNextUpdate(uint64_t, bool)
{
}
diff --git a/modules/demux/adaptive/playlist/BaseRepresentation.h b/modules/demux/adaptive/playlist/BaseRepresentation.h
index 2867660a0d..03f509fc3d 100644
--- a/modules/demux/adaptive/playlist/BaseRepresentation.h
+++ b/modules/demux/adaptive/playlist/BaseRepresentation.h
@@ -67,7 +67,7 @@ namespace adaptive
virtual vlc_tick_t getMinAheadTime (uint64_t) const;
virtual bool needsUpdate () const;
virtual bool runLocalUpdates (SharedResources *);
- virtual void scheduleNextUpdate (uint64_t);
+ virtual void scheduleNextUpdate (uint64_t, bool);
virtual void debug (vlc_object_t *,int = 0) const;
diff --git a/modules/demux/hls/playlist/Parser.cpp b/modules/demux/hls/playlist/Parser.cpp
index 404eed44d7..41660966de 100644
--- a/modules/demux/hls/playlist/Parser.cpp
+++ b/modules/demux/hls/playlist/Parser.cpp
@@ -32,7 +32,6 @@
#include "../../adaptive/tools/Retrieve.hpp"
#include "../../adaptive/tools/Helper.h"
#include "../../adaptive/tools/Conversions.hpp"
-#include "../../adaptive/logic/BufferingLogic.hpp"
#include "M3U8.hpp"
#include "Tags.hpp"
@@ -146,13 +145,6 @@ void M3U8Parser::createAndFillRepresentation(vlc_object_t *p_obj, BaseAdaptation
if(rep)
{
parseSegments(p_obj, rep, tagslist);
- if(rep->isLive())
- {
- /* avoid update playlist immediately */
- logic::DefaultBufferingLogic buflogic;
- uint64_t startseq = buflogic.getStartSegmentNumber(rep);
- rep->scheduleNextUpdate(startseq);
- }
adaptSet->addRepresentation(rep);
}
}
diff --git a/modules/demux/hls/playlist/Representation.cpp b/modules/demux/hls/playlist/Representation.cpp
index ec790e488e..22e78fb6a8 100644
--- a/modules/demux/hls/playlist/Representation.cpp
+++ b/modules/demux/hls/playlist/Representation.cpp
@@ -100,13 +100,18 @@ void Representation::debug(vlc_object_t *obj, int indent) const
}
}
-void Representation::scheduleNextUpdate(uint64_t number)
+void Representation::scheduleNextUpdate(uint64_t number, bool b_updated)
{
- const AbstractPlaylist *playlist = getPlaylist();
- const vlc_tick_t now = vlc_tick_now();
+ if(!isLive())
+ return;
+
+ if(!b_updated && nextUpdateTime > 0)
+ return;
/* Compute new update time */
vlc_tick_t minbuffer = getMinAheadTime(number);
+ const AbstractPlaylist *playlist = getPlaylist();
+ const vlc_tick_t now = vlc_tick_now();
/* Update frequency must always be at least targetDuration (if any)
* but we need to update before reaching that last segment, thus -1 */
@@ -135,7 +140,9 @@ void Representation::scheduleNextUpdate(uint64_t number)
bool Representation::needsUpdate() const
{
- return !b_failed && (!b_loaded || (isLive() && nextUpdateTime < vlc_tick_now()));
+ return !b_failed && (!b_loaded || (isLive() &&
+ nextUpdateTime != 0 &&
+ nextUpdateTime < vlc_tick_now()));
}
bool Representation::runLocalUpdates(SharedResources *res)
diff --git a/modules/demux/hls/playlist/Representation.hpp b/modules/demux/hls/playlist/Representation.hpp
index 815981d57c..1e8587dc07 100644
--- a/modules/demux/hls/playlist/Representation.hpp
+++ b/modules/demux/hls/playlist/Representation.hpp
@@ -47,7 +47,7 @@ namespace hls
Url getPlaylistUrl() const;
bool isLive() const;
bool initialized() const;
- virtual void scheduleNextUpdate(uint64_t); /* reimpl */
+ virtual void scheduleNextUpdate(uint64_t, bool); /* reimpl */
virtual bool needsUpdate() const; /* reimpl */
virtual void debug(vlc_object_t *, int) const; /* reimpl */
virtual bool runLocalUpdates(SharedResources *); /* reimpl */
More information about the vlc-commits
mailing list