LCOV - code coverage report
Current view: top level - media/server/ipc/source - MediaKeysModuleService.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 82.0 % 239 196
Test Date: 2026-11-10 16:58:19 Functions: 100.0 % 30 30

            Line data    Source code
       1              : /*
       2              :  * If not stated otherwise in this file or this component's LICENSE file the
       3              :  * following copyright and licenses apply:
       4              :  *
       5              :  * Copyright 2022 Sky UK
       6              :  *
       7              :  * Licensed under the Apache License, Version 2.0 (the "License");
       8              :  * you may not use this file except in compliance with the License.
       9              :  * You may obtain a copy of the License at
      10              :  *
      11              :  * http://www.apache.org/licenses/LICENSE-2.0
      12              :  *
      13              :  * Unless required by applicable law or agreed to in writing, software
      14              :  * distributed under the License is distributed on an "AS IS" BASIS,
      15              :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      16              :  * See the License for the specific language governing permissions and
      17              :  * limitations under the License.
      18              :  */
      19              : 
      20              : #include "MediaKeysModuleService.h"
      21              : #include "ICdmService.h"
      22              : #include "MediaKeysClient.h"
      23              : #include "RialtoServerLogging.h"
      24              : #include <IIpcController.h>
      25              : #include <algorithm>
      26              : #include <cstdint>
      27              : 
      28              : namespace
      29              : {
      30            3 : int generateHandle()
      31              : {
      32              :     static int mediaKeysHandle{0};
      33            3 :     return mediaKeysHandle++;
      34              : }
      35              : 
      36              : firebolt::rialto::ProtoMediaKeyErrorStatus
      37           34 : convertMediaKeyErrorStatus(const firebolt::rialto::MediaKeyErrorStatus &errorStatus)
      38              : {
      39           34 :     switch (errorStatus)
      40              :     {
      41           17 :     case firebolt::rialto::MediaKeyErrorStatus::OK:
      42              :     {
      43           17 :         return firebolt::rialto::ProtoMediaKeyErrorStatus::OK;
      44              :     }
      45            0 :     case firebolt::rialto::MediaKeyErrorStatus::BAD_SESSION_ID:
      46              :     {
      47            0 :         return firebolt::rialto::ProtoMediaKeyErrorStatus::BAD_SESSION_ID;
      48              :     }
      49            0 :     case firebolt::rialto::MediaKeyErrorStatus::INTERFACE_NOT_IMPLEMENTED:
      50              :     {
      51            0 :         return firebolt::rialto::ProtoMediaKeyErrorStatus::INTERFACE_NOT_IMPLEMENTED;
      52              :     }
      53            0 :     case firebolt::rialto::MediaKeyErrorStatus::BUFFER_TOO_SMALL:
      54              :     {
      55            0 :         return firebolt::rialto::ProtoMediaKeyErrorStatus::BUFFER_TOO_SMALL;
      56              :     }
      57            0 :     case firebolt::rialto::MediaKeyErrorStatus::NOT_SUPPORTED:
      58              :     {
      59            0 :         return firebolt::rialto::ProtoMediaKeyErrorStatus::NOT_SUPPORTED;
      60              :     }
      61            0 :     case firebolt::rialto::MediaKeyErrorStatus::INVALID_STATE:
      62              :     {
      63            0 :         return firebolt::rialto::ProtoMediaKeyErrorStatus::INVALID_STATE;
      64              :     }
      65           17 :     case firebolt::rialto::MediaKeyErrorStatus::FAIL:
      66              :     {
      67           17 :         return firebolt::rialto::ProtoMediaKeyErrorStatus::FAIL;
      68              :     }
      69            0 :     case firebolt::rialto::MediaKeyErrorStatus::OUTPUT_RESTRICTED:
      70              :     {
      71            0 :         return firebolt::rialto::ProtoMediaKeyErrorStatus::OUTPUT_RESTRICTED;
      72              :     }
      73              :     }
      74            0 :     return firebolt::rialto::ProtoMediaKeyErrorStatus::FAIL;
      75              : }
      76              : firebolt::rialto::KeySessionType
      77            2 : convertKeySessionType(const firebolt::rialto::CreateKeySessionRequest_KeySessionType &protoKeySessionType)
      78              : {
      79            2 :     switch (protoKeySessionType)
      80              :     {
      81            2 :     case firebolt::rialto::CreateKeySessionRequest_KeySessionType::CreateKeySessionRequest_KeySessionType_TEMPORARY:
      82            2 :         return firebolt::rialto::KeySessionType::TEMPORARY;
      83            0 :     case firebolt::rialto::CreateKeySessionRequest_KeySessionType::CreateKeySessionRequest_KeySessionType_PERSISTENT_LICENCE:
      84            0 :         return firebolt::rialto::KeySessionType::PERSISTENT_LICENCE;
      85            0 :     case firebolt::rialto::CreateKeySessionRequest_KeySessionType::CreateKeySessionRequest_KeySessionType_PERSISTENT_RELEASE_MESSAGE:
      86            0 :         return firebolt::rialto::KeySessionType::PERSISTENT_RELEASE_MESSAGE;
      87            0 :     default:
      88            0 :         return firebolt::rialto::KeySessionType::UNKNOWN;
      89              :     }
      90              : }
      91            2 : firebolt::rialto::InitDataType covertInitDataType(firebolt::rialto::GenerateRequestRequest_InitDataType protoInitDataType)
      92              : {
      93            2 :     switch (protoInitDataType)
      94              :     {
      95            2 :     case firebolt::rialto::GenerateRequestRequest_InitDataType::GenerateRequestRequest_InitDataType_CENC:
      96            2 :         return firebolt::rialto::InitDataType::CENC;
      97            0 :     case firebolt::rialto::GenerateRequestRequest_InitDataType::GenerateRequestRequest_InitDataType_KEY_IDS:
      98            0 :         return firebolt::rialto::InitDataType::KEY_IDS;
      99            0 :     case firebolt::rialto::GenerateRequestRequest_InitDataType::GenerateRequestRequest_InitDataType_WEBM:
     100            0 :         return firebolt::rialto::InitDataType::WEBM;
     101            0 :     case firebolt::rialto::GenerateRequestRequest_InitDataType::GenerateRequestRequest_InitDataType_DRMHEADER:
     102            0 :         return firebolt::rialto::InitDataType::DRMHEADER;
     103            0 :     default:
     104            0 :         return firebolt::rialto::InitDataType::UNKNOWN;
     105              :     }
     106              : }
     107              : 
     108              : firebolt::rialto::LimitedDurationLicense
     109            2 : covertLimitedDurationLicense(firebolt::rialto::GenerateRequestRequest_LimitedDurationLicense protoLimitedDurationLicense)
     110              : {
     111            2 :     switch (protoLimitedDurationLicense)
     112              :     {
     113            2 :     case firebolt::rialto::GenerateRequestRequest_LimitedDurationLicense::GenerateRequestRequest_LimitedDurationLicense_NOT_SPECIFIED:
     114            2 :         return firebolt::rialto::LimitedDurationLicense::NOT_SPECIFIED;
     115            0 :     case firebolt::rialto::GenerateRequestRequest_LimitedDurationLicense::GenerateRequestRequest_LimitedDurationLicense_ENABLED:
     116            0 :         return firebolt::rialto::LimitedDurationLicense::ENABLED;
     117            0 :     case firebolt::rialto::GenerateRequestRequest_LimitedDurationLicense::GenerateRequestRequest_LimitedDurationLicense_DISABLED:
     118            0 :         return firebolt::rialto::LimitedDurationLicense::DISABLED;
     119            0 :     default:
     120            0 :         return firebolt::rialto::LimitedDurationLicense::NOT_SPECIFIED;
     121              :     }
     122              : }
     123              : } // namespace
     124              : 
     125              : namespace firebolt::rialto::server::ipc
     126              : {
     127            1 : std::shared_ptr<IMediaKeysModuleServiceFactory> IMediaKeysModuleServiceFactory::createFactory()
     128              : {
     129            1 :     std::shared_ptr<IMediaKeysModuleServiceFactory> factory;
     130              : 
     131              :     try
     132              :     {
     133            1 :         factory = std::make_shared<MediaKeysModuleServiceFactory>();
     134              :     }
     135            0 :     catch (const std::exception &e)
     136              :     {
     137            0 :         RIALTO_SERVER_LOG_ERROR("Failed to create the media keys module service factory, reason: %s", e.what());
     138              :     }
     139              : 
     140            1 :     return factory;
     141              : }
     142              : 
     143            1 : std::shared_ptr<IMediaKeysModuleService> MediaKeysModuleServiceFactory::create(service::ICdmService &cdmService) const
     144              : {
     145            1 :     std::shared_ptr<IMediaKeysModuleService> mediaKeysModule;
     146              : 
     147              :     try
     148              :     {
     149            1 :         mediaKeysModule = std::make_shared<MediaKeysModuleService>(cdmService);
     150              :     }
     151            0 :     catch (const std::exception &e)
     152              :     {
     153            0 :         RIALTO_SERVER_LOG_ERROR("Failed to create the media keys module service, reason: %s", e.what());
     154              :     }
     155              : 
     156            1 :     return mediaKeysModule;
     157              : }
     158              : 
     159           50 : MediaKeysModuleService::MediaKeysModuleService(service::ICdmService &cdmService) : m_cdmService{cdmService} {}
     160              : 
     161              : MediaKeysModuleService::~MediaKeysModuleService() {}
     162              : 
     163            2 : void MediaKeysModuleService::clientConnected(const std::shared_ptr<::firebolt::rialto::ipc::IClient> &ipcClient)
     164              : {
     165            2 :     RIALTO_SERVER_LOG_INFO("Client Connected!");
     166              :     {
     167            2 :         m_clientMediaKeysHandles.emplace(ipcClient, std::set<int>());
     168              :     }
     169            2 :     ipcClient->exportService(shared_from_this());
     170              : }
     171              : 
     172            1 : void MediaKeysModuleService::clientDisconnected(const std::shared_ptr<::firebolt::rialto::ipc::IClient> &ipcClient)
     173              : {
     174            1 :     RIALTO_SERVER_LOG_INFO("Client disconnected!");
     175            1 :     std::set<int> mediaKeysHandles;
     176              :     {
     177            1 :         auto handleIter = m_clientMediaKeysHandles.find(ipcClient);
     178            1 :         if (handleIter == m_clientMediaKeysHandles.end())
     179              :         {
     180            0 :             RIALTO_SERVER_LOG_ERROR("unknown client disconnected");
     181            0 :             return;
     182              :         }
     183            1 :         mediaKeysHandles = handleIter->second; // copy to avoid deadlock
     184            1 :         m_clientMediaKeysHandles.erase(handleIter);
     185              :     }
     186            2 :     for (const auto &mediaKeysHandle : mediaKeysHandles)
     187              :     {
     188            1 :         m_cdmService.destroyMediaKeys(mediaKeysHandle);
     189              :     }
     190              : }
     191              : 
     192            4 : void MediaKeysModuleService::createMediaKeys(::google::protobuf::RpcController *controller,
     193              :                                              const ::firebolt::rialto::CreateMediaKeysRequest *request,
     194              :                                              ::firebolt::rialto::CreateMediaKeysResponse *response,
     195              :                                              ::google::protobuf::Closure *done)
     196              : {
     197            4 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     198            4 :     auto ipcController = dynamic_cast<firebolt::rialto::ipc::IController *>(controller);
     199            4 :     if (!ipcController)
     200              :     {
     201            1 :         RIALTO_SERVER_LOG_ERROR("ipc library provided incompatible controller object");
     202            2 :         controller->SetFailed("ipc library provided incompatible controller object");
     203            1 :         done->Run();
     204            1 :         return;
     205              :     }
     206              : 
     207            3 :     int mediaKeysHandle = generateHandle();
     208            3 :     bool mediaKeysCreated = m_cdmService.createMediaKeys(mediaKeysHandle, request->key_system());
     209            3 :     if (mediaKeysCreated)
     210              :     {
     211              :         // Assume that IPC library works well and client is present
     212            2 :         m_clientMediaKeysHandles[ipcController->getClient()].insert(mediaKeysHandle);
     213            2 :         response->set_media_keys_handle(mediaKeysHandle);
     214              :     }
     215              :     else
     216              :     {
     217            1 :         RIALTO_SERVER_LOG_ERROR("Create media keys failed");
     218            3 :         controller->SetFailed("Operation failed");
     219              :     }
     220            3 :     done->Run();
     221              : }
     222              : 
     223            3 : void MediaKeysModuleService::destroyMediaKeys(::google::protobuf::RpcController *controller,
     224              :                                               const ::firebolt::rialto::DestroyMediaKeysRequest *request,
     225              :                                               ::firebolt::rialto::DestroyMediaKeysResponse *response,
     226              :                                               ::google::protobuf::Closure *done)
     227              : {
     228            3 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     229            3 :     auto ipcController = dynamic_cast<firebolt::rialto::ipc::IController *>(controller);
     230            3 :     if (!ipcController)
     231              :     {
     232            1 :         RIALTO_SERVER_LOG_ERROR("ipc library provided incompatible controller object");
     233            2 :         controller->SetFailed("ipc library provided incompatible controller object");
     234            1 :         done->Run();
     235            2 :         return;
     236              :     }
     237            2 :     if (!m_cdmService.destroyMediaKeys(request->media_keys_handle()))
     238              :     {
     239            1 :         RIALTO_SERVER_LOG_ERROR("Destroy session failed");
     240            2 :         controller->SetFailed("Operation failed");
     241            1 :         done->Run();
     242            1 :         return;
     243              :     }
     244            1 :     auto handleIter = m_clientMediaKeysHandles.find(ipcController->getClient());
     245            1 :     if (handleIter != m_clientMediaKeysHandles.end())
     246              :     {
     247            0 :         handleIter->second.erase(request->media_keys_handle());
     248              :     }
     249            1 :     done->Run();
     250              : }
     251              : 
     252            2 : void MediaKeysModuleService::containsKey(::google::protobuf::RpcController *controller,
     253              :                                          const ::firebolt::rialto::ContainsKeyRequest *request,
     254              :                                          ::firebolt::rialto::ContainsKeyResponse *response,
     255              :                                          ::google::protobuf::Closure *done)
     256              : {
     257            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     258              : 
     259            2 :     bool result = m_cdmService.containsKey(request->media_keys_handle(), request->key_session_id(),
     260            6 :                                            std::vector<std::uint8_t>{request->key_id().begin(), request->key_id().end()});
     261            2 :     response->set_contains_key(result);
     262            2 :     done->Run();
     263              : }
     264              : 
     265            3 : void MediaKeysModuleService::createKeySession(::google::protobuf::RpcController *controller,
     266              :                                               const ::firebolt::rialto::CreateKeySessionRequest *request,
     267              :                                               ::firebolt::rialto::CreateKeySessionResponse *response,
     268              :                                               ::google::protobuf::Closure *done)
     269              : {
     270            3 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     271            3 :     auto ipcController = dynamic_cast<firebolt::rialto::ipc::IController *>(controller);
     272            3 :     if (!ipcController)
     273              :     {
     274            1 :         RIALTO_SERVER_LOG_ERROR("ipc library provided incompatible controller object");
     275            2 :         controller->SetFailed("ipc library provided incompatible controller object");
     276            1 :         done->Run();
     277            1 :         return;
     278              :     }
     279              : 
     280              :     int32_t keySessionId;
     281              :     MediaKeyErrorStatus status =
     282            2 :         m_cdmService.createKeySession(request->media_keys_handle(), convertKeySessionType(request->session_type()),
     283            4 :                                       std::make_shared<MediaKeysClient>(request->media_keys_handle(),
     284            4 :                                                                         ipcController->getClient()),
     285            2 :                                       keySessionId);
     286            2 :     if (MediaKeyErrorStatus::OK == status)
     287              :     {
     288            1 :         response->set_key_session_id(keySessionId);
     289              :     }
     290            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     291            2 :     done->Run();
     292              : }
     293              : 
     294            2 : void MediaKeysModuleService::generateRequest(::google::protobuf::RpcController *controller,
     295              :                                              const ::firebolt::rialto::GenerateRequestRequest *request,
     296              :                                              ::firebolt::rialto::GenerateRequestResponse *response,
     297              :                                              ::google::protobuf::Closure *done)
     298              : {
     299            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     300              : 
     301              :     MediaKeyErrorStatus status =
     302            2 :         m_cdmService.generateRequest(request->media_keys_handle(), request->key_session_id(),
     303              :                                      covertInitDataType(request->init_data_type()),
     304            4 :                                      std::vector<std::uint8_t>{request->init_data().begin(), request->init_data().end()},
     305            4 :                                      covertLimitedDurationLicense(request->ldl_state()));
     306            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     307            2 :     done->Run();
     308              : }
     309              : 
     310            2 : void MediaKeysModuleService::loadSession(::google::protobuf::RpcController *controller,
     311              :                                          const ::firebolt::rialto::LoadSessionRequest *request,
     312              :                                          ::firebolt::rialto::LoadSessionResponse *response,
     313              :                                          ::google::protobuf::Closure *done)
     314              : {
     315            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     316              : 
     317            2 :     MediaKeyErrorStatus status = m_cdmService.loadSession(request->media_keys_handle(), request->key_session_id(),
     318            2 :                                                           request->cdm_key_session_id());
     319            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     320            2 :     done->Run();
     321              : }
     322              : 
     323            2 : void MediaKeysModuleService::updateSession(::google::protobuf::RpcController *controller,
     324              :                                            const ::firebolt::rialto::UpdateSessionRequest *request,
     325              :                                            ::firebolt::rialto::UpdateSessionResponse *response,
     326              :                                            ::google::protobuf::Closure *done)
     327              : {
     328            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     329              : 
     330            2 :     MediaKeyErrorStatus status = m_cdmService.updateSession(request->media_keys_handle(), request->key_session_id(),
     331            4 :                                                             std::vector<std::uint8_t>{request->response_data().begin(),
     332            4 :                                                                                       request->response_data().end()});
     333            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     334            2 :     done->Run();
     335              : }
     336              : 
     337            2 : void MediaKeysModuleService::setDrmHeader(::google::protobuf::RpcController *controller,
     338              :                                           const ::firebolt::rialto::SetDrmHeaderRequest *request,
     339              :                                           ::firebolt::rialto::SetDrmHeaderResponse *response,
     340              :                                           ::google::protobuf::Closure *done)
     341              : {
     342            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     343              : 
     344            2 :     MediaKeyErrorStatus status = m_cdmService.setDrmHeader(request->media_keys_handle(), request->key_session_id(),
     345            4 :                                                            std::vector<std::uint8_t>{request->request_data().begin(),
     346            4 :                                                                                      request->request_data().end()});
     347            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     348            2 :     done->Run();
     349              : }
     350              : 
     351            2 : void MediaKeysModuleService::closeKeySession(::google::protobuf::RpcController *controller,
     352              :                                              const ::firebolt::rialto::CloseKeySessionRequest *request,
     353              :                                              ::firebolt::rialto::CloseKeySessionResponse *response,
     354              :                                              ::google::protobuf::Closure *done)
     355              : {
     356            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     357              : 
     358            2 :     MediaKeyErrorStatus status = m_cdmService.closeKeySession(request->media_keys_handle(), request->key_session_id());
     359            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     360            2 :     done->Run();
     361              : }
     362              : 
     363            2 : void MediaKeysModuleService::removeKeySession(::google::protobuf::RpcController *controller,
     364              :                                               const ::firebolt::rialto::RemoveKeySessionRequest *request,
     365              :                                               ::firebolt::rialto::RemoveKeySessionResponse *response,
     366              :                                               ::google::protobuf::Closure *done)
     367              : {
     368            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     369              : 
     370            2 :     MediaKeyErrorStatus status = m_cdmService.removeKeySession(request->media_keys_handle(), request->key_session_id());
     371            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     372            2 :     done->Run();
     373              : }
     374              : 
     375            2 : void MediaKeysModuleService::deleteDrmStore(::google::protobuf::RpcController *controller,
     376              :                                             const ::firebolt::rialto::DeleteDrmStoreRequest *request,
     377              :                                             ::firebolt::rialto::DeleteDrmStoreResponse *response,
     378              :                                             ::google::protobuf::Closure *done)
     379              : {
     380            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     381              : 
     382            2 :     MediaKeyErrorStatus status = m_cdmService.deleteDrmStore(request->media_keys_handle());
     383            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     384            2 :     done->Run();
     385              : }
     386              : 
     387            2 : void MediaKeysModuleService::deleteKeyStore(::google::protobuf::RpcController *controller,
     388              :                                             const ::firebolt::rialto::DeleteKeyStoreRequest *request,
     389              :                                             ::firebolt::rialto::DeleteKeyStoreResponse *response,
     390              :                                             ::google::protobuf::Closure *done)
     391              : {
     392            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     393              : 
     394            2 :     MediaKeyErrorStatus status = m_cdmService.deleteKeyStore(request->media_keys_handle());
     395            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     396            2 :     done->Run();
     397              : }
     398              : 
     399            2 : void MediaKeysModuleService::getDrmStoreHash(::google::protobuf::RpcController *controller,
     400              :                                              const ::firebolt::rialto::GetDrmStoreHashRequest *request,
     401              :                                              ::firebolt::rialto::GetDrmStoreHashResponse *response,
     402              :                                              ::google::protobuf::Closure *done)
     403              : {
     404            2 :     std::vector<unsigned char> drmStoreHash;
     405            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     406              : 
     407            2 :     MediaKeyErrorStatus status = m_cdmService.getDrmStoreHash(request->media_keys_handle(), drmStoreHash);
     408            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     409            2 :     for (const auto &item : drmStoreHash)
     410              :     {
     411            0 :         response->add_drm_store_hash(item);
     412              :     }
     413            2 :     done->Run();
     414              : }
     415              : 
     416            2 : void MediaKeysModuleService::getKeyStoreHash(::google::protobuf::RpcController *controller,
     417              :                                              const ::firebolt::rialto::GetKeyStoreHashRequest *request,
     418              :                                              ::firebolt::rialto::GetKeyStoreHashResponse *response,
     419              :                                              ::google::protobuf::Closure *done)
     420              : {
     421            2 :     std::vector<unsigned char> keyStoreHash;
     422            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     423              : 
     424            2 :     MediaKeyErrorStatus status = m_cdmService.getKeyStoreHash(request->media_keys_handle(), keyStoreHash);
     425            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     426            2 :     for (const auto &item : keyStoreHash)
     427              :     {
     428            0 :         response->add_key_store_hash(item);
     429              :     }
     430            2 :     done->Run();
     431              : }
     432              : 
     433            2 : void MediaKeysModuleService::getLdlSessionsLimit(::google::protobuf::RpcController *controller,
     434              :                                                  const ::firebolt::rialto::GetLdlSessionsLimitRequest *request,
     435              :                                                  ::firebolt::rialto::GetLdlSessionsLimitResponse *response,
     436              :                                                  ::google::protobuf::Closure *done)
     437              : {
     438            2 :     uint32_t ldlLimit{0};
     439            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     440              : 
     441            2 :     MediaKeyErrorStatus status = m_cdmService.getLdlSessionsLimit(request->media_keys_handle(), ldlLimit);
     442            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     443            2 :     response->set_ldl_limit(ldlLimit);
     444            2 :     done->Run();
     445              : }
     446              : 
     447            2 : void MediaKeysModuleService::getLastDrmError(::google::protobuf::RpcController *controller,
     448              :                                              const ::firebolt::rialto::GetLastDrmErrorRequest *request,
     449              :                                              ::firebolt::rialto::GetLastDrmErrorResponse *response,
     450              :                                              ::google::protobuf::Closure *done)
     451              : {
     452            2 :     uint32_t errorCode{0};
     453            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     454              : 
     455              :     MediaKeyErrorStatus status =
     456            2 :         m_cdmService.getLastDrmError(request->media_keys_handle(), request->key_session_id(), errorCode);
     457            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     458            2 :     response->set_error_code(errorCode);
     459            2 :     done->Run();
     460              : }
     461              : 
     462            2 : void MediaKeysModuleService::getDrmTime(::google::protobuf::RpcController *controller,
     463              :                                         const ::firebolt::rialto::GetDrmTimeRequest *request,
     464              :                                         ::firebolt::rialto::GetDrmTimeResponse *response,
     465              :                                         ::google::protobuf::Closure *done)
     466              : {
     467            2 :     uint64_t drmTime{0};
     468            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     469              : 
     470            2 :     MediaKeyErrorStatus status = m_cdmService.getDrmTime(request->media_keys_handle(), drmTime);
     471            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     472            2 :     response->set_drm_time(drmTime);
     473            2 :     done->Run();
     474              : }
     475              : 
     476            2 : void MediaKeysModuleService::getCdmKeySessionId(::google::protobuf::RpcController *controller,
     477              :                                                 const ::firebolt::rialto::GetCdmKeySessionIdRequest *request,
     478              :                                                 ::firebolt::rialto::GetCdmKeySessionIdResponse *response,
     479              :                                                 ::google::protobuf::Closure *done)
     480              : {
     481            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     482              : 
     483            2 :     std::string cdmKeySessionId;
     484              :     MediaKeyErrorStatus status =
     485            2 :         m_cdmService.getCdmKeySessionId(request->media_keys_handle(), request->key_session_id(), cdmKeySessionId);
     486            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     487              :     response->set_cdm_key_session_id(cdmKeySessionId);
     488            2 :     done->Run();
     489              : }
     490              : 
     491            2 : void MediaKeysModuleService::releaseKeySession(::google::protobuf::RpcController *controller,
     492              :                                                const ::firebolt::rialto::ReleaseKeySessionRequest *request,
     493              :                                                ::firebolt::rialto::ReleaseKeySessionResponse *response,
     494              :                                                ::google::protobuf::Closure *done)
     495              : {
     496            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     497              : 
     498            2 :     MediaKeyErrorStatus status = m_cdmService.releaseKeySession(request->media_keys_handle(), request->key_session_id());
     499            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     500            2 :     done->Run();
     501              : }
     502              : 
     503            2 : void MediaKeysModuleService::getMetricSystemData(::google::protobuf::RpcController *controller,
     504              :                                                  const ::firebolt::rialto::GetMetricSystemDataRequest *request,
     505              :                                                  ::firebolt::rialto::GetMetricSystemDataResponse *response,
     506              :                                                  ::google::protobuf::Closure *done)
     507              : {
     508            2 :     std::vector<uint8_t> buffer;
     509            2 :     RIALTO_SERVER_LOG_DEBUG("entry:");
     510              : 
     511            2 :     MediaKeyErrorStatus status = m_cdmService.getMetricSystemData(request->media_keys_handle(), buffer);
     512            2 :     response->set_error_status(convertMediaKeyErrorStatus(status));
     513            2 :     for (const auto &buf : buffer)
     514              :     {
     515            0 :         response->add_buffer(buf);
     516              :     }
     517            2 :     done->Run();
     518              : }
     519              : 
     520              : } // namespace firebolt::rialto::server::ipc
        

Generated by: LCOV version 2.0-1