From 4c4e943781a391805159bd1bd69794b75abaa544 Mon Sep 17 00:00:00 2001 From: jforbes Date: Wed, 10 Oct 2018 15:32:25 -0400 Subject: [PATCH 1/2] fix: fixed segment timeline parsing when duration is present --- src/inheritAttributes.js | 7 ++++++- test/inheritAttributes.test.js | 15 +++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/inheritAttributes.js b/src/inheritAttributes.js index 863bef36..c1c1eaa6 100644 --- a/src/inheritAttributes.js +++ b/src/inheritAttributes.js @@ -272,7 +272,12 @@ export const toRepresentations = export const toAdaptationSets = (mpdAttributes, mpdBaseUrls) => (period, periodIndex) => { const periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period, 'BaseURL')); const periodAtt = parseAttributes(period); - const periodAttributes = merge(mpdAttributes, periodAtt, { periodIndex }); + const periodAttributes = merge(mpdAttributes, { periodIndex }); + + if (periodAtt.duration) { + periodAttributes.periodDuration = periodAtt.duration; + } + const adaptationSets = findChildren(period, 'AdaptationSet'); const periodSegmentInfo = getSegmentInformation(period); diff --git a/test/inheritAttributes.test.js b/test/inheritAttributes.test.js index f01e08c0..6bfa17c6 100644 --- a/test/inheritAttributes.test.js +++ b/test/inheritAttributes.test.js @@ -612,7 +612,7 @@ QUnit.test(' End to End test for checking support of segments in period ', attributes: { bandwidth: 5000000, baseUrl: 'https://www.example.com/base/', - duration: 280.414, + periodDuration: 280.414, codecs: 'avc1.64001e', height: 404, id: 'test', @@ -640,7 +640,7 @@ QUnit.test(' End to End test for checking support of segments in period ', attributes: { baseUrl: 'https://www.example.com/base/', mediaPresentationDuration: 30, - duration: 280.414, + periodDuration: 280.414, mimeType: 'video/mp4', periodIndex: 0, height: 545, @@ -664,7 +664,7 @@ QUnit.test(' End to End test for checking support of segments in period ', attributes: { bandwidth: 256, baseUrl: 'https://example.com/en.vtt', - duration: 280.414, + periodDuration: 280.414, id: 'en', lang: 'en', mediaPresentationDuration: 30, @@ -729,7 +729,7 @@ QUnit.test(' End to End test for checking support of Segments in Adaptation set' attributes: { bandwidth: 5000000, baseUrl: 'https://www.example.com/base/', - duration: 280.414, + periodDuration: 280.414, codecs: 'avc1.64001e', height: 404, id: 'test', @@ -758,7 +758,7 @@ QUnit.test(' End to End test for checking support of Segments in Adaptation set' attributes: { baseUrl: 'https://www.example.com/base/', mediaPresentationDuration: 30, - duration: 280.414, + periodDuration: 280.414, mimeType: 'video/mp4', periodIndex: 0, height: 545, @@ -782,7 +782,7 @@ QUnit.test(' End to End test for checking support of Segments in Adaptation set' attributes: { bandwidth: 256, baseUrl: 'https://example.com/en.vtt', - duration: 280.414, + periodDuration: 280.414, id: 'en', lang: 'en', mediaPresentationDuration: 30, @@ -859,6 +859,7 @@ QUnit.test( bandwidth: 5000000, baseUrl: 'https://www.example.com/base', duration: 1.984, + periodDuration: 280.414, codecs: 'avc1.64001e', height: 404, id: '125000', @@ -1047,6 +1048,7 @@ QUnit.test( NOW, baseUrl: 'https://www.example.com/base', duration: 1.984, + periodDuration: 280.414, lang: 'es', height: 545, id: '125000', @@ -1294,6 +1296,7 @@ QUnit.test('Test to check use of either Segment Template or Segment List when bo bandwidth: 5000000, baseUrl: 'https://www.example.com/base', duration: 1.984, + periodDuration: 280.414, codecs: 'avc1.64001e', height: 404, id: '125000', From 5c01dddd281f10577f80bc73e71b2fcf9c8e62a7 Mon Sep 17 00:00:00 2001 From: jforbes Date: Thu, 11 Oct 2018 13:26:57 -0400 Subject: [PATCH 2/2] remove unused Period properties --- src/inheritAttributes.js | 6 ------ test/inheritAttributes.test.js | 9 --------- 2 files changed, 15 deletions(-) diff --git a/src/inheritAttributes.js b/src/inheritAttributes.js index c1c1eaa6..b337816d 100644 --- a/src/inheritAttributes.js +++ b/src/inheritAttributes.js @@ -271,13 +271,7 @@ export const toRepresentations = */ export const toAdaptationSets = (mpdAttributes, mpdBaseUrls) => (period, periodIndex) => { const periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period, 'BaseURL')); - const periodAtt = parseAttributes(period); const periodAttributes = merge(mpdAttributes, { periodIndex }); - - if (periodAtt.duration) { - periodAttributes.periodDuration = periodAtt.duration; - } - const adaptationSets = findChildren(period, 'AdaptationSet'); const periodSegmentInfo = getSegmentInformation(period); diff --git a/test/inheritAttributes.test.js b/test/inheritAttributes.test.js index 6bfa17c6..07740b7f 100644 --- a/test/inheritAttributes.test.js +++ b/test/inheritAttributes.test.js @@ -612,7 +612,6 @@ QUnit.test(' End to End test for checking support of segments in period ', attributes: { bandwidth: 5000000, baseUrl: 'https://www.example.com/base/', - periodDuration: 280.414, codecs: 'avc1.64001e', height: 404, id: 'test', @@ -640,7 +639,6 @@ QUnit.test(' End to End test for checking support of segments in period ', attributes: { baseUrl: 'https://www.example.com/base/', mediaPresentationDuration: 30, - periodDuration: 280.414, mimeType: 'video/mp4', periodIndex: 0, height: 545, @@ -664,7 +662,6 @@ QUnit.test(' End to End test for checking support of segments in period ', attributes: { bandwidth: 256, baseUrl: 'https://example.com/en.vtt', - periodDuration: 280.414, id: 'en', lang: 'en', mediaPresentationDuration: 30, @@ -729,7 +726,6 @@ QUnit.test(' End to End test for checking support of Segments in Adaptation set' attributes: { bandwidth: 5000000, baseUrl: 'https://www.example.com/base/', - periodDuration: 280.414, codecs: 'avc1.64001e', height: 404, id: 'test', @@ -758,7 +754,6 @@ QUnit.test(' End to End test for checking support of Segments in Adaptation set' attributes: { baseUrl: 'https://www.example.com/base/', mediaPresentationDuration: 30, - periodDuration: 280.414, mimeType: 'video/mp4', periodIndex: 0, height: 545, @@ -782,7 +777,6 @@ QUnit.test(' End to End test for checking support of Segments in Adaptation set' attributes: { bandwidth: 256, baseUrl: 'https://example.com/en.vtt', - periodDuration: 280.414, id: 'en', lang: 'en', mediaPresentationDuration: 30, @@ -859,7 +853,6 @@ QUnit.test( bandwidth: 5000000, baseUrl: 'https://www.example.com/base', duration: 1.984, - periodDuration: 280.414, codecs: 'avc1.64001e', height: 404, id: '125000', @@ -1048,7 +1041,6 @@ QUnit.test( NOW, baseUrl: 'https://www.example.com/base', duration: 1.984, - periodDuration: 280.414, lang: 'es', height: 545, id: '125000', @@ -1296,7 +1288,6 @@ QUnit.test('Test to check use of either Segment Template or Segment List when bo bandwidth: 5000000, baseUrl: 'https://www.example.com/base', duration: 1.984, - periodDuration: 280.414, codecs: 'avc1.64001e', height: 404, id: '125000',