Skip to content

Commit

Permalink
test: Add Dolby Vision integration tests (#6906)
Browse files Browse the repository at this point in the history
Add test coverage for:
- DASH: scte214:supplementalCodecs
- HLS: SUPPLEMENTAL-CODECS
- HLS detection of DV in media playlists

Note: We use AV1 and HEVC to cover all browsers.
  • Loading branch information
avelad authored Jun 26, 2024
1 parent db679e0 commit 6d0fd92
Show file tree
Hide file tree
Showing 10 changed files with 209 additions and 0 deletions.
2 changes: 2 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ module.exports = (config) => {
{pattern: 'test/test/assets/dash-aes-128/*', included: false},
{pattern: 'test/test/assets/dash-clearkey/*', included: false},
{pattern: 'test/test/assets/dash-vr/*', included: false},
{pattern: 'test/test/assets/dv-p8-hevc/*', included: false},
{pattern: 'test/test/assets/dv-p10-av1/*', included: false},
{pattern: 'test/test/assets/hls-aes-256/*', included: false},
{pattern: 'test/test/assets/hls-interstitial/*', included: false},
{pattern: 'test/test/assets/hls-raw-aac/*', included: false},
Expand Down
135 changes: 135 additions & 0 deletions test/player_dolby_vision_integration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*! @license
* Shaka Player
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

describe('Player Dolby Vision', () => {
const Util = shaka.test.Util;

/** @type {!jasmine.Spy} */
let onErrorSpy;

/** @type {!HTMLVideoElement} */
let video;
/** @type {shaka.Player} */
let player;
/** @type {!shaka.util.EventManager} */
let eventManager;

let compiledShaka;

/** @type {!shaka.test.Waiter} */
let waiter;

beforeAll(async () => {
video = shaka.test.UiUtils.createVideoElement();
document.body.appendChild(video);
compiledShaka =
await shaka.test.Loader.loadShaka(getClientArg('uncompiled'));
});

beforeEach(async () => {
await shaka.test.TestScheme.createManifests(compiledShaka, '_compiled');
player = new compiledShaka.Player();
await player.attach(video);

player.configure('streaming.useNativeHlsOnSafari', false);

// Disable stall detection, which can interfere with playback tests.
player.configure('streaming.stallEnabled', false);

// Grab event manager from the uncompiled library:
eventManager = new shaka.util.EventManager();
waiter = new shaka.test.Waiter(eventManager);
waiter.setPlayer(player);

onErrorSpy = jasmine.createSpy('onError');
onErrorSpy.and.callFake((event) => fail(event.detail));
eventManager.listen(player, 'error', Util.spyFunc(onErrorSpy));
});

afterEach(async () => {
eventManager.release();
await player.destroy();
});

afterAll(() => {
document.body.removeChild(video);
});

/**
* @param {string} uri
* @return {!Promise}
*/
async function testPlayback(uri) {
await player.load(uri);
await video.play();
expect(player.isLive()).toBe(false);

// Wait for the video to start playback. If it takes longer than 10
// seconds, fail the test.
await waiter.waitForMovementOrFailOnTimeout(video, 10);

// Play for 2 seconds, but stop early if the video ends. If it takes
// longer than 10 seconds, fail the test.
await waiter.waitUntilPlayheadReachesOrFailOnTimeout(video, 2, 10);

await player.unload();
}

describe('P8 with fallback to HEVC', () => {
it('with DASH', async () => {
if (!await Util.isTypeSupported('video/mp4; codecs="hvc1.2.4.L90.90"',
/* width= */ 640, /* height= */ 360)) {
pending('Codec HEVC is not supported by the platform.');
}
await testPlayback('/base/test/test/assets/dv-p8-hevc/manifest.mpd');
});

it('with master playlist (HLS)', async () => {
if (!await Util.isTypeSupported('video/mp4; codecs="hvc1.2.4.L90.90"',
/* width= */ 640, /* height= */ 360)) {
pending('Codec HEVC is not supported by the platform.');
}
await testPlayback('/base/test/test/assets/dv-p8-hevc/master.m3u8');
});

it('with media playlist (HLS)', async () => {
if (!await Util.isTypeSupported('video/mp4; codecs="hvc1.2.4.L90.90"',
/* width= */ 640, /* height= */ 360)) {
pending('Codec HEVC is not supported by the platform.');
}
await testPlayback('/base/test/test/assets/dv-p8-hevc/media.m3u8');
});
});

describe('P10 with fallback to AV1', () => {
it('with DASH', async () => {
if (!await Util.isTypeSupported(
'video/mp4; codecs="av01.0.04M.10.0.111.09.16.09.0"',
/* width= */ 640, /* height= */ 360)) {
pending('Codec AV1 is not supported by the platform.');
}
await testPlayback('/base/test/test/assets/dv-p10-av1/manifest.mpd');
});

it('with master playlist (HLS)', async () => {
if (!await Util.isTypeSupported(
'video/mp4; codecs="av01.0.04M.10.0.111.09.16.09.0"',
/* width= */ 640, /* height= */ 360)) {
pending('Codec AV1 is not supported by the platform.');
}
await testPlayback('/base/test/test/assets/dv-p10-av1/master.m3u8');
});

it('with media playlist (HLS)', async () => {
if (!await Util.isTypeSupported(
'video/mp4; codecs="av01.0.04M.10.0.111.09.16.09.0"',
/* width= */ 640, /* height= */ 360)) {
pending('Codec AV1 is not supported by the platform.');
}
await testPlayback('/base/test/test/assets/dv-p10-av1/media.m3u8');
});
});
});
Binary file added test/test/assets/dv-p10-av1/dovi_10-video.mp4
Binary file not shown.
16 changes: 16 additions & 0 deletions test/test/assets/dv-p10-av1/manifest.mpd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" xmlns:scte214="urn:scte:dash:scte214-extensions" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT6.022683S">
<Period id="0">
<AdaptationSet id="0" contentType="video" width="640" height="360" frameRate="60000/1001" subsegmentAlignment="true" par="16:9">
<SupplementalProperty schemeIdUri="urn:mpeg:mpegB:cicp:MatrixCoefficients" value="9"/>
<SupplementalProperty schemeIdUri="urn:mpeg:mpegB:cicp:ColourPrimaries" value="9"/>
<SupplementalProperty schemeIdUri="urn:mpeg:mpegB:cicp:TransferCharacteristics" value="16"/>
<Representation id="0" bandwidth="550702" codecs="av01.0.04M.10.0.111.09.16.09.0" mimeType="video/mp4" scte214:supplementalCodecs="dav1.10.01" scte214:supplementalProfiles="db1p" sar="1:1">
<BaseURL>dovi_10-video.mp4</BaseURL>
<SegmentBase indexRange="871-926" timescale="60000">
<Initialization range="0-870"/>
</SegmentBase>
</Representation>
</AdaptationSet>
</Period>
</MPD>
5 changes: 5 additions & 0 deletions test/test/assets/dv-p10-av1/master.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#EXTM3U
#EXT-X-INDEPENDENT-SEGMENTS

#EXT-X-STREAM-INF:BANDWIDTH=550702,AVERAGE-BANDWIDTH=577484,CODECS="av01.0.04M.10.0.111.09.16.09.0",SUPPLEMENTAL-CODECS="dav1.10.01/db1p",RESOLUTION=640x360,FRAME-RATE=59.940,VIDEO-RANGE=PQ,CLOSED-CAPTIONS=NONE
media.m3u8
12 changes: 12 additions & 0 deletions test/test/assets/dv-p10-av1/media.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="dovi_10-video.mp4",BYTERANGE="871@0"
#EXTINF:5.355,
#EXT-X-BYTERANGE:368650@927
dovi_10-video.mp4
#EXTINF:0.667,
#EXT-X-BYTERANGE:66100
dovi_10-video.mp4
#EXT-X-ENDLIST
Binary file added test/test/assets/dv-p8-hevc/dovi_8-video.mp4
Binary file not shown.
16 changes: 16 additions & 0 deletions test/test/assets/dv-p8-hevc/manifest.mpd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" xmlns:scte214="urn:scte:dash:scte214-extensions" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT6.022683S">
<Period id="0">
<AdaptationSet id="0" contentType="video" width="640" height="360" frameRate="60000/1001" subsegmentAlignment="true" par="16:9">
<SupplementalProperty schemeIdUri="urn:mpeg:mpegB:cicp:MatrixCoefficients" value="9"/>
<SupplementalProperty schemeIdUri="urn:mpeg:mpegB:cicp:ColourPrimaries" value="9"/>
<SupplementalProperty schemeIdUri="urn:mpeg:mpegB:cicp:TransferCharacteristics" value="16"/>
<Representation id="0" bandwidth="807837" codecs="hvc1.2.4.L90.90" mimeType="video/mp4" scte214:supplementalCodecs="dvh1.08.01" scte214:supplementalProfiles="db2g" sar="1:1">
<BaseURL>dovi_8-video.mp4</BaseURL>
<SegmentBase indexRange="992-1071" timescale="60000">
<Initialization range="0-991"/>
</SegmentBase>
</Representation>
</AdaptationSet>
</Period>
</MPD>
5 changes: 5 additions & 0 deletions test/test/assets/dv-p8-hevc/master.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#EXTM3U
#EXT-X-INDEPENDENT-SEGMENTS

#EXT-X-STREAM-INF:BANDWIDTH=807837,AVERAGE-BANDWIDTH=748074,CODECS="hvc1.2.4.L90.90",SUPPLEMENTAL-CODECS="dvh1.08.01/db2g",RESOLUTION=640x360,FRAME-RATE=59.940,VIDEO-RANGE=PQ,CLOSED-CAPTIONS=NONE
media.m3u8
18 changes: 18 additions & 0 deletions test/test/assets/dv-p8-hevc/media.m3u8
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:3
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="dovi_8-video.mp4",BYTERANGE="992@0"
#EXTINF:2.002,
#EXT-X-BYTERANGE:172013@1072
dovi_8-video.mp4
#EXTINF:2.002,
#EXT-X-BYTERANGE:186781
dovi_8-video.mp4
#EXTINF:2.002,
#EXT-X-BYTERANGE:202161
dovi_8-video.mp4
#EXTINF:0.017,
#EXT-X-BYTERANGE:2221
dovi_8-video.mp4
#EXT-X-ENDLIST

0 comments on commit 6d0fd92

Please sign in to comment.