mirror of
https://github.com/androidx/media.git
synced 2025-05-04 06:00:37 +08:00
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.
This commit is contained in:
parent
2f4c96781d
commit
fae6c65367
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user