Set a unique number to each Session of each Cdm

This commit is contained in:
rlaphoenix 2022-08-21 22:37:28 +01:00
parent 9191e0258f
commit 838df7c22b
2 changed files with 3 additions and 2 deletions

View File

@ -131,7 +131,7 @@ class Cdm:
if len(self.__sessions) > self.MAX_NUM_OF_SESSIONS:
raise TooManySessions(f"Too many Sessions open ({self.MAX_NUM_OF_SESSIONS}).")
session = Session()
session = Session(len(self.__sessions) + 1)
self.__sessions[session.id] = session
return session.id

View File

@ -7,7 +7,8 @@ from pywidevine.license_protocol_pb2 import SignedMessage
class Session:
def __init__(self):
def __init__(self, number: int):
self.number = number
self.id = get_random_bytes(16)
self.service_certificate: Optional[SignedMessage] = None
self.context: dict[bytes, tuple[bytes, bytes]] = {}