Commit 77c4f92c authored by François Cartegnie's avatar François Cartegnie 🤞
Browse files

demux: adaptative: change durations from time to microtime

parent 38664b80
......@@ -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)
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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())
......
......@@ -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());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment