Merge pull request #7057 from Chimerapps:dash_assetidentifier

PiperOrigin-RevId: 300313753
This commit is contained in:
Oliver Woodman 2020-03-11 16:27:36 +00:00
parent dca68b2198
commit b2849fde3d
3 changed files with 39 additions and 9 deletions

View file

@ -5,8 +5,10 @@
* Text: Catch-and-log all fatal exceptions in `TextRenderer` instead of
re-throwing, allowing playback to continue even if subtitles fail
([#6885](https://github.com/google/ExoPlayer/issues/6885)).
* DASH: Update the manifest URI to avoid repeated HTTP redirects
([#6907](https://github.com/google/ExoPlayer/issues/6907)).
* DASH:
* Update the manifest URI to avoid repeated HTTP redirects
([#6907](https://github.com/google/ExoPlayer/issues/6907)).
* Parse period `AssetIdentifier` elements.
* FFmpeg extension: Add support for x86_64.
### 2.11.3 (2020-02-19) ###

View file

@ -222,10 +222,11 @@ public class DashManifestParser extends DefaultHandler
protected Pair<Period, Long> parsePeriod(XmlPullParser xpp, String baseUrl, long defaultStartMs)
throws XmlPullParserException, IOException {
String id = xpp.getAttributeValue(null, "id");
@Nullable String id = xpp.getAttributeValue(null, "id");
long startMs = parseDuration(xpp, "start", defaultStartMs);
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<EventStream> eventStreams = new ArrayList<>();
boolean seenFirstBaseUrl = false;
@ -246,17 +247,24 @@ public class DashManifestParser extends DefaultHandler
segmentBase = parseSegmentList(xpp, null, durationMs);
} else if (XmlPullParserUtil.isStartTag(xpp, "SegmentTemplate")) {
segmentBase = parseSegmentTemplate(xpp, null, Collections.emptyList(), durationMs);
} else if (XmlPullParserUtil.isStartTag(xpp, "AssetIdentifier")) {
assetIdentifier = parseDescriptor(xpp, "AssetIdentifier");
} else {
maybeSkipTag(xpp);
}
} 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,
List<EventStream> eventStreams) {
return new Period(id, startMs, adaptationSets, eventStreams);
protected Period buildPeriod(
@Nullable String id,
long startMs,
List<AdaptationSet> adaptationSets,
List<EventStream> eventStreams,
@Nullable Descriptor assetIdentifier) {
return new Period(id, startMs, adaptationSets, eventStreams, assetIdentifier);
}
// AdaptationSet parsing.

View file

@ -45,13 +45,16 @@ public class Period {
*/
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 startMs The start time of the period in milliseconds.
* @param adaptationSets The adaptation sets belonging to the period.
*/
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 {
*/
public Period(@Nullable String id, long startMs, List<AdaptationSet> adaptationSets,
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.startMs = startMs;
this.adaptationSets = Collections.unmodifiableList(adaptationSets);
this.eventStreams = Collections.unmodifiableList(eventStreams);
this.assetIdentifier = assetIdentifier;
}
/**