From ffd67f15d8ae20e834dbefa4796a9bc980bf44f4 Mon Sep 17 00:00:00 2001 From: imSp4rky Date: Mon, 27 Apr 2026 20:04:07 -0600 Subject: [PATCH] fix(drm): pass per-segment PSSH to Widevine license callback Mirrors the PlayReady fix (fbc4aa2) for Widevine. HLS manifests with per-segment EXT-X-KEY changes generate distinct PSSH per segment, so service callbacks building the license URI from cached track-level PSSH can mismatch the challenge KID and trigger CEKNotFound. Forward pssh from the active DRM and fall back to the legacy single-arg call when a service hasn't adopted the kwarg. --- unshackle/core/drm/widevine.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unshackle/core/drm/widevine.py b/unshackle/core/drm/widevine.py index 09596aa..82c6419 100644 --- a/unshackle/core/drm/widevine.py +++ b/unshackle/core/drm/widevine.py @@ -205,7 +205,11 @@ class Widevine: if hasattr(cdm, "has_cached_keys") and cdm.has_cached_keys(session_id): pass else: - cdm.parse_license(session_id, licence(challenge=challenge)) + try: + license_res = licence(challenge=challenge, pssh=self.pssh) + except TypeError: + license_res = licence(challenge=challenge) + cdm.parse_license(session_id, license_res) self.content_keys = {key.kid: key.key.hex() for key in cdm.get_keys(session_id, "CONTENT")} if not self.content_keys: