[vlc-commits] demux: hls: scale duration from tick
Francois Cartegnie
git at videolan.org
Mon Jul 20 21:03:16 CEST 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jul 10 18:29:07 2020 +0200| [1e133cd6f79529f66ee94d453eb5234f3b3a059a] | committer: Francois Cartegnie
demux: hls: scale duration from tick
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1e133cd6f79529f66ee94d453eb5234f3b3a059a
---
modules/demux/hls/playlist/Parser.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/modules/demux/hls/playlist/Parser.cpp b/modules/demux/hls/playlist/Parser.cpp
index 41660966de..22e0ee41f1 100644
--- a/modules/demux/hls/playlist/Parser.cpp
+++ b/modules/demux/hls/playlist/Parser.cpp
@@ -258,16 +258,15 @@ void M3U8Parser::parseSegments(vlc_object_t *, Representation *rep, const std::l
segment->setSourceUrl(uritag->getValue().value);
/* Need to use EXTXTARGETDURATION as default as some can't properly set segment one */
- double duration = rep->targetDuration;
+ vlc_tick_t nzDuration = vlc_tick_from_sec(rep->targetDuration);
if(ctx_extinf)
{
const Attribute *durAttribute = ctx_extinf->getAttributeByName("DURATION");
if(durAttribute)
- duration = durAttribute->floatingPoint();
+ nzDuration = vlc_tick_from_sec(durAttribute->floatingPoint());
ctx_extinf = NULL;
}
- const vlc_tick_t nzDuration = vlc_tick_from_sec( duration );
- segment->duration.Set(duration * (uint64_t) rep->getTimescale());
+ segment->duration.Set(rep->getTimescale().ToScaled(nzDuration));
segment->startTime.Set(rep->getTimescale().ToScaled(nzStartTime));
nzStartTime += nzDuration;
totalduration += nzDuration;
More information about the vlc-commits
mailing list