[vlc-commits] demux: hls: code cleaning

Zhao Zhili git at videolan.org
Fri Aug 4 10:09:05 CEST 2017


vlc | branch: master | Zhao Zhili <wantlamy at gmail.com> | Wed Aug  2 20:59:09 2017 +0800| [41f982e2e5ddcea0a1ac708dcbc811c3809b6c8d] | committer: Jean-Baptiste Kempf

demux: hls: code cleaning

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=41f982e2e5ddcea0a1ac708dcbc811c3809b6c8d
---

 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 308139a1df..050683c7aa 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;



More information about the vlc-commits mailing list