Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

PlantUML Macro
formatSVG
titleCreate MKS - Cobalt/OCDM
@startuml

autonumber

box "Container" #LightGreen
participant Cobalt
participant Starboard
participant ocdmProxy
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box


Cobalt       ->  Starboard:     SbDrmGenerateSessionUpdateRequest(media_keys_handle,\n\t\tticket, init_data_type, iv)
Starboard    ->  ocdmProxy:     opencdm_construct_session(media_keys_handle, init_data_type, iv)

ocdmProxy    ->  rialtoClient:  createKeySession(media_keys_handle, sessionType=TEMPORARY, client, isLDL=false)
rialtoClient ->  rialtoServer:  createKeySession(media_keys_handle, type, isLDL)
rialtoServer ->  rialtoServer:  generate unique key_session_id and create local key session object
rialtoServer --> rialtoClient:  status, key_session_id
rialtoClient --> ocdmProxy:     status, key_session_id

ocdmProxy    ->  rialtoClient:  generateRequest(key_session_id, init_data_type, init_data)
rialtoClient ->  rialtoServer:  generateRequest(key_session_id, init_data_type, init_data)
activate rialtoServer

opt ocdm_session not yet created for this key session
rialtoServer ->  Ocdm:          opencdm_construct_session(media_key_system, Temporary, iv, CDMData=NULL)
Ocdm         --> rialtoServer:  status, ocdm_key_session
end

rialtoServer --> rialtoClient:  status
rialtoClient --> ocdmProxy:     status
ocdmProxy    --> Starboard:     status, session_handle
Starboard    --> Cobalt:        

opt media_keys.key_system == "com.netflix.playready" && no errors

note over rialtoServer, Ocdm: For Netflixno errors

Ocdm         -/  rialtoServer:  process_challenge_callback(ocdm_key_session, url, challenge) won't be received, Rialto must call\nopencdm_session_get_challenge_data() to get the challenge then call\nonLicenseRequest() with it
rialtoServer ->  Ocdm:          opencdm_session_get_challenge_data(ocdm_session, is_LDL)
Ocdm         --> rialtoServer:  challenge
rialtoServer -/  rialtoClient:
note left: Callback automatically occurs after opencdm_construct_session() for non-Netflix key system
rialtoServer -/  rialtoClient:  onLicenseRequest(key_session_id, challenge, url)
rialtoClient -/  ocdmProxy:     onLicenseRequest(key_session_id, challenge, url="")
deactivate rialtoServer
rialtoClientocdmProxy    -/  ocdmProxyStarboard:     onLicenseRequest(key_process_challenge_callback(session_idhandle, challengeurl, urlchallenge)

else media_keys.key_system != "com.netflix.playready" && no errors

OcdmStarboard    -/  Cobalt:         -/  rialtoServer:  process_challenge_callback(ocdm_key_session, url, challenge)
note left: Callback automatically occurs after opencdm_construct_session() for non-Netflix key system
rialtoServer -/  rialtoClient:  onLicenseRequest(key_SbDrmSessionUpdateRequestFunc(media_keys_handle, context,\n\t\tticket, kSbDrmStatusSuccess,\n\t\tkSbDrmSessionRequestTypeLicenseRequest,\n\t\tNULL, session_id, challenge, url)
rialtoClient -/  ocdmProxy:     onLicenseRequest(key_session_id, challenge, url)
ocdmProxy    
else If generateRequest() fails at any point ensure error callback is made (not showing all cases to keep diagram simple)

opt Server error
rialtoServer --> rialtoClient:  status!=OK
end
rialtoClient --> ocdmProxy:     status!=OK
ocdmProxy    -/  Starboard:     process_challenge_callback(session_handle, url, challengeNULL)
Starboard    -/  Cobalt:        SbDrmSessionUpdateRequestFunc(media_keys_handle, context,ticket,\n\t\tticket, kSbDrmStatusSuccess,\n\t\tkSbDrmSessionRequestTypeLicenseRequest,\n\t\tNULL, session_id, challenge, urltUnknownError, RequestTypeLicenseRequest)

else If generateRequest() fails at any point ensure error callback is made (not showing all cases to keep diagram simple)

opt Server error
rialtoServer --> rialtoClient:  status!=OK
end
rialtoClient --> ocdmProxy:     status!=OK
ocdmProxy    -/  Starboard:     process_challenge_callback(session_handle, url, NULL)
Starboard    -/  Cobalt:        SbDrmSessionUpdateRequestFunc(ticket,\n\t\tUnknownError, RequestTypeLicenseRequest)

end

note across: Rialto API follows EME/libNova APIs which put IV in generateRequest which doesn't map directly to OCDM/Fusion so some complexity in here but as this model is proven retain it

@enduml

Create - Netflix/native Rialto

end

note across: Rialto API follows EME/libRialtoClient APIs which put IV in generateRequest which doesn't map directly to OCDM/Fusion so some complexity in here but as this model is proven retain it

@enduml

Create - Netflix/OCDM

PlantUML Macro
formatSVG
titleCreate MKS - Netflix/OCDM
@startuml

autonumber

box "Container" #LightGreen
participant Netflix
participant DPI
participant ocdmProxy
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box


Netflix       ->  DPI:     createDrmSession(media_keys, content_id, license_type, drm_header)
DPI    ->  ocdmProxy:     opencdm_construct_session(media_keys_handle, init_data_type, iv)
ocdmProxy    ->  ocdmProxy:  Create internal session object
ocdmProxy    ->  DPI:  session_handle

DPI -> ocdmProxy: opencdm_session_get_challenge_data(session, challenge_buffer, challenge_size, is_ldl)
ocdmProxy    ->  rialtoClient:  createKeySession(media_keys_handle, session_type=TEMPORARY, client, is_ldl)
rialtoClient ->  rialtoServer:  createKeySession(media_keys_handle, type, is_ldl)
rialtoServer ->  rialtoServer:  generate unique key_session_id and create local key session object
rialtoServer --> rialtoClient:  status, key_session_id
rialtoClient --> ocdmProxy:     status, key_session_id

ocdmProxy    ->  rialtoClient:  generateRequest(key_session_id, init_data_type, init_data)
rialtoClient ->  rialtoServer:  generateRequest(key_session_id, init_data_type, init_data)
activate rialtoServer

opt ocdm_session not yet created for this key session
rialtoServer ->  Ocdm:          opencdm_construct_session(media_key_system, Temporary, iv, CDMData=NULL)
Ocdm         --> rialtoServer:  status, ocdm_key_session
end

note over rialtoServer, Ocdm: For Netflix process_challenge_callback() won't be received, Rialto must call\nopencdm_session_get_challenge_data() to get the challenge then call\nonLicenseRequest() with it
rialtoServer ->  Ocdm:          opencdm_session_get_challenge_data(ocdm_session, is_LDL)
Ocdm         --> rialtoServer:  challenge
rialtoServer -/  rialtoClient:  onLicenseRequest(key_session_id, challenge, url="")
deactivate rialtoServer
rialtoClient -/  ocdmProxy:     onLicenseRequest(key_session_id, challenge, url)

rialtoServer --> rialtoClient:  status
rialtoClient --> ocdmProxy:     status
ocdmProxy    --> DPI:     status, challenge_buffer
DPI    --> Netflix:

@enduml


Create - Netflix/native Rialto

PlantUML Macro
formatSVG
titleCreate MKS - Netflix/native Rialto
@startuml

autonumber

box "Container" #LightGreen
participant Netflix
participant DPI
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
end box

Netflix      ->  DPI:           createDrmSession(media_keys, content_id, license_type, drm_header)
DPI          ->  DPI:           Create DPI session object
DPI          ->  DPI:           Store content_id, license_type &\ndrm_header in session object
DPI          --> Netflix:       session_handle
Netflix      ->  DPI:           getChallengeData(is_LDL)
DPI          ->  rialtoClient:  createKeySession(media_keys_handle, session_type=TEMPORARY, is_LDL)
rialtoClient ->  rialtoServer:  createKeySession(media_keys_handle, session_type, is_LDL)
note over rialtoServer: As createKeySession() in Cobalt diagram above
rialtoServer --> rialtoClient:  status, key_session_id
rialtoClient --> DPI:           status, key_session_id

DPI          ->  rialtoClient:  generateRequest(key_session_id, init_data_type=DRMHEADER, init_data=drm_header)
rialtoClient ->  rialtoServer:  generateRequest(key_session_id, init_data_type, init_data)
note over rialtoServer:As generateRequest() in Cobalt diagram above,\nsee note that opendm_session_get_challenge_data()
rialtoServer --> rialtoClient:  status
rialtoClient --> DPI:           status
note over DPI: getChallengeData() must block until onLicenseRequest() callback received
rialtoServer -/  rialtoClient:  onLicenseRequest(key_session_id, challenge, url)
rialtoClient -/  DPI:           onLicenseRequest(key_session_id, challenge, url)
DPI          --> Netflix:       status, challenge


@enduml


Update - Cobalt/OCDM


PlantUML Macro
formatSVG
titleUpdate MKS - Cobalt/OCDM
@startuml

autonumber

box "Container" #LightGreen
participant Cobalt
participant Starboard
participant ocdmProxy
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box

Cobalt       ->  Starboard:     SbDrmUpdateSession(media_keys_handle, ticket, key, session_id)
Starboard    ->  ocdmProxy:     opencdm_session_update(session_id, key)
ocdmProxy    ->  ocdmProxy:     Lookup MediaKeys object for session_id
ocdmProxy    ->  rialtoClient:  updateSession(media_keys_handle, session_id, key)
rialtoClient ->  rialtoServer:  updateSession(media_keys_handle, session_id, key)

opt media_keys.key_system == "com.netflix.playready"
rialtoServer ->  Ocdm
PlantUML Macro
formatSVG
titleCreate MKS - Netflix/native Rialto
@startuml

autonumber

box "Container" #LightGreen
participant Netflix
participant DPI
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
end box

Netflix      ->  DPI:           createDrmSession(media_keys, content_opencdm_session_store_license_data(session_id, license_type, drm_header)
DPI         data=key)
Ocdm         --> rialtoServer:  status, secure_stop_id
note left: Secure stop ID ignored as\nnot supported by Rialto
else
rialtoServer ->  DPIOcdm:           Create DPI session object
DPIopencdm_session_update(session_id, key)
Ocdm         --> rialtoServer:  status
end

rialtoServer -->  DPIrialtoClient:  status
rialtoClient --> ocdmProxy:     status

opt  Store content_id, license_type &\ndrm_header in session object
DPI update successful

ocdmProxy    --> Starboard:     status=OK
Starboard    --> NetflixCobalt:        status=OK

loop For each key session_handle
Netflixupdated
Ocdm         ->/  DPIrialtoServer:  OnKeyUpdated(session_id, key_id)
rialtoServer ->  rialtoServer:  Store updated  getChallengeData(is_LDL)
DPIkey_id
end
Ocdm         -/  rialtoServer:  OnAllKeysUpdated(session_id)
rialtoServer ->/  rialtoClient:  createKeySession(media_keys_handle, onKeyStatusesChanged(session_type=TEMPORARYid, iskey_LDLstatuses)
rialtoClient ->/  rialtoServerocdmProxy:   createKeySession(media_keys_handle,   onKeyStatusesChanged(session_typeid, iskey_LDLstatuses)
note over rialtoServer: As createKeySession() in Cobalt diagram above
rialtoServer --> rialtoClient:  statusloop For each key updated
ocdmProxy    -/  Starboard:     OnKeyUpdated(session_id, key_session_id)
end
rialtoClientocdmProxy --> DPI:  -/  Starboard:       status, key_OnAllKeysUpdated(session_id)

DPIStarboard    -/  Cobalt:    ->  rialtoClient:  generateRequestSbDrmSessionUpdatedFunc(keymedia_sessionkeys_idhandle, init_data_type=DRMHEADER, init_data=drm_header)
rialtoClient ->  rialtoServer:  generateRequest(key_session_id, init_data_type, init_data)
note over rialtoServer:As generateRequest() in Cobalt diagram above,\nsee note that opendm_session_get_challenge_data()
rialtoServer --> rialtoClient:  status
rialtoClient --> DPIcontext, ticket, kSbDrmStatusSuccess, nullptr, session_id);
Starboard    -/  Cobalt:        SbDrmSessionKeyStatusesChangedFunc(media_keys_handle, context, session_id, key_ids, key_statuses);

else update failed

ocdmProxy    --> Starboard:           status
note over DPI: getChallengeData() must block until onLicenseRequest() callback received
rialtoServer -/  rialtoClient:  onLicenseRequest(key_session_id, challenge, url)
rialtoClient -/  DPI:           onLicenseRequest(key_session_id, challenge, url)
DPI          --> Netflixstatus=NOK
Starboard    -/  Cobalt:        SbDrmSessionUpdatedFunc(media_keys_handle, context, ticket, kSbDrmStatusUnknownError, nullptr, session_id);
Starboard    --> Cobalt:       status, challenge
 status=NOK

end

@enduml


Update -

...

Netflix/

...

native Rialto


PlantUML Macro
formatSVG
titleUpdate MKS - CobaltNetflix/OCDMnative Rialto
@startuml

autonumber

box "Container" #LightGreen
participant CobaltNetflix
participant Starboard
participant ocdmProxyDPI
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box

Cobalt       ->  Starboard:     SbDrmUpdateSession(media_keys_handle, ticket, key, session_id)
StarboardNetflix      ->  ocdmProxyDPI:     opencdm_session_update      storeLicenseData(session_id, keylicense_data)
ocdmProxyDPI      ->  ocdmProxy:     Lookup MediaKeys object for session_id
ocdmProxy->  DPI:     ->  rialtoClient:  updateKeySession(media_keys_handle, session_id, key)
rialtoClient ->  rialtoServer:  updateKeySession(media_keys_handle, Lookup MediaKeys object for session_id, key)

opt media_keys.key_system == "com.netflix.playready"
rialtoServer ->  Ocdm:
DPI          ->  rialtoClient:    opencdm_session_store_license_data(updateKeySession(media_keys_handle, session_id, license_data=key)
Ocdm         -rialtoClient ->  rialtoServer:  status updateKeySession(media_keys_handle, session_id, secure_stop_idlicense_data)

note leftover rialtoServer, Ocdm: SecureAs stopshown IDfor ignoredupdateKeySession as\nnotin supportedprevious by Rialtodiagram
else
rialtoServer -->  OcdmrialtoClient:  status
rialtoClient --> DPI:      opencdm_session_update(session_id, key)
Ocdm    status
DPI     --> rialtoServer:  status
end

rialtoServer --> rialtoClient:  status
rialtoClient --> ocdmProxyNetflix:       status

optnote across: Key update successful

ocdmProxymessages will be  --> Starboard:     status=OK
Starboard    --> Cobalt:   generated as shown in previous diagram

@enduml


License Renewal - Cobalt/OCDM

PlantUML Macro
formatSVG
titleLicense Renewal - Cobalt/OCDM
@startuml

autonumber

box "Container" #LightGreen
participant Cobalt
participant Starboard
participant ocdmProxy
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box


Ocdm     status=OK

loop For each key updated
Ocdm -/ rialtoServer:   process_challenge_callback(session_id, user_data, license_renewal_message, url)
rialtoServer  -/ rialtoClient: rialtoServer:  OnKeyUpdatedonLicenseRenewal(session_id, keylicense_renewal_idmessage)
rialtoServerrialtoClient ->/ ocdmProxy:  rialtoServer:  Store updated keyonLicenseRenewal(session_id
end
Ocdm    , license_renewal_message)
ocdmProxy     -/  rialtoServerStarboard:  OnAllKeysUpdated(session_id)
rialtoServer -/  rialtoClient:  onKeyStatusesChangedprocess_challenge_callback(session_id, user_data, key_statuses)
rialtoClientlicense_renewal_message, url="")
Starboard    -/ Starboard:    ocdmProxy:  Extract request_type & onKeyStatusesChanged(session_id, key_statuses)
loop For each key updated
ocdmProxyrequest_content from license_renewal_message
note left: Use user_data to determine media_keys etc
Starboard    -/  Starboard:Cobalt:         OnKeyUpdated(SbDrmSessionUpdateRequestFunc(media_keys, request_status=kSbDrmStatusSuccess, request_type, session_id, key_idrequest_content, url)
end
ocdmProxynote across: App then -/should fetch Starboard:the updated license and call OnAllKeysUpdatedSbDrmUpdateSession(session_id)
Starboard in the same -/way as Cobalt:for the initial license

@enduml


License Renewal - native Rialto

PlantUML Macro
formatSVG
titleLicense Renewal - native Rialto
@startuml

autonumber

box "Container" #LightGreen
participant   SbDrmSessionUpdatedFunc(media_keys_handle, context, ticket, kSbDrmStatusSuccess, nullptr, session_id);
Starboard    -/  Cobalt:        SbDrmSessionKeyStatusesChangedFunc(media_keys_handle, context, Client
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box


Ocdm         -/ rialtoServer:   process_challenge_callback(session_id, keyuser_idsdata, key_statuses);

else update failed

ocdmProxy    --> Starboardlicense_renewal_message, url)
rialtoServer -/ rialtoClient:     status=NOK
Starboard    onLicenseRenewal(session_id, license_renewal_message)
rialtoClient -/ Client: Cobalt:        SbDrmSessionUpdatedFunc(media_keys_handle, context, ticket, kSbDrmStatusUnknownError, nullptr, session_id);
Starboard    --> Cobalt:        status=NOK

end

@enduml

...

onLicenseRenewal(session_id, license_renewal_message)

note across: App then should fetch the updated license and call updateKeySession() in the same way as for the initial license

@enduml



Key Session Error - TODO

Not supported in avbus-poc or libNova - not required? If need, it follows a same pattern as License Renewal above and we would need to add onError() method in IMediaKeysClient interface.


Select Key ID - Netflix/native Rialto


PlantUML Macro
formatSVG
titleUpdate MKS - Netflix/native RialtoSelect Key ID
@startuml

autonumber

box "Container" #LightGreen
participant Netflix
participant DPI
participant rialtoClient
end box


box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box

NetflixNetflix      ->  DPI:           initDecryptContextByKid(session_id, key_id)
DPI          ->  DPI:   DPI:        Lookup MediaKeys object for session_id
DPI          ->  rialtoClient:  storeLicenseData(selectKeyId(media_keys_handle, session_id, licensekey_dataid)
DPIrialtoClient  ->   rialtoClient:  Store session_id  ->  DPI:           Lookup MediaKeys object for session_id
DPI          ->  rialtoClient:  updateKeySession(media_keys_handle, session_id, license_data)
rialtoClient ->  rialtoServer:  updateKeySession(media_keys_handle, session_id, license_data)

note over rialtoServer, Ocdm: As shown for updateKeySession in previous diagram

rialtoServer --> rialtoClient:  status& key_id
note right
The key_id should be stored with the associated session_id in
a map/vector. This key_id will be retrieved later and stored in
the metadata when the client calls addSegment() call. When a
key session is destroyed the relevant entry in the map should
be removed. See Netflix to Rialto Client diagram.
end note
rialtoClient --> DPI:           status
DPI          --> Netflix:       status

note across: Key update messages will be generated as shown in previous diagram

@enduml

...

@enduml 


Contains Key - Netflix/native Rialto


PlantUML Macro
formatSVG
titleLicense Renewal - Cobalt/OCDMContains Key
@startuml

autonumber

box "Container" #LightGreen
participant CobaltNetflix
participant Starboard
participant ocdmProxyDPI
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box


Ocdm

Netflix      ->  DPI:       -/ rialtoServer:   process_challenge_callbackhasLicense(session_id, user_data, license_renewal_message, url)
rialtoServer -/ rialtoClient:   onLicenseRenewal(session_id, license_renewal_message)
rialtoClient -/ ocdmProxy:      onLicenseRenewal(key_id)
DPI          ->  DPI:           Lookup MediaKeys object for session_id
DPI          ->  rialtoClient:  containsKey(media_keys_handle, session_id, licensekey_renewal_messageid)
ocdmProxyrialtoClient ->   -/ StarboardrialtoServer:      process_challenge_callback(containsKey(media_keys_handle, session_id, user_data, license_renewal_message, url="")
Starboard    -/ Starboard:key_id)
rialtoServer ->  Ocdm:         Extract request_type & request_content from license_renewal_message
note left: Use user_data to determine media_keys etc
Starboard    -/ Cobalt:         SbDrmSessionUpdateRequestFunc(media_keys, request_status=kSbDrmStatusSuccess, request_type, session_id, request_content, url)

note across: App then should fetch the updated license and call SbDrmUpdateSession() in the same way as for the initial license

@enduml

...

 opencdm_session_has_key_id(session, key_id)



Ocdm         --> rialtoServer:  result
rialtoServer --> rialtoClient:  result
rialtoClient --> DPI:           result
DPI          --> Netflix:       result


@enduml



Remove/OCDM

Note that Remove is not required by Cobalt so we do not yet need to implement this API.


PlantUML Macro
formatSVG
titleLicense Renewal - native RialtoRemove MKS
@startuml

autonumber

box "Container" #LightGreen#LightGreen
participant Client
participant ClientocdmProxy
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box



Ocdm         -/Client       ->  ocdmProxy:     opencdm_session_remove(session_id)
ocdmProxy    ->  ocdmProxy:     Lookup MediaKeys object for session_id
ocdmProxy    ->  rialtoClient:  removeKeySession(media_keys_handle, session_id)
rialtoClient ->  rialtoServer:   process_challenge_callback(session_id, user_data, license_renewal_message, urlremoveKeySession(media_keys_handle, session_id)
rialtoServer -/>  rialtoClient:Ocdm:          onLicenseRenewalopencdm_session_remove(session_id, license_renewal_message)
rialtoClient -/ Client:Ocdm         --> rialtoServer:  status
rialtoServer  onLicenseRenewal(session_id, license_renewal_message)

note across: App then should fetch the updated license and call updateKeySession() in the same way as for the initial license

@enduml

Key Session Error - TODO

Not supported in avbus-poc or libNova - not required? If need, it follows a same pattern as License Renewal above and we would need to add onError() method in IMediaKeysClient interface.

Select Key ID - Netflix/native Rialto

--> rialtoClient:  status
rialtoClient --> ocdmProxy:     status
ocdmProxy    --> Client:        status

@enduml


Load/OCDM

Note that Load is not required by Cobalt so we do not yet need to implement this API.


PlantUML Macro
formatSVG
titleSelect Key IDLoad MKS
@startuml

autonumber

box "Container" #LightGreen
participant NetflixClient
participant DPIocdmProxy
participant rialtoClient
end box


Netflixbox "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box


Client ->  DPI:    ->  ocdmProxy:     initDecryptContextByKidopencdm_session_load(session_id, key_id)
DPI    )
ocdmProxy      ->  DPI ocdmProxy:           Lookup MediaKeys object for session_id
DPIocdmProxy          ->  rialtoClient:  selectKeyIdloadKeySession(media_keys_handle, session_id, key_id)
rialtoClient ->  rialtoClientrialtoServer:  Store session_id & key_id
note right
The key_id should be stored with the associated session_id in
a map/vector. This key_id will be retrieved later and stored in
the metadata when the client calls addSegment() call. When a
key session is destroyed the relevant entry in the map should
be removed. See Netflix to Rialto Client diagram.
end noteloadKeySession(media_keys_handle, session_id)
rialtoServer ->  Ocdm:          opencdm_session_load(session_id)
Ocdm         --> rialtoServer:  status
rialtoServer --> rialtoClient:  status
rialtoClient --> DPIocdmProxy:           status
DPI     ocdmProxy     --> NetflixClient:        status

@enduml 

...


Close -

...

Cobalt/

...

OCDM


PlantUML Macro
formatSVG
titleContains Key"Destroy" MKS - Cobalt/OCDM
@startuml

autonumber

box "Container" #LightGreen
participant Cobalt
participant NetflixStarboard
participant DPIocdmProxy
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box


Netflix  Cobalt       ->  Starboard:     SbDrmCloseSession(media_keys_handle, session_id)
Starboard    ->  DPIocdmProxy:           hasLicense(session_id, keyopencdm_session_close(session_id)
DPI     ocdmProxy     ->  DPI:       ocdmProxy:     Lookup MediaKeys object for session_id
DPIocdmProxy    ->  rialtoClient:  closeKeySession(media_keys_handle, session_id)
rialtoClient ->  rialtoClientrialtoServer:  containsKeycloseKeySession(media_keys_handle, session_id, key_id)
rialtoClient ->  rialtoServer:  containsKey(media_keys_handle, session_id, key_id)

opt No buffered media segments that need this session for decryption

opt media_keys.key_system == "com.netflix.playready"
rialtoServer ->  Ocdm:          opencdm_session_hascancel_keychallenge_iddata(session, key_id)



Ocdm         --> rialtoServer:  result
rialtoServer --> rialtoClient:  result
rialtoClient --> DPI:
Ocdm         --> rialtoServer:  resultstatus
DPIrialtoServer ->  Ocdm:       --> Netflix:       result


@enduml

Remove -  native Rialto

Note that Remove is not required by Cobalt so we do not yet need to implement this API.

PlantUML Macro
formatSVG
titleRemove MKS
@startuml

autonumber

box "Container" #LightGreen
participant Client
participant ocdmProxy
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box


Client       ->  ocdmProxy:     opencdm_session_remove  opencdm_session_clean_decrypt_context(session_id)
Ocdm         --> rialtoServer:  status
else !Netflix
rialtoServer ->  Ocdm:          opencdm_session_close(session_id)
ocdmProxynote right: TODO: Current ->code only ocdmProxy:calls for !Netflix\nbut maybe should Lookupwe MediaKeysalways object for session_id
ocdmProxycall it?
Ocdm    ->  rialtoClient:  removeKeySession(media_keys_handle, session_id)
rialtoClient  -->  rialtoServer:  removeKeySession(media_keys_handle, session_id)status
end

rialtoServer ->  Ocdm:          opencdm_destruct_session_remove(session_id)
Ocdm         --> rialtoServer:  status
rialtoServer --> rialtoClient:  status
rialtoClient --> ocdmProxy:     status
ocdmProxy    --> Client:        status

@enduml

Load -  native Rialto

Note that Load is not required by Cobalt so we do not yet need to implement this API.

PlantUML Macro
formatSVG
titleLoad MKS
@startuml

autonumber

box "Container" #LightGreen
participant Client
participant ocdmProxy
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box


Client       ->  
else Media segments are buffered that need this media key sessions
note over rialtoServer, Ocdm
The above sequence must be deferred until no media segments
are buffered that reference this media key session otherwise
their decryption will fail. rialtoServer must track these
references, details not shown for brevity.
end note
end

rialtoServer --> rialtoClient:  status
rialtoClient --> ocdmProxy:     opencdm_session_load(session_id)status
ocdmProxy    -->  ocdmProxyStarboard:     Lookupstatus
Starboard   MediaKeys object-/ for session_id
ocdmProxy Cobalt:    ->  rialtoClient:  loadKeySessionSbDrmSessionClosedFunc(media_keys_handle, context, session_id)
rialtoClientStarboard    --> Cobalt:    rialtoServer:    status

@enduml


Close - Netflix/native Rialto

PlantUML Macro
formatSVG
titleClose - Netflix/native Rialto
@startuml

autonumber

box "Container" #LightGreen
participant Netflix
participant DPI
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box

NetflixloadKeySession(media_keys_handle, session_id)
rialtoServer ->  Ocdm:          opencdm_session_load(session_id)
Ocdm         --> rialtoServer DPI:   status
rialtoServer --> rialtoClient:  status
rialtoClient --> ocdmProxy:  ~IDrmSession()
DPI     status
ocdmProxy     --> Client DPI:        status

@enduml

Close - Cobalt/OCDM

PlantUML Macro
formatSVG
title"Destroy" MKS - Cobalt/OCDM
@startuml

autonumber

box "Container" #LightGreen
participant Cobalt
participant Starboard
participant ocdmProxy
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box


Cobalt Lookup MediaKeys object for session_id
DPI          ->  StarboardrialtoClient:     SbDrmCloseSessioncloseKeySession(media_keys_handle, session_id)
Starboard rialtoClient   ->  ocdmProxyrialtoServer:     opencdm_session_close(closeKeySession(media_keys_handle, session_id)
ocdmProxy
note over   ->  ocdmProxyrialtoServer, Ocdm: Same sequence as  Lookup MediaKeys object for session_id
ocdmProxy    -> closeKeySession above

rialtoServer --> rialtoClient:  closeKeySession(media_keys_handle, session_id)status
rialtoClient --> DPI:  rialtoServer:        closeKeySession(media_keys_handle, session_id)

opt No buffered media segments that need this session for decryption

opt media_keys.key_system == "com.netflix.playready"
rialtoServer ->  Ocdm:          opencdm_session_cancel_challenge_data(session_id)
Ocdm         --> rialtoServer:  status status
DPI          --> Netflix:

@enduml

Set DRM Header

PlantUML Macro
formatSVG
titleSet DRM Header
@startuml

autonumber

box "Container" #LightGreen
participant Application
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box

Application  ->  rialtoClient:  setDrmHeader(media_keys_handle, session_id, drmHeader)
rialtoClient ->  rialtoServer:  setDrmHeader(media_keys_handle, session_id, drmHeader)
rialtoServer ->  Ocdm:             opencdm   opencdm_session_cleanset_decryptdrm_contextheader(session_idhandle, drmHeader)
Ocdm         --> rialtoServer:  status
else !Netflix
rialtoServer -->  OcdmrialtoClient:          opencdm_session_close(session_id)
note right: TODO: Current code status
rialtoClient --> Application :  status

@enduml

Get Last DRM Error

PlantUML Macro
formatSVG
titleGet Last DRM Error
@startuml

autonumber

box "Container" #LightGreen
participant Application
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box

Application  ->  rialtoClient:  getLastDrmError(media_keys_handle, session_id)
rialtoClient ->  rialtoServer:  getLastDrmError(media_keys_handle, session_id, drmHeader)only calls for !Netflix\nbut maybe should we always call it?
Ocdm         --> rialtoServer:  status
end

rialtoServer ->  Ocdm:             opencdm_destruct_session   opencdm_session_system_error(session_id)
Ocdm         --> rialtoServer:  status

else Media segments are buffered that need this media key sessions
note over rialtoServer, Ocdm
The above sequence must be deferred until no media segments
are buffered that reference this media key session otherwise
their decryption will fail. rialtoServer must track these
references, details not shown for brevity.
end note
end

rialtoServer --> rialtoClient:  status
rialtoClient --> ocdmProxy:     status
ocdmProxy    --> Starboard:     status
Starboard    -/  Cobalt:        SbDrmSessionClosedFunc(media_keys_handle, context, session_id)
Starboard    --> Cobalt:        status

@enduml

...

handle)
Ocdm         --> rialtoServer:  status, errorCode
rialtoServer --> rialtoClient:  status, errorCode
rialtoClient --> Application :  status, errorCode

@enduml

Get CDM Key Session Id

PlantUML Macro
formatSVG
titleGet CDM Key Session Id
@startuml

autonumber

box "Container" #LightGreen
participant Application
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box

Application  ->  rialtoClient:  getCdmKeySessionId(media_keys_handle, session_id)
rialtoClient ->  rialtoServer:  getCdmKeySessionId(media_keys_handle, session_id)
rialtoServer ->  Ocdm:          opencdm_session_id(session_handle)
Ocdm         --> rialtoServer:  status, cdmSessionId
rialtoServer --> rialtoClient:  status, cdmSessionId
rialtoClient --> Application :  status, cdmSessionId

@enduml

Release/OCDM

PlantUML Macro
formatSVG
titleClose - Netflix/native RialtoRelease/OCDM
@startuml

autonumber

box "Container" #LightGreen
participant NetflixClient
participant DPIocdmProxy
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant Ocdm
end box


NetflixClient       ->  DPIocdmProxy:           ~IDrmSession()
DPI      opencdm_destruct_session(session_id)
ocdmProxy    ->  DPI:       ocdmProxy:     Lookup MediaKeys object for session_id
DPI  ocdmProxy        ->  rialtoClient:  closeKeySessionreleaseKeySession(media_keys_handle, session_id)
rialtoClient ->  rialtoServer:  closeKeySessionreleaseKeySession(media_keys_handle, session_id)

noterialtoServer over-> rialtoServer, Ocdm: Same      sequence as closeKeySession above
 opencdm_destruct_session(session_id)
Ocdm         --> rialtoServer:  status
rialtoServer --> rialtoClient:  status
rialtoClient --> DPIocdmProxy:     status
ocdmProxy      status
DPI--> Client:          --> Netflix:status

@enduml