mirror of
https://github.com/samsonjs/media.git
synced 2026-03-28 09:55:48 +00:00
Fetch next Dash manifest using URL in Location directive if exists
This commit is contained in:
parent
8cf7d372e9
commit
c0ecc22359
3 changed files with 15 additions and 5 deletions
|
|
@ -298,6 +298,10 @@ public class DashChunkSource implements ChunkSource {
|
|||
|
||||
if (finishedCurrentManifest && (android.os.SystemClock.elapsedRealtime()
|
||||
> manifestFetcher.getManifestLoadTimestamp() + minUpdatePeriod)) {
|
||||
String newManifestURL = currentManifest.location;
|
||||
if (newManifestURL != null) {
|
||||
manifestFetcher.updateManifestUrl(newManifestURL);
|
||||
}
|
||||
manifestFetcher.requestRefresh();
|
||||
}
|
||||
}
|
||||
|
|
@ -589,7 +593,7 @@ public class DashChunkSource implements ChunkSource {
|
|||
firstRepresentation.periodDurationMs, Collections.singletonList(adaptationSet));
|
||||
long duration = firstRepresentation.periodDurationMs - firstRepresentation.periodStartMs;
|
||||
return new MediaPresentationDescription(-1, duration, -1, false, -1, -1, null,
|
||||
Collections.singletonList(period));
|
||||
Collections.singletonList(period), null);
|
||||
}
|
||||
|
||||
private static class RepresentationHolder {
|
||||
|
|
|
|||
|
|
@ -39,9 +39,11 @@ public class MediaPresentationDescription {
|
|||
|
||||
public final UtcTimingElement utcTiming;
|
||||
|
||||
public final String location;
|
||||
|
||||
public MediaPresentationDescription(long availabilityStartTime, long duration, long minBufferTime,
|
||||
boolean dynamic, long minUpdatePeriod, long timeShiftBufferDepth, UtcTimingElement utcTiming,
|
||||
List<Period> periods) {
|
||||
List<Period> periods, String location) {
|
||||
this.availabilityStartTime = availabilityStartTime;
|
||||
this.duration = duration;
|
||||
this.minBufferTime = minBufferTime;
|
||||
|
|
@ -50,6 +52,7 @@ public class MediaPresentationDescription {
|
|||
this.timeShiftBufferDepth = timeShiftBufferDepth;
|
||||
this.utcTiming = utcTiming;
|
||||
this.periods = Collections.unmodifiableList(periods);
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
|
|||
long timeShiftBufferDepthMs = (dynamic) ? parseDuration(xpp, "timeShiftBufferDepth", -1)
|
||||
: -1;
|
||||
UtcTimingElement utcTiming = null;
|
||||
String location = null;
|
||||
|
||||
List<Period> periods = new ArrayList<>();
|
||||
do {
|
||||
|
|
@ -121,19 +122,21 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
|
|||
utcTiming = parseUtcTiming(xpp);
|
||||
} else if (isStartTag(xpp, "Period")) {
|
||||
periods.add(parsePeriod(xpp, baseUrl, durationMs));
|
||||
} else if (isStartTag(xpp, "Location")) {
|
||||
location = xpp.nextText();
|
||||
}
|
||||
} while (!isEndTag(xpp, "MPD"));
|
||||
|
||||
return buildMediaPresentationDescription(availabilityStartTime, durationMs, minBufferTimeMs,
|
||||
dynamic, minUpdateTimeMs, timeShiftBufferDepthMs, utcTiming, periods);
|
||||
dynamic, minUpdateTimeMs, timeShiftBufferDepthMs, utcTiming, periods, location);
|
||||
}
|
||||
|
||||
protected MediaPresentationDescription buildMediaPresentationDescription(
|
||||
long availabilityStartTime, long durationMs, long minBufferTimeMs, boolean dynamic,
|
||||
long minUpdateTimeMs, long timeShiftBufferDepthMs, UtcTimingElement utcTiming,
|
||||
List<Period> periods) {
|
||||
List<Period> periods, String location) {
|
||||
return new MediaPresentationDescription(availabilityStartTime, durationMs, minBufferTimeMs,
|
||||
dynamic, minUpdateTimeMs, timeShiftBufferDepthMs, utcTiming, periods);
|
||||
dynamic, minUpdateTimeMs, timeShiftBufferDepthMs, utcTiming, periods, location);
|
||||
}
|
||||
|
||||
protected UtcTimingElement parseUtcTiming(XmlPullParser xpp) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue