Commit fae6c653 by Oliver Woodman

Be robust against manifests that don't define top level duration explicitly.

I think such manifests are invalid, and I haven't seen any examples,
but given it's trivial to fill in the duration if the periods define
durations, it seems worth being robust.
parent 2f4c9678
...@@ -144,6 +144,16 @@ public class MediaPresentationDescriptionParser extends DefaultHandler ...@@ -144,6 +144,16 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
} }
} while (!isEndTag(xpp, "MPD")); } while (!isEndTag(xpp, "MPD"));
if (!dynamic && durationMs == -1) {
// The manifest is static and doesn't define a duration. This is unexpected.
if (nextPeriodStartMs != -1) {
// If we know the end time of the final period, we can use it as the duration.
durationMs = nextPeriodStartMs;
} else {
throw new ParserException("Unable to determine duration of static manifest.");
}
}
return buildMediaPresentationDescription(availabilityStartTime, durationMs, minBufferTimeMs, return buildMediaPresentationDescription(availabilityStartTime, durationMs, minBufferTimeMs,
dynamic, minUpdateTimeMs, timeShiftBufferDepthMs, utcTiming, location, periods); dynamic, minUpdateTimeMs, timeShiftBufferDepthMs, utcTiming, location, periods);
} }
......
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 sign in to comment