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

Generated by: LCOV version 2.0-1