From 925756846b9edb34d7389cda224a28c2e90bdd00 Mon Sep 17 00:00:00 2001 From: Alvaro Velad Date: Wed, 4 Dec 2019 12:01:22 +0100 Subject: [PATCH 1/4] Filter image adaptation sets --- lib/dash/dash_parser.js | 6 ++++++ lib/util/manifest_parser_utils.js | 1 + 2 files changed, 7 insertions(+) diff --git a/lib/dash/dash_parser.js b/lib/dash/dash_parser.js index 5cd6c05d21..fbd4ea66dc 100644 --- a/lib/dash/dash_parser.js +++ b/lib/dash/dash_parser.js @@ -766,6 +766,12 @@ shaka.dash.DashParser = class { context.adaptationSet = this.createFrame_(elem, context.period, null); + const isImage = context.adaptationSet.contentType == ContentType.IMAGE; + if (isImage) { + shaka.log.warning('Skipping Image AdaptationSet', context.adaptationSet); + return null; + } + let main = false; const roleElements = XmlUtils.findChildren(elem, 'Role'); const roleValues = roleElements.map((role) => { diff --git a/lib/util/manifest_parser_utils.js b/lib/util/manifest_parser_utils.js index 62464f86b0..d79323f514 100644 --- a/lib/util/manifest_parser_utils.js +++ b/lib/util/manifest_parser_utils.js @@ -67,6 +67,7 @@ shaka.util.ManifestParserUtils.ContentType = { VIDEO: 'video', AUDIO: 'audio', TEXT: 'text', + IMAGE: 'image', APPLICATION: 'application', }; From 862a58206844b88f0d1b68bc0f837b13a1ba0108 Mon Sep 17 00:00:00 2001 From: Alvaro Velad Date: Fri, 6 Dec 2019 08:47:39 +0100 Subject: [PATCH 2/4] Add comment about the change --- lib/dash/dash_parser.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/dash/dash_parser.js b/lib/dash/dash_parser.js index fbd4ea66dc..c7dfa0c0fe 100644 --- a/lib/dash/dash_parser.js +++ b/lib/dash/dash_parser.js @@ -766,6 +766,8 @@ shaka.dash.DashParser = class { context.adaptationSet = this.createFrame_(elem, context.period, null); + // Filter image adaptation sets, until we add thumbnail track support. + // See: https://github.com/google/shaka-player/issues/559 const isImage = context.adaptationSet.contentType == ContentType.IMAGE; if (isImage) { shaka.log.warning('Skipping Image AdaptationSet', context.adaptationSet); From aadee88d9049227186ad3c3189151eef1df9e4c2 Mon Sep 17 00:00:00 2001 From: Alvaro Velad Date: Fri, 6 Dec 2019 08:56:39 +0100 Subject: [PATCH 3/4] Add test --- test/dash/dash_parser_manifest_unit.js | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/dash/dash_parser_manifest_unit.js b/test/dash/dash_parser_manifest_unit.js index 7e7112302a..edd24fcff5 100644 --- a/test/dash/dash_parser_manifest_unit.js +++ b/test/dash/dash_parser_manifest_unit.js @@ -1370,4 +1370,36 @@ describe('DashParser Manifest', () => { expect(textStream.roles).toEqual(['captions', 'foo']); expect(textStream.kind).toBe('caption'); }); + + // Filter image adaptation sets, until we add thumbnail track support. + // See: https://github.com/google/shaka-player/issues/559 + it('Filter image adaptation sets', async () => { + const manifestText = [ + '', + ' ', + ' ', + ' ', + ' v-sd.mp4', + ' ', + ' ', + ' ', + ' ', + ' ', + ' a-en.mp4', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + '', + ].join('\n'); + + fakeNetEngine.setResponseText('dummy://foo', manifestText); + + const manifest = await parser.start('dummy://foo', playerInterface); + const variant = manifest.periods[0].variants[0]; + expect(variant.audio).toBeTruthy(); + expect(variant.video).toBeTruthy(); + }); }); From 6daa4c177a9b5b31f8017de4d58d5d25f6474a12 Mon Sep 17 00:00:00 2001 From: Alvaro Velad Date: Fri, 6 Dec 2019 21:12:02 +0100 Subject: [PATCH 4/4] Change Test name --- test/dash/dash_parser_manifest_unit.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/dash/dash_parser_manifest_unit.js b/test/dash/dash_parser_manifest_unit.js index edd24fcff5..afb2e0c75e 100644 --- a/test/dash/dash_parser_manifest_unit.js +++ b/test/dash/dash_parser_manifest_unit.js @@ -1371,9 +1371,7 @@ describe('DashParser Manifest', () => { expect(textStream.kind).toBe('caption'); }); - // Filter image adaptation sets, until we add thumbnail track support. - // See: https://github.com/google/shaka-player/issues/559 - it('Filter image adaptation sets', async () => { + it('Does not error when image adaptation sets are present', async () => { const manifestText = [ '', ' ',