Skip to content

Commit

Permalink
test: Add test about Dolby Vision preference (#7719)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad authored Dec 5, 2024
1 parent effaf95 commit ccc90b6
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/util/stream_utils_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,42 @@ describe('StreamUtils', () => {
expect(manifest.variants[0].video.codecs).toBe('dvh1.05.03');
});

it('choose Dolby Vision at same bitrate and same resolution', async () => {
manifest = shaka.test.ManifestGenerator.generate((manifest) => {
manifest.addVariant(1, (variant) => {
variant.addVideo(2, (stream) => {
stream.bandwidth = 4000000;
stream.size(1920, 1080);
stream.mime('video/mp4', 'av01.0.04M.10.0.111.09.16.09.0');
});
});
manifest.addVariant(2, (variant) => {
variant.addVideo(3, (stream) => {
stream.bandwidth = 4000000;
stream.size(1920, 1080);
stream.mime('video/mp4', 'dav1.10.01');
});
});
});
navigator.mediaCapabilities.decodingInfo =
shaka.test.Util.spyFunc(decodingInfoSpy);
decodingInfoSpy.and.callFake((config) => {
return Promise.resolve({supported: true, smooth: true});
});

await StreamUtils.getDecodingInfosForVariants(manifest.variants,
/* usePersistentLicenses= */false, /* srcEquals= */ false,
/* preferredKeySystems= */ []);

shaka.util.StreamUtils.chooseCodecsAndFilterManifest(manifest,
/* preferredVideoCodecs= */[],
/* preferredAudioCodecs= */[],
/* preferredDecodingAttributes= */[],
/* preferredTextFormats= */ []);
expect(manifest.variants.length).toBe(1);
expect(manifest.variants[0].video.codecs).toBe('dav1.10.01');
});

it('chooses variants by decoding attributes', async () => {
manifest = shaka.test.ManifestGenerator.generate((manifest) => {
manifest.addVariant(0, (variant) => {
Expand Down

0 comments on commit ccc90b6

Please sign in to comment.