Support xlinks in DASH manifests
- Dominant language
- Java
- Stars
- 21.9k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
I was experiencing errors while trying to play the examples in http://dash.edgesuite.net/dash264/TestCases/5c/nomor/. After some debugging I realized that most of the MPD files in that location use [xlinks](https://www.w3.org/TR/xlink/) to load parts of the content. However, the XML parser was not fetching these links. Therefore some periods were missing, and as a result the parsing was missing information.
Setting `xmlParserFactory.setNamespaceAware(true);` in the constructor of `MediaPresentationDescriptionParser` fixes this, i.e. the `xlink`s are fetched and the whole MPD is parsed properly.
However, this also leads to a failure in `MediaPresentationDescriptionParserTest`. This test parses an MPD file which has a `yt:earliestMediaSequence` attribute with no namespace declaration. I guess the correct namespace would be `xmlns:yt="http://www.youtube.com/xml/schemas/2015"` (the test passes with this), but I cannot be sure.
I'm using the latest from master (632a270).
To reproduce this problem, you can modify the `Samples` class of the ExoPlayer demo app to load one of the problematic files:
```
public static final Sample[] NEW_DASH = new Sample[] {
new Sample("Big Buck Bunny - With xlinks", "http://dash.edgesuite.net/dash264/TestCases/5c/nomor/4_1a.mpd", Util.TYPE_DASH),
new Sample("Big Buck Bunny - No xlinks", "http://dash.edgesuite.net/dash264/TestCases/5c/nomor/4_1f.mpd", Util.TYPE_DASH)
};
```
This is the error I got when playing the first video (with `xlink` attributes):
```
06-06 13:10:02.600 32404-32404/com.google.android.exoplayer.demo E/EventLogger: internalError [0.11, rendererInitError]
com.google.android.exoplayer.ParserException: Unable to determine start of period 2
at com.google.android.exoplayer.dash.mpd.MediaPresentationDescriptionParser.parseMediaPresentationDescription(MediaPresentationDescriptionParser.java:146)
at com.google.android.exoplayer.dash.mpd.MediaPresentationDescriptionParser.parse(MediaPresentationDescriptionParser.java:102)
at com.google.android.exoplayer.dash.mpd.MediaPresentationDescriptionParser.parse(MediaPresentationDescriptionParser.java:57)
at com.google.android.exoplayer.upstream.UriLoadable.load(UriLoadable.java:93)
at com.google.android.exoplayer.upstream.Loader$LoadTask.run(Loader.java:209)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:864)
```
That file has three `Period` elements. The second one is empty with a `xlinks` attribute. The third one (period 2) is the one that makes the parsing fail, due to the missing values in the previous period.
This error should be independent of the device. I've tried with a Nexus 5X with Android 6.0.1, and a HTC One with Android 4.2.2.
Contributor guide
Assessment
This issue has not been assessed yet.