[vlc-commits] demux:adaptive: store the IsoTime directly to vlc_tick_t
Steve Lhomme
git at videolan.org
Thu May 28 12:38:15 CEST 2020
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jun 11 14:36:07 2018 +0200| [52945dfcc1fa1edf407491aecb22b0157a8a963f] | committer: Francois Cartegnie
demux:adaptive: store the IsoTime directly to vlc_tick_t
They are never used as seconds
(cherry picked from commit f18894b58967ee61b86254bd5acd8f8897b68c67)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=52945dfcc1fa1edf407491aecb22b0157a8a963f
---
modules/demux/adaptive/tools/Conversions.cpp | 4 ++--
modules/demux/adaptive/tools/Conversions.hpp | 4 ++--
modules/demux/dash/mpd/IsoffMainParser.cpp | 16 ++++++++--------
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/modules/demux/adaptive/tools/Conversions.cpp b/modules/demux/adaptive/tools/Conversions.cpp
index 7a93c60ad2..22130702f9 100644
--- a/modules/demux/adaptive/tools/Conversions.cpp
+++ b/modules/demux/adaptive/tools/Conversions.cpp
@@ -88,10 +88,10 @@ static time_t str_duration( const char *psz_duration )
IsoTime::IsoTime(const std::string &str)
{
- time = str_duration(str.c_str());
+ time = str_duration(str.c_str()) * CLOCK_FREQ;
}
-IsoTime::operator time_t () const
+IsoTime::operator mtime_t () const
{
return time;
}
diff --git a/modules/demux/adaptive/tools/Conversions.hpp b/modules/demux/adaptive/tools/Conversions.hpp
index c899cb16f5..cb9e1ac82e 100644
--- a/modules/demux/adaptive/tools/Conversions.hpp
+++ b/modules/demux/adaptive/tools/Conversions.hpp
@@ -28,10 +28,10 @@ class IsoTime
{
public:
IsoTime(const std::string&);
- operator time_t() const;
+ operator mtime_t() const;
private:
- time_t time;
+ mtime_t time;
};
class UTCTime
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index 67caaf621e..cd2b4f4975 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -113,23 +113,23 @@ void IsoffMainParser::parseMPDAttributes (MPD *mpd, xml::Node *node)
it = attr.find("mediaPresentationDuration");
if(it != attr.end())
- mpd->duration.Set(IsoTime(it->second) * CLOCK_FREQ);
+ mpd->duration.Set(IsoTime(it->second));
it = attr.find("minBufferTime");
if(it != attr.end())
- mpd->setMinBuffering(IsoTime(it->second) * CLOCK_FREQ);
+ mpd->setMinBuffering(IsoTime(it->second));
it = attr.find("minimumUpdatePeriod");
if(it != attr.end())
{
- mtime_t minupdate = IsoTime(it->second) * CLOCK_FREQ;
+ mtime_t minupdate = IsoTime(it->second);
if(minupdate > 0)
mpd->minUpdatePeriod.Set(minupdate);
}
it = attr.find("maxSegmentDuration");
if(it != attr.end())
- mpd->maxSegmentDuration.Set(IsoTime(it->second) * CLOCK_FREQ);
+ mpd->maxSegmentDuration.Set(IsoTime(it->second));
it = attr.find("type");
if(it != attr.end())
@@ -145,11 +145,11 @@ void IsoffMainParser::parseMPDAttributes (MPD *mpd, xml::Node *node)
it = attr.find("timeShiftBufferDepth");
if(it != attr.end())
- mpd->timeShiftBufferDepth.Set(IsoTime(it->second) * CLOCK_FREQ);
+ mpd->timeShiftBufferDepth.Set(IsoTime(it->second));
it = attr.find("suggestedPresentationDelay");
if(it != attr.end())
- mpd->suggestedPresentationDelay.Set(IsoTime(it->second) * CLOCK_FREQ);
+ mpd->suggestedPresentationDelay.Set(IsoTime(it->second));
}
void IsoffMainParser::parsePeriods(MPD *mpd, Node *root)
@@ -165,9 +165,9 @@ void IsoffMainParser::parsePeriods(MPD *mpd, Node *root)
continue;
parseSegmentInformation(mpd, *it, period, &nextid);
if((*it)->hasAttribute("start"))
- period->startTime.Set(IsoTime((*it)->getAttributeValue("start")) * CLOCK_FREQ);
+ period->startTime.Set(IsoTime((*it)->getAttributeValue("start")));
if((*it)->hasAttribute("duration"))
- period->duration.Set(IsoTime((*it)->getAttributeValue("duration")) * CLOCK_FREQ);
+ period->duration.Set(IsoTime((*it)->getAttributeValue("duration")));
std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(*it, "BaseURL");
if(!baseUrls.empty())
{
More information about the vlc-commits
mailing list