From 8a4c7c22788a74d536a2ceaa1bf5dfb4418980c9 Mon Sep 17 00:00:00 2001 From: Paul Berberian Date: Tue, 13 Aug 2024 18:38:24 +0200 Subject: [PATCH] Treat codecs beginning with `hev1` as hevc While working on new DRM integration test in #1478, to add tests for the not-yet-released features proposed by #1484, I noticed that some contents anounced HEVC by beginning the codec string with `hev` and others with `hvc`. When comparing family of codecs, we thus had false negative which may mean we would have ended up playing encrypted hevc on devices where it wasn't supported, if it was anounced in the MPD as `hev1...`. I now treat both the same way. --- src/utils/are_codecs_compatible.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/are_codecs_compatible.ts b/src/utils/are_codecs_compatible.ts index fd9959a675..e58aa39ce4 100644 --- a/src/utils/are_codecs_compatible.ts +++ b/src/utils/are_codecs_compatible.ts @@ -35,7 +35,11 @@ function areCodecsCompatible(a: string, b: string): boolean { if (codecsA === "" || codecsB === "") { return false; } - if (codecsA.split(".")[0] !== codecsB.split(".")[0]) { + let initialPartA = codecsA.split(".")[0]; + initialPartA = initialPartA === "hev1" ? "hvc1" : initialPartA; + let initialPartB = codecsB.split(".")[0]; + initialPartB = initialPartB === "hev1" ? "hvc1" : initialPartB; + if (initialPartA !== initialPartB) { return false; } return true;