forked from kenzuya/unshackle
fix(manifests): correct DRM type selection for remote PlayReady CDMs
HLS: Filter segment keys by CDM type during aria2c merge phase to prevent incorrect Widevine selection when using PlayReady-only CDMs. The merge phase now uses filter_keys_for_cdm() before get_supported_key(), matching the pattern used in initial licensing. DASH: Extend PlayReady CDM detection to include remote CDMs with is_playready attribute, not just native PlayReadyCdm instances. This ensures correct DRM extraction order from init_data when using remote PlayReady CDMs.
This commit is contained in:
@@ -468,7 +468,8 @@ class DASH:
|
|||||||
track.data["dash"]["segment_durations"] = segment_durations
|
track.data["dash"]["segment_durations"] = segment_durations
|
||||||
|
|
||||||
if init_data and isinstance(track, (Video, Audio)):
|
if init_data and isinstance(track, (Video, Audio)):
|
||||||
if isinstance(cdm, PlayReadyCdm):
|
prefers_playready = isinstance(cdm, PlayReadyCdm) or (hasattr(cdm, "is_playready") and cdm.is_playready)
|
||||||
|
if prefers_playready:
|
||||||
try:
|
try:
|
||||||
track.drm = [PlayReady.from_init_data(init_data)]
|
track.drm = [PlayReady.from_init_data(init_data)]
|
||||||
except PlayReady.Exceptions.PSSHNotFound:
|
except PlayReady.Exceptions.PSSHNotFound:
|
||||||
|
|||||||
@@ -591,6 +591,10 @@ class HLS:
|
|||||||
|
|
||||||
segment_keys = getattr(segment, "keys", None)
|
segment_keys = getattr(segment, "keys", None)
|
||||||
if segment_keys:
|
if segment_keys:
|
||||||
|
if cdm:
|
||||||
|
cdm_segment_keys = HLS.filter_keys_for_cdm(segment_keys, cdm)
|
||||||
|
key = HLS.get_supported_key(cdm_segment_keys) if cdm_segment_keys else HLS.get_supported_key(segment_keys)
|
||||||
|
else:
|
||||||
key = HLS.get_supported_key(segment_keys)
|
key = HLS.get_supported_key(segment_keys)
|
||||||
if encryption_data and encryption_data[0] != key and i != 0 and segment not in unwanted_segments:
|
if encryption_data and encryption_data[0] != key and i != 0 and segment not in unwanted_segments:
|
||||||
decrypt(include_this_segment=False)
|
decrypt(include_this_segment=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user