Commit a6ba84ad by olly Committed by Oliver Woodman

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