Commit b2849fde by Oliver Woodman

Merge pull request #7057 from Chimerapps:dash_assetidentifier

PiperOrigin-RevId: 300313753
parent dca68b21
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
* Text: Catch-and-log all fatal exceptions in `TextRenderer` instead of * Text: Catch-and-log all fatal exceptions in `TextRenderer` instead of
re-throwing, allowing playback to continue even if subtitles fail re-throwing, allowing playback to continue even if subtitles fail
([#6885](https://github.com/google/ExoPlayer/issues/6885)). ([#6885](https://github.com/google/ExoPlayer/issues/6885)).
* DASH: Update the manifest URI to avoid repeated HTTP redirects * DASH:
* Update the manifest URI to avoid repeated HTTP redirects
([#6907](https://github.com/google/ExoPlayer/issues/6907)). ([#6907](https://github.com/google/ExoPlayer/issues/6907)).
* Parse period `AssetIdentifier` elements.
* FFmpeg extension: Add support for x86_64. * FFmpeg extension: Add support for x86_64.
### 2.11.3 (2020-02-19) ### ### 2.11.3 (2020-02-19) ###
......
...@@ -222,10 +222,11 @@ public class DashManifestParser extends DefaultHandler ...@@ -222,10 +222,11 @@ public class DashManifestParser extends DefaultHandler
protected Pair<Period, Long> parsePeriod(XmlPullParser xpp, String baseUrl, long defaultStartMs) protected Pair<Period, Long> parsePeriod(XmlPullParser xpp, String baseUrl, long defaultStartMs)
throws XmlPullParserException, IOException { throws XmlPullParserException, IOException {
String id = xpp.getAttributeValue(null, "id"); @Nullable String id = xpp.getAttributeValue(null, "id");
long startMs = parseDuration(xpp, "start", defaultStartMs); long startMs = parseDuration(xpp, "start", defaultStartMs);
long durationMs = parseDuration(xpp, "duration", C.TIME_UNSET); long durationMs = parseDuration(xpp, "duration", C.TIME_UNSET);
SegmentBase segmentBase = null; @Nullable SegmentBase segmentBase = null;
@Nullable Descriptor assetIdentifier = null;
List<AdaptationSet> adaptationSets = new ArrayList<>(); List<AdaptationSet> adaptationSets = new ArrayList<>();
List<EventStream> eventStreams = new ArrayList<>(); List<EventStream> eventStreams = new ArrayList<>();
boolean seenFirstBaseUrl = false; boolean seenFirstBaseUrl = false;
...@@ -246,17 +247,24 @@ public class DashManifestParser extends DefaultHandler ...@@ -246,17 +247,24 @@ public class DashManifestParser extends DefaultHandler
segmentBase = parseSegmentList(xpp, null, durationMs); segmentBase = parseSegmentList(xpp, null, durationMs);
} else if (XmlPullParserUtil.isStartTag(xpp, "SegmentTemplate")) { } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentTemplate")) {
segmentBase = parseSegmentTemplate(xpp, null, Collections.emptyList(), durationMs); segmentBase = parseSegmentTemplate(xpp, null, Collections.emptyList(), durationMs);
} else if (XmlPullParserUtil.isStartTag(xpp, "AssetIdentifier")) {
assetIdentifier = parseDescriptor(xpp, "AssetIdentifier");
} else { } else {
maybeSkipTag(xpp); maybeSkipTag(xpp);
} }
} while (!XmlPullParserUtil.isEndTag(xpp, "Period")); } while (!XmlPullParserUtil.isEndTag(xpp, "Period"));
return Pair.create(buildPeriod(id, startMs, adaptationSets, eventStreams), durationMs); return Pair.create(
buildPeriod(id, startMs, adaptationSets, eventStreams, assetIdentifier), durationMs);
} }
protected Period buildPeriod(String id, long startMs, List<AdaptationSet> adaptationSets, protected Period buildPeriod(
List<EventStream> eventStreams) { @Nullable String id,
return new Period(id, startMs, adaptationSets, eventStreams); long startMs,
List<AdaptationSet> adaptationSets,
List<EventStream> eventStreams,
@Nullable Descriptor assetIdentifier) {
return new Period(id, startMs, adaptationSets, eventStreams, assetIdentifier);
} }
// AdaptationSet parsing. // AdaptationSet parsing.
......
...@@ -45,13 +45,16 @@ public class Period { ...@@ -45,13 +45,16 @@ public class Period {
*/ */
public final List<EventStream> eventStreams; public final List<EventStream> eventStreams;
/** The asset identifier for this period, if one exists */
@Nullable public final Descriptor assetIdentifier;
/** /**
* @param id The period identifier. May be null. * @param id The period identifier. May be null.
* @param startMs The start time of the period in milliseconds. * @param startMs The start time of the period in milliseconds.
* @param adaptationSets The adaptation sets belonging to the period. * @param adaptationSets The adaptation sets belonging to the period.
*/ */
public Period(@Nullable String id, long startMs, List<AdaptationSet> adaptationSets) { public Period(@Nullable String id, long startMs, List<AdaptationSet> adaptationSets) {
this(id, startMs, adaptationSets, Collections.emptyList()); this(id, startMs, adaptationSets, Collections.emptyList(), /* assetIdentifier= */ null);
} }
/** /**
...@@ -62,10 +65,27 @@ public class Period { ...@@ -62,10 +65,27 @@ public class Period {
*/ */
public Period(@Nullable String id, long startMs, List<AdaptationSet> adaptationSets, public Period(@Nullable String id, long startMs, List<AdaptationSet> adaptationSets,
List<EventStream> eventStreams) { List<EventStream> eventStreams) {
this(id, startMs, adaptationSets, eventStreams, /* assetIdentifier= */ null);
}
/**
* @param id The period identifier. May be null.
* @param startMs The start time of the period in milliseconds.
* @param adaptationSets The adaptation sets belonging to the period.
* @param eventStreams The {@link EventStream}s belonging to the period.
* @param assetIdentifier The asset identifier for this period
*/
public Period(
@Nullable String id,
long startMs,
List<AdaptationSet> adaptationSets,
List<EventStream> eventStreams,
@Nullable Descriptor assetIdentifier) {
this.id = id; this.id = id;
this.startMs = startMs; this.startMs = startMs;
this.adaptationSets = Collections.unmodifiableList(adaptationSets); this.adaptationSets = Collections.unmodifiableList(adaptationSets);
this.eventStreams = Collections.unmodifiableList(eventStreams); this.eventStreams = Collections.unmodifiableList(eventStreams);
this.assetIdentifier = assetIdentifier;
} }
/** /**
......
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