Update Mpd parser duration calculation.

Set the duration to the sum of the final period's start
+ duration (if available) if MPD@mediaPresentationDuration
isn't set in the manifest.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117141391
This commit is contained in:
olly 2016-03-14 09:39:59 -07:00 committed by Oliver Woodman
parent 61adcf98d2
commit a6ba84ade6

View File

@ -149,12 +149,11 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
}
} while (!ParserUtil.isEndTag(xpp, "MPD"));
if (!dynamic && durationMs == -1) {
// The manifest is static and doesn't define a duration. This is unexpected.
if (durationMs == -1) {
if (nextPeriodStartMs != -1) {
// If we know the end time of the final period, we can use it as the duration.
durationMs = nextPeriodStartMs;
} else {
} else if (!dynamic) {
throw new ParserException("Unable to determine duration of static manifest.");
}
}