[vlc-commits] demux: adaptative: change durations from time to microtime

Francois Cartegnie git at videolan.org
Wed Jun 10 18:58:06 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jun  8 22:21:11 2015 +0200| [77c4f92c2197e1aa3cfb59db021e5f14f318e863] | committer: Francois Cartegnie

demux: adaptative: change durations from time to microtime

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

 modules/demux/adaptative/PlaylistManager.cpp           |    2 +-
 modules/demux/adaptative/playlist/AbstractPlaylist.hpp |    4 ++--
 modules/demux/dash/DASHManager.cpp                     |   10 +++++-----
 modules/demux/dash/mpd/IsoffMainParser.cpp             |    4 ++--
 modules/demux/dash/mpd/MPD.cpp                         |    2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/modules/demux/adaptative/PlaylistManager.cpp b/modules/demux/adaptative/PlaylistManager.cpp
index 1828435..bc570ad 100644
--- a/modules/demux/adaptative/PlaylistManager.cpp
+++ b/modules/demux/adaptative/PlaylistManager.cpp
@@ -184,7 +184,7 @@ mtime_t PlaylistManager::getDuration() const
     if (playlist->isLive())
         return 0;
     else
-        return CLOCK_FREQ * playlist->duration.Get();
+        return playlist->duration.Get();
 }
 
 bool PlaylistManager::setPosition(mtime_t time)
diff --git a/modules/demux/adaptative/playlist/AbstractPlaylist.hpp b/modules/demux/adaptative/playlist/AbstractPlaylist.hpp
index 30ec6cd..5191f07 100644
--- a/modules/demux/adaptative/playlist/AbstractPlaylist.hpp
+++ b/modules/demux/adaptative/playlist/AbstractPlaylist.hpp
@@ -58,12 +58,12 @@ namespace adaptative
                 void                getTimeLinesBoundaries(mtime_t *, mtime_t *) const;
                 void                getPlaylistDurationsRange(mtime_t *, mtime_t *) const;
 
-                Property<time_t>                    duration;
+                Property<mtime_t>                   duration;
                 Property<time_t>                    playbackStart;
                 Property<time_t>                    availabilityEndTime;
                 Property<time_t>                    availabilityStartTime;
                 Property<time_t>                    minUpdatePeriod;
-                Property<time_t>                    maxSegmentDuration;
+                Property<mtime_t>                   maxSegmentDuration;
                 Property<time_t>                    minBufferTime;
                 Property<time_t>                    timeShiftBufferDepth;
 
diff --git a/modules/demux/dash/DASHManager.cpp b/modules/demux/dash/DASHManager.cpp
index d85b775..94d7bcc 100644
--- a/modules/demux/dash/DASHManager.cpp
+++ b/modules/demux/dash/DASHManager.cpp
@@ -117,15 +117,15 @@ bool DASHManager::updatePlaylist()
     mtime_t maxinterval = 0;
     playlist->getTimeLinesBoundaries(&mininterval, &maxinterval);
     if(maxinterval > mininterval)
-        maxinterval = (maxinterval - mininterval) / CLOCK_FREQ;
+        maxinterval = (maxinterval - mininterval);
     else
-        maxinterval = 60;
-    maxinterval = std::max(maxinterval, (mtime_t)60);
+        maxinterval = 60 * CLOCK_FREQ;
+    maxinterval = std::max(maxinterval, (mtime_t)60 * CLOCK_FREQ);
 
-    mininterval = std::max(playlist->minUpdatePeriod.Get(),
+    mininterval = std::max(playlist->minUpdatePeriod.Get() * CLOCK_FREQ,
                            playlist->maxSegmentDuration.Get());
 
-    nextPlaylistupdate = now + (maxinterval - mininterval) / 2;
+    nextPlaylistupdate = now + (maxinterval - mininterval) / (2 * CLOCK_FREQ);
 
     msg_Dbg(stream, "Updated MPD, next update in %" PRId64 "s (%" PRId64 "..%" PRId64 ")",
             nextPlaylistupdate - now, mininterval, maxinterval );
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index ab604f3..6ec3220 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -93,7 +93,7 @@ void    IsoffMainParser::setMPDAttributes   ()
 
     it = attr.find("mediaPresentationDuration");
     if(it != attr.end())
-        this->mpd->duration.Set(IsoTime(it->second));
+        this->mpd->duration.Set(IsoTime(it->second) * CLOCK_FREQ);
 
     it = attr.find("minBufferTime");
     if(it != attr.end())
@@ -109,7 +109,7 @@ void    IsoffMainParser::setMPDAttributes   ()
 
     it = attr.find("maxSegmentDuration");
     if(it != attr.end())
-        mpd->maxSegmentDuration.Set(IsoTime(it->second));
+        mpd->maxSegmentDuration.Set(IsoTime(it->second) * CLOCK_FREQ);
 
     it = attr.find("type");
     if(it != attr.end())
diff --git a/modules/demux/dash/mpd/MPD.cpp b/modules/demux/dash/mpd/MPD.cpp
index be2f8b0..5346bc9 100644
--- a/modules/demux/dash/mpd/MPD.cpp
+++ b/modules/demux/dash/mpd/MPD.cpp
@@ -66,7 +66,7 @@ void MPD::debug()
 {
     msg_Dbg(stream, "MPD profile=%s mediaPresentationDuration=%ld minBufferTime=%ld",
             static_cast<std::string>(getProfile()).c_str(),
-            duration.Get(),
+            duration.Get() / CLOCK_FREQ,
             minBufferTime.Get());
     msg_Dbg(stream, "BaseUrl=%s", getUrlSegment().toString().c_str());
 



More information about the vlc-commits mailing list