Skip to content

Commit

Permalink
Fix relative location urls
Browse files Browse the repository at this point in the history
Fixes #1668

Change-Id: Ib9e1a19254f1829795bd69cc930d21f33e136980
  • Loading branch information
michellezhuogg authored and joeyparrish committed Jan 17, 2019
1 parent 4d872f6 commit 17f58d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/dash/dash_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,10 @@ shaka.dash.DashParser.prototype.processManifest_ =
.map(XmlUtils.getContents)
.filter(Functional.isNotNull);
if (locations.length > 0) {
this.manifestUris_ = locations;
manifestBaseUris = locations;
const absoluteLocations = shaka.util.ManifestParserUtils.resolveUris(
manifestBaseUris, locations);
this.manifestUris_ = absoluteLocations;
manifestBaseUris = absoluteLocations;
}

let uris = XmlUtils.findChildren(mpd, 'BaseURL').map(XmlUtils.getContents);
Expand Down
6 changes: 5 additions & 1 deletion test/dash/dash_parser_live_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ describe('DashParser Live', function() {
' minimumUpdatePeriod="PT' + updateTime + 'S">',
' <Location>http://foobar</Location>',
' <Location>http://foobar2</Location>',
' <Location>foobar3</Location>',
' <Period id="1" duration="PT10S">',
' <AdaptationSet mimeType="video/mp4">',
' <Representation id="3" bandwidth="500">',
Expand All @@ -626,9 +627,12 @@ describe('DashParser Live', function() {
fakeNetEngine.request.calls.reset();

// Create a mock so we can verify it gives two URIs.
// The third location is a relative url, and should be resolved as an
// absolute url.
fakeNetEngine.request.and.callFake(function(type, request) {
expect(type).toBe(manifestRequest);
expect(request.uris).toEqual(['http://foobar', 'http://foobar2']);
expect(request.uris).toEqual(
['http://foobar', 'http://foobar2', 'dummy://foo/foobar3']);
let data = shaka.util.StringUtils.toUTF8(manifestText);
return shaka.util.AbortableOperation.completed(
{uri: request.uris[0], data: data, headers: {}});
Expand Down

0 comments on commit 17f58d9

Please sign in to comment.