[vlc-devel] [PATCH] demux: hls: code cleaning

Zhao Zhili wantlamy at gmail.com
Wed Aug 2 14:59:09 CEST 2017


---
 modules/demux/hls/playlist/Parser.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/demux/hls/playlist/Parser.cpp
b/modules/demux/hls/playlist/Parser.cpp
index 308139a..050683c 100644
--- a/modules/demux/hls/playlist/Parser.cpp
+++ b/modules/demux/hls/playlist/Parser.cpp
@@ -235,10 +235,12 @@ void M3U8Parser::parseSegments(vlc_object_t *,
Representation *rep, const std::l

                 if(ctx_extinf)
                 {
-                    if(ctx_extinf->getAttributeByName("DURATION"))
+                    const Attribute *attribute =
ctx_extinf->getAttributeByName("DURATION");
+                    if(attribute)
                     {
-                        const mtime_t nzDuration = CLOCK_FREQ *
ctx_extinf->getAttributeByName("DURATION")->floatingPoint();
-
segment->duration.Set(ctx_extinf->getAttributeByName("DURATION")->floatingPoint()
* (uint64_t) rep->getTimescale());
+                        const double duration = attribute->floatingPoint();
+                        const mtime_t nzDuration = CLOCK_FREQ * duration;
+                        segment->duration.Set(duration * (uint64_t)
rep->getTimescale());

segment->startTime.Set(rep->getTimescale().ToScaled(nzStartTime));
                         nzStartTime += nzDuration;
                         totalduration += nzDuration;
-- 
2.7.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170802/cdac2318/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-demux-hls-code-cleaning.patch
Type: text/x-patch
Size: 1601 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170802/cdac2318/attachment.bin>


More information about the vlc-devel mailing list