From a6ba84ade66879e3d020c7891c03e057335f034e Mon Sep 17 00:00:00 2001 From: olly Date: Mon, 14 Mar 2016 09:39:59 -0700 Subject: [PATCH] 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 --- .../dash/mpd/MediaPresentationDescriptionParser.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescriptionParser.java b/library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescriptionParser.java index db772df855..3c26842d09 100644 --- a/library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescriptionParser.java +++ b/library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescriptionParser.java @@ -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."); } }