Cdm: Fix acquisition of provider_id when removing a service cert

The logic of parsing the session's stored service cert to get the provider_id was wrong. It assumed it was a SignedDrmCertificate, when in reality it was a SignedMessage containing a SignedDrmCertificate.

It would also panic if you try to remove a certificate when none was set.
This commit is contained in:
rlaphoenix 2022-09-28 06:49:41 +01:00
parent a4c6f98650
commit fa00bbd8e4
1 changed files with 9 additions and 3 deletions

View File

@ -185,10 +185,16 @@ class Cdm:
raise InvalidSession(f"Session identifier {session_id!r} is invalid.") raise InvalidSession(f"Session identifier {session_id!r} is invalid.")
if certificate is None: if certificate is None:
if session.service_certificate:
signed_drm_certificate = SignedDrmCertificate()
signed_drm_certificate.ParseFromString(session.service_certificate)
drm_certificate = DrmCertificate() drm_certificate = DrmCertificate()
drm_certificate.ParseFromString(session.service_certificate.drm_certificate) drm_certificate.ParseFromString(signed_drm_certificate.drm_certificate)
provider_id = drm_certificate.provider_id
else:
provider_id = None
session.service_certificate = None session.service_certificate = None
return drm_certificate.provider_id return provider_id
if isinstance(certificate, str): if isinstance(certificate, str):
try: try: