diff --git a/lib/dash/mpd_utils.js b/lib/dash/mpd_utils.js index 217b34533c..2b107b2929 100644 --- a/lib/dash/mpd_utils.js +++ b/lib/dash/mpd_utils.js @@ -612,7 +612,7 @@ shaka.dash.MpdUtils.processXlinks = return handled; } - // Filter out any children that should be nulled. + let childOperations = []; for (let i = 0; i < element.childNodes.length; i++) { let child = element.childNodes[i]; if (child instanceof Element) { @@ -622,21 +622,19 @@ shaka.dash.MpdUtils.processXlinks = // be removed, as specified by the mpeg-dash rules for xlink. element.removeChild(child); i -= 1; + } else if (child.tagName != 'SegmentTimeline') { + // Don't recurse into a SegmentTimeline since xlink attributes aren't + // valid in there and looking at each segment can take a long time with + // larger manifests. + + // Replace the child with its processed form. + childOperations.push(shaka.dash.MpdUtils.processXlinks( + /** @type {!Element} */ (child), retryParameters, failGracefully, + baseUri, networkingEngine, opt_linkDepth)); } } } - let childOperations = []; - for (let i = 0; i < element.childNodes.length; i++) { - let child = element.childNodes[i]; - if (child.nodeType == Node.ELEMENT_NODE) { - // Replace the child with its processed form. - childOperations.push(shaka.dash.MpdUtils.processXlinks( - /** @type {!Element} */ (child), retryParameters, failGracefully, - baseUri, networkingEngine, opt_linkDepth)); - } - } - return shaka.util.AbortableOperation.all(childOperations).chain(() => { return element; }); diff --git a/test/dash/mpd_utils_unit.js b/test/dash/mpd_utils_unit.js index bca1a66935..168aa1b9f6 100644 --- a/test/dash/mpd_utils_unit.js +++ b/test/dash/mpd_utils_unit.js @@ -688,6 +688,15 @@ describe('MpdUtils', function() { operation.finally(done); }); + it('ignores SegmentTimeline children', (done) => { + let baseXMLString = inBaseContainer( + '' + + ' ' + + ''); + testSucceeds(baseXMLString, baseXMLString, 0, done); + }); + function testSucceeds( baseXMLString, desiredXMLString, desiredNetCalls, done) { let desiredXML = parser.parseFromString(desiredXMLString, 'text/xml')