[vlc-commits] demux: adaptive: fix rounding in period/playlist duration
Francois Cartegnie
git at videolan.org
Thu May 28 12:38:17 CEST 2020
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon May 25 14:59:41 2020 +0200| [11b40bb80019c83e9121f80dba5f2ab1a344c69e] | committer: Francois Cartegnie
demux: adaptive: fix rounding in period/playlist duration
(cherry picked from commit 19fc4c591f31d0370822892dbff08709c02ae20a)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=11b40bb80019c83e9121f80dba5f2ab1a344c69e
---
modules/demux/adaptive/tools/Conversions.cpp | 8 ++++----
modules/demux/dash/mpd/MPD.cpp | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/demux/adaptive/tools/Conversions.cpp b/modules/demux/adaptive/tools/Conversions.cpp
index 22130702f9..c5b21e60a9 100644
--- a/modules/demux/adaptive/tools/Conversions.cpp
+++ b/modules/demux/adaptive/tools/Conversions.cpp
@@ -35,10 +35,10 @@
Exemple input string: "PT0H9M56.46S"
*/
-static time_t str_duration( const char *psz_duration )
+static mtime_t str_duration( const char *psz_duration )
{
bool timeDesignatorReached = false;
- time_t res = 0;
+ mtime_t res = 0;
char* end_ptr;
if ( psz_duration == NULL )
@@ -79,7 +79,7 @@ static time_t str_duration( const char *psz_duration )
default:
break ;
}
- res += (time_t)(mul * number);
+ res += mul * number * CLOCK_FREQ;
if ( *psz_duration )
psz_duration++;
} while ( *psz_duration );
@@ -88,7 +88,7 @@ static time_t str_duration( const char *psz_duration )
IsoTime::IsoTime(const std::string &str)
{
- time = str_duration(str.c_str()) * CLOCK_FREQ;
+ time = str_duration(str.c_str());
}
IsoTime::operator mtime_t () const
diff --git a/modules/demux/dash/mpd/MPD.cpp b/modules/demux/dash/mpd/MPD.cpp
index 7ec3254dbf..541ed49ae4 100644
--- a/modules/demux/dash/mpd/MPD.cpp
+++ b/modules/demux/dash/mpd/MPD.cpp
@@ -82,7 +82,7 @@ void MPD::debug()
" minBufferTime=%" PRId64,
static_cast<std::string>(getProfile()).c_str(),
duration.Get() / CLOCK_FREQ,
- minBufferTime);
+ minBufferTime / CLOCK_FREQ);
msg_Dbg(p_object, "BaseUrl=%s", getUrlSegment().toString().c_str());
std::vector<BasePeriod *>::const_iterator i;
More information about the vlc-commits
mailing list