Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DashTree] Always ensure period duration #1586

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/parser/DASHTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,12 @@ bool adaptive::CDashTree::ParseManifest(const std::string& data)
// For multi-periods streaming must be ensured the duration of each period:
// - If "duration" attribute is provided on each Period tag, do nothing
// - If "duration" attribute is missing, but "start" attribute, use this last one to calculate the duration
// - If both attributes are missing, try get the duration from a representation
// - If both attributes are missing, try get the duration from a representation,
// e.g. a single period in a live stream the duration must be determined by the available segments

uint64_t totalDuration{0}; // Calculated duration, in ms
uint64_t mpdTotalDuration = m_mediaPresDuration; // MPD total duration, in ms
if (mpdTotalDuration == 0)
mpdTotalDuration = m_timeShiftBufferDepth;

if (!IsLive())
{
for (auto itPeriod = m_periods.begin(); itPeriod != m_periods.end();)
{
Expand Down Expand Up @@ -288,6 +286,9 @@ bool adaptive::CDashTree::ParseManifest(const std::string& data)
}
}

if (mpdTotalDuration == 0)
mpdTotalDuration = m_timeShiftBufferDepth;

if (mpdTotalDuration > 0)
m_totalTime = mpdTotalDuration;
else
Expand Down