LCOV - code coverage report
Current view: top level - media/client/ipc/source - MediaKeysIpc.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 83.0 % 513 426
Test Date: 2026-11-10 16:58:19 Functions: 91.9 % 37 34

            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 "MediaKeysIpc.h"
      21              : #include "RialtoClientLogging.h"
      22              : 
      23              : namespace
      24              : {
      25              : firebolt::rialto::MediaKeyErrorStatus
      26           67 : convertMediaKeyErrorStatus(const firebolt::rialto::ProtoMediaKeyErrorStatus &errorStatus)
      27              : {
      28           67 :     switch (errorStatus)
      29              :     {
      30           50 :     case firebolt::rialto::ProtoMediaKeyErrorStatus::OK:
      31              :     {
      32           50 :         return firebolt::rialto::MediaKeyErrorStatus::OK;
      33              :     }
      34           17 :     case firebolt::rialto::ProtoMediaKeyErrorStatus::BAD_SESSION_ID:
      35              :     {
      36           17 :         return firebolt::rialto::MediaKeyErrorStatus::BAD_SESSION_ID;
      37              :     }
      38            0 :     case firebolt::rialto::ProtoMediaKeyErrorStatus::INTERFACE_NOT_IMPLEMENTED:
      39              :     {
      40            0 :         return firebolt::rialto::MediaKeyErrorStatus::INTERFACE_NOT_IMPLEMENTED;
      41              :     }
      42            0 :     case firebolt::rialto::ProtoMediaKeyErrorStatus::BUFFER_TOO_SMALL:
      43              :     {
      44            0 :         return firebolt::rialto::MediaKeyErrorStatus::BUFFER_TOO_SMALL;
      45              :     }
      46            0 :     case firebolt::rialto::ProtoMediaKeyErrorStatus::NOT_SUPPORTED:
      47              :     {
      48            0 :         return firebolt::rialto::MediaKeyErrorStatus::NOT_SUPPORTED;
      49              :     }
      50            0 :     case firebolt::rialto::ProtoMediaKeyErrorStatus::INVALID_STATE:
      51              :     {
      52            0 :         return firebolt::rialto::MediaKeyErrorStatus::INVALID_STATE;
      53              :     }
      54            0 :     case firebolt::rialto::ProtoMediaKeyErrorStatus::FAIL:
      55              :     {
      56            0 :         return firebolt::rialto::MediaKeyErrorStatus::FAIL;
      57              :     }
      58            0 :     case firebolt::rialto::ProtoMediaKeyErrorStatus::OUTPUT_RESTRICTED:
      59              :     {
      60            0 :         return firebolt::rialto::MediaKeyErrorStatus::OUTPUT_RESTRICTED;
      61              :     }
      62              :     }
      63            0 :     return firebolt::rialto::MediaKeyErrorStatus::FAIL;
      64              : }
      65              : 
      66            3 : firebolt::rialto::KeyStatus convertKeyStatus(const firebolt::rialto::KeyStatusesChangedEvent_KeyStatus &protoKeyStatus)
      67              : {
      68            3 :     switch (protoKeyStatus)
      69              :     {
      70            1 :     case firebolt::rialto::KeyStatusesChangedEvent_KeyStatus_USABLE:
      71              :     {
      72            1 :         return firebolt::rialto::KeyStatus::USABLE;
      73              :     }
      74            1 :     case firebolt::rialto::KeyStatusesChangedEvent_KeyStatus_EXPIRED:
      75              :     {
      76            1 :         return firebolt::rialto::KeyStatus::EXPIRED;
      77              :     }
      78            1 :     case firebolt::rialto::KeyStatusesChangedEvent_KeyStatus_OUTPUT_RESTRICTED:
      79              :     {
      80            1 :         return firebolt::rialto::KeyStatus::OUTPUT_RESTRICTED;
      81              :     }
      82            0 :     case firebolt::rialto::KeyStatusesChangedEvent_KeyStatus_PENDING:
      83              :     {
      84            0 :         return firebolt::rialto::KeyStatus::PENDING;
      85              :     }
      86            0 :     case firebolt::rialto::KeyStatusesChangedEvent_KeyStatus_INTERNAL_ERROR:
      87              :     {
      88            0 :         return firebolt::rialto::KeyStatus::INTERNAL_ERROR;
      89              :     }
      90            0 :     case firebolt::rialto::KeyStatusesChangedEvent_KeyStatus_RELEASED:
      91              :     {
      92            0 :         return firebolt::rialto::KeyStatus::RELEASED;
      93              :     }
      94              :     }
      95            0 :     return firebolt::rialto::KeyStatus::INTERNAL_ERROR;
      96              : }
      97              : 
      98           17 : const char *toString(const firebolt::rialto::MediaKeyErrorStatus &errorStatus)
      99              : {
     100           17 :     switch (errorStatus)
     101              :     {
     102            0 :     case firebolt::rialto::MediaKeyErrorStatus::OK:
     103              :     {
     104            0 :         return "OK";
     105              :     }
     106           17 :     case firebolt::rialto::MediaKeyErrorStatus::BAD_SESSION_ID:
     107              :     {
     108           17 :         return "BAD_SESSION_ID";
     109              :     }
     110            0 :     case firebolt::rialto::MediaKeyErrorStatus::INTERFACE_NOT_IMPLEMENTED:
     111              :     {
     112            0 :         return "INTERFACE_NOT_IMPLEMENTED";
     113              :     }
     114            0 :     case firebolt::rialto::MediaKeyErrorStatus::BUFFER_TOO_SMALL:
     115              :     {
     116            0 :         return "BUFFER_TOO_SMALL";
     117              :     }
     118            0 :     case firebolt::rialto::MediaKeyErrorStatus::NOT_SUPPORTED:
     119              :     {
     120            0 :         return "NOT_SUPPORTED";
     121              :     }
     122            0 :     case firebolt::rialto::MediaKeyErrorStatus::INVALID_STATE:
     123              :     {
     124            0 :         return "INVALID_STATE";
     125              :     }
     126            0 :     case firebolt::rialto::MediaKeyErrorStatus::FAIL:
     127              :     {
     128            0 :         return "FAIL";
     129              :     }
     130            0 :     case firebolt::rialto::MediaKeyErrorStatus::OUTPUT_RESTRICTED:
     131              :     {
     132            0 :         return "OUTPUT_RESTRICTED";
     133              :     }
     134              :     }
     135            0 :     return "UNKNOWN";
     136              : }
     137              : } // namespace
     138              : 
     139              : namespace firebolt::rialto::client
     140              : {
     141            0 : std::shared_ptr<IMediaKeysIpcFactory> IMediaKeysIpcFactory::createFactory()
     142              : {
     143            0 :     std::shared_ptr<IMediaKeysIpcFactory> factory;
     144              : 
     145              :     try
     146              :     {
     147            0 :         factory = std::make_shared<MediaKeysIpcFactory>();
     148              :     }
     149            0 :     catch (const std::exception &e)
     150              :     {
     151            0 :         RIALTO_CLIENT_LOG_ERROR("Failed to create the media keys ipc factory, reason: %s", e.what());
     152              :     }
     153              : 
     154            0 :     return factory;
     155              : }
     156              : 
     157            0 : std::unique_ptr<IMediaKeys> MediaKeysIpcFactory::createMediaKeysIpc(const std::string &keySystem) const
     158              : {
     159            0 :     std::unique_ptr<IMediaKeys> mediaKeysIpc;
     160              :     try
     161              :     {
     162              :         mediaKeysIpc =
     163            0 :             std::make_unique<client::MediaKeysIpc>(keySystem, IIpcClientAccessor::instance().getIpcClient(),
     164            0 :                                                    firebolt::rialto::common::IEventThreadFactory::createFactory());
     165              :     }
     166            0 :     catch (const std::exception &e)
     167              :     {
     168            0 :         RIALTO_CLIENT_LOG_ERROR("Failed to create the media keys ipc, reason: %s", e.what());
     169              :     }
     170              : 
     171            0 :     return mediaKeysIpc;
     172              : }
     173              : 
     174          106 : MediaKeysIpc::MediaKeysIpc(const std::string &keySystem, IIpcClient &ipcClient,
     175          106 :                            const std::shared_ptr<common::IEventThreadFactory> &eventThreadFactory)
     176          318 :     : IpcModule(ipcClient), m_eventThread(eventThreadFactory->createEventThread("rialto-media-keys-events"))
     177              : {
     178          106 :     RIALTO_CLIENT_LOG_DEBUG("entry:");
     179              : 
     180          106 :     if (!attachChannel())
     181              :     {
     182            3 :         throw std::runtime_error("Failed attach to the ipc channel");
     183              :     }
     184              : 
     185          103 :     if (!createMediaKeys(keySystem))
     186              :     {
     187            1 :         detachChannel();
     188            1 :         throw std::runtime_error("Could not create the media keys instance");
     189              :     }
     190          122 : }
     191              : 
     192          204 : MediaKeysIpc::~MediaKeysIpc()
     193              : {
     194          102 :     RIALTO_CLIENT_LOG_DEBUG("entry:");
     195              : 
     196          102 :     destroyMediaKeys();
     197              : 
     198          102 :     detachChannel();
     199              : 
     200          102 :     m_eventThread.reset();
     201          204 : }
     202              : 
     203          140 : bool MediaKeysIpc::createRpcStubs(const std::shared_ptr<ipc::IChannel> &ipcChannel)
     204              : {
     205          140 :     m_mediaKeysStub = std::make_unique<::firebolt::rialto::MediaKeysModule_Stub>(ipcChannel.get());
     206          140 :     if (!m_mediaKeysStub)
     207              :     {
     208            0 :         return false;
     209              :     }
     210          140 :     return true;
     211              : }
     212              : 
     213          140 : bool MediaKeysIpc::subscribeToEvents(const std::shared_ptr<ipc::IChannel> &ipcChannel)
     214              : {
     215          140 :     if (!ipcChannel)
     216              :     {
     217            0 :         return false;
     218              :     }
     219              : 
     220          280 :     int eventTag = ipcChannel->subscribe<firebolt::rialto::LicenseRequestEvent>(
     221          140 :         [this](const std::shared_ptr<firebolt::rialto::LicenseRequestEvent> &event)
     222          143 :         { m_eventThread->add(&MediaKeysIpc::onLicenseRequest, this, event); });
     223          140 :     if (eventTag < 0)
     224            0 :         return false;
     225          140 :     m_eventTags.push_back(eventTag);
     226              : 
     227          280 :     eventTag = ipcChannel->subscribe<firebolt::rialto::LicenseRenewalEvent>(
     228          140 :         [this](const std::shared_ptr<firebolt::rialto::LicenseRenewalEvent> &event)
     229            6 :         { m_eventThread->add(&MediaKeysIpc::onLicenseRenewal, this, event); });
     230          140 :     if (eventTag < 0)
     231            1 :         return false;
     232          139 :     m_eventTags.push_back(eventTag);
     233              : 
     234          278 :     eventTag = ipcChannel->subscribe<firebolt::rialto::KeyStatusesChangedEvent>(
     235          139 :         [this](const std::shared_ptr<firebolt::rialto::KeyStatusesChangedEvent> &event)
     236            3 :         { m_eventThread->add(&MediaKeysIpc::onKeyStatusesChanged, this, event); });
     237          139 :     if (eventTag < 0)
     238            0 :         return false;
     239          139 :     m_eventTags.push_back(eventTag);
     240              : 
     241          139 :     return true;
     242              : }
     243              : 
     244          103 : bool MediaKeysIpc::createMediaKeys(const std::string &keySystem)
     245              : {
     246          103 :     if (!reattachChannelIfRequired())
     247              :     {
     248            0 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     249            0 :         return false;
     250              :     }
     251              : 
     252          103 :     firebolt::rialto::CreateMediaKeysRequest request;
     253              : 
     254              :     request.set_key_system(keySystem);
     255              : 
     256          103 :     firebolt::rialto::CreateMediaKeysResponse response;
     257          103 :     auto ipcController = m_ipc.createRpcController();
     258          103 :     auto blockingClosure = m_ipc.createBlockingClosure();
     259          103 :     m_mediaKeysStub->createMediaKeys(ipcController.get(), &request, &response, blockingClosure.get());
     260              : 
     261              :     // wait for the call to complete
     262          103 :     blockingClosure->wait();
     263              : 
     264              :     // check the result
     265          103 :     if (ipcController->Failed())
     266              :     {
     267            1 :         RIALTO_CLIENT_LOG_ERROR("failed to create media keys due to '%s'", ipcController->ErrorText().c_str());
     268            1 :         return false;
     269              :     }
     270              : 
     271          102 :     m_mediaKeysHandle = response.media_keys_handle();
     272              : 
     273          102 :     return true;
     274          103 : }
     275              : 
     276          102 : void MediaKeysIpc::destroyMediaKeys()
     277              : {
     278          102 :     if (!reattachChannelIfRequired())
     279              :     {
     280            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     281            1 :         return;
     282              :     }
     283              : 
     284          101 :     firebolt::rialto::DestroyMediaKeysRequest request;
     285          101 :     request.set_media_keys_handle(m_mediaKeysHandle);
     286              : 
     287          101 :     firebolt::rialto::DestroyMediaKeysResponse response;
     288          101 :     auto ipcController = m_ipc.createRpcController();
     289          101 :     auto blockingClosure = m_ipc.createBlockingClosure();
     290          101 :     m_mediaKeysStub->destroyMediaKeys(ipcController.get(), &request, &response, blockingClosure.get());
     291              : 
     292              :     // wait for the call to complete
     293          101 :     blockingClosure->wait();
     294              : 
     295              :     // check the result
     296          101 :     if (ipcController->Failed())
     297              :     {
     298            1 :         RIALTO_CLIENT_LOG_ERROR("failed to destroy media keys due to '%s'", ipcController->ErrorText().c_str());
     299              :     }
     300          101 : }
     301              : 
     302            0 : MediaKeyErrorStatus MediaKeysIpc::selectKeyId(int32_t keySessionId, const std::vector<uint8_t> &keyId)
     303              : {
     304            0 :     RIALTO_CLIENT_LOG_ERROR("Not Implemented");
     305            0 :     return MediaKeyErrorStatus::FAIL;
     306              : }
     307              : 
     308            5 : bool MediaKeysIpc::containsKey(int32_t keySessionId, const std::vector<uint8_t> &keyId)
     309              : {
     310            5 :     if (!reattachChannelIfRequired())
     311              :     {
     312            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     313            1 :         return false;
     314              :     }
     315              : 
     316            4 :     firebolt::rialto::ContainsKeyRequest request;
     317            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     318            4 :     request.set_key_session_id(keySessionId);
     319           16 :     for (const auto &keyIdItem : keyId)
     320              :     {
     321           12 :         request.add_key_id(keyIdItem);
     322              :     }
     323              : 
     324            4 :     firebolt::rialto::ContainsKeyResponse response;
     325              :     // Default return value to false
     326            4 :     response.set_contains_key(false);
     327              : 
     328            4 :     auto ipcController = m_ipc.createRpcController();
     329            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     330            4 :     m_mediaKeysStub->containsKey(ipcController.get(), &request, &response, blockingClosure.get());
     331              : 
     332              :     // wait for the call to complete
     333            4 :     blockingClosure->wait();
     334              : 
     335            4 :     if (ipcController->Failed())
     336              :     {
     337            1 :         RIALTO_CLIENT_LOG_ERROR("containsKey failed due to '%s'", ipcController->ErrorText().c_str());
     338            1 :         return false;
     339              :     }
     340              : 
     341            3 :     return response.contains_key();
     342            4 : }
     343              : 
     344           21 : MediaKeyErrorStatus MediaKeysIpc::createKeySession(KeySessionType sessionType, std::weak_ptr<IMediaKeysClient> client,
     345              :                                                    int32_t &keySessionId)
     346              : {
     347           21 :     if (!reattachChannelIfRequired())
     348              :     {
     349            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     350            1 :         return MediaKeyErrorStatus::FAIL;
     351              :     }
     352              : 
     353           20 :     CreateKeySessionRequest_KeySessionType protoSessionType = CreateKeySessionRequest_KeySessionType_UNKNOWN;
     354           20 :     switch (sessionType)
     355              :     {
     356            0 :     case KeySessionType::TEMPORARY:
     357            0 :         protoSessionType = CreateKeySessionRequest_KeySessionType_TEMPORARY;
     358            0 :         break;
     359           20 :     case KeySessionType::PERSISTENT_LICENCE:
     360           20 :         protoSessionType = CreateKeySessionRequest_KeySessionType_PERSISTENT_LICENCE;
     361           20 :         break;
     362            0 :     case KeySessionType::PERSISTENT_RELEASE_MESSAGE:
     363            0 :         protoSessionType = CreateKeySessionRequest_KeySessionType_PERSISTENT_RELEASE_MESSAGE;
     364            0 :         break;
     365            0 :     default:
     366            0 :         RIALTO_CLIENT_LOG_WARN("Recieved unknown key session type");
     367            0 :         break;
     368              :     }
     369              : 
     370           40 :     firebolt::rialto::CreateKeySessionRequest request;
     371           20 :     request.set_media_keys_handle(m_mediaKeysHandle);
     372           20 :     request.set_session_type(protoSessionType);
     373              : 
     374           40 :     firebolt::rialto::CreateKeySessionResponse response;
     375              :     // Default error status to FAIL
     376           20 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     377              : 
     378           40 :     auto ipcController = m_ipc.createRpcController();
     379           20 :     auto blockingClosure = m_ipc.createBlockingClosure();
     380           20 :     m_mediaKeysStub->createKeySession(ipcController.get(), &request, &response, blockingClosure.get());
     381              : 
     382              :     // wait for the call to complete
     383           20 :     blockingClosure->wait();
     384              : 
     385              :     MediaKeyErrorStatus status =
     386           40 :         getMediaKeyErrorStatusFromResponse("createKeySession", ipcController, response.error_status());
     387           20 :     if (MediaKeyErrorStatus::OK == status)
     388              :     {
     389           18 :         keySessionId = response.key_session_id();
     390           18 :         m_mediaKeysIpcClient = client;
     391              :     }
     392              : 
     393           20 :     return status;
     394              : }
     395              : 
     396            5 : MediaKeyErrorStatus MediaKeysIpc::generateRequest(int32_t keySessionId, InitDataType initDataType,
     397              :                                                   const std::vector<uint8_t> &initData,
     398              :                                                   const LimitedDurationLicense &ldlState)
     399              : {
     400            5 :     if (!reattachChannelIfRequired())
     401              :     {
     402            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     403            1 :         return MediaKeyErrorStatus::FAIL;
     404              :     }
     405              : 
     406            4 :     GenerateRequestRequest_InitDataType protoInitDataType = GenerateRequestRequest_InitDataType_UNKNOWN;
     407            4 :     switch (initDataType)
     408              :     {
     409            0 :     case InitDataType::CENC:
     410            0 :         protoInitDataType = GenerateRequestRequest_InitDataType_CENC;
     411            0 :         break;
     412            4 :     case InitDataType::KEY_IDS:
     413            4 :         protoInitDataType = GenerateRequestRequest_InitDataType_KEY_IDS;
     414            4 :         break;
     415            0 :     case InitDataType::WEBM:
     416            0 :         protoInitDataType = GenerateRequestRequest_InitDataType_WEBM;
     417            0 :         break;
     418            0 :     case InitDataType::DRMHEADER:
     419            0 :         protoInitDataType = GenerateRequestRequest_InitDataType_DRMHEADER;
     420            0 :         break;
     421            0 :     default:
     422            0 :         RIALTO_CLIENT_LOG_WARN("Recieved unknown init data type");
     423            0 :         break;
     424              :     }
     425              : 
     426            4 :     GenerateRequestRequest_LimitedDurationLicense protoLimitedDurationLicense{
     427              :         GenerateRequestRequest_LimitedDurationLicense_NOT_SPECIFIED};
     428            4 :     switch (ldlState)
     429              :     {
     430            4 :     case LimitedDurationLicense::NOT_SPECIFIED:
     431            4 :         protoLimitedDurationLicense = GenerateRequestRequest_LimitedDurationLicense_NOT_SPECIFIED;
     432            4 :         break;
     433            0 :     case LimitedDurationLicense::ENABLED:
     434            0 :         protoLimitedDurationLicense = GenerateRequestRequest_LimitedDurationLicense_ENABLED;
     435            0 :         break;
     436            0 :     case LimitedDurationLicense::DISABLED:
     437            0 :         protoLimitedDurationLicense = GenerateRequestRequest_LimitedDurationLicense_DISABLED;
     438            0 :         break;
     439            0 :     default:
     440            0 :         RIALTO_CLIENT_LOG_WARN("Received unknown limited duration license state");
     441            0 :         break;
     442              :     }
     443              : 
     444            8 :     firebolt::rialto::GenerateRequestRequest request;
     445            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     446            4 :     request.set_key_session_id(keySessionId);
     447            4 :     request.set_init_data_type(protoInitDataType);
     448            4 :     request.set_ldl_state(protoLimitedDurationLicense);
     449              : 
     450           16 :     for (auto it = initData.begin(); it != initData.end(); it++)
     451              :     {
     452           12 :         request.add_init_data(*it);
     453              :     }
     454              : 
     455            8 :     firebolt::rialto::GenerateRequestResponse response;
     456              :     // Default error status to FAIL
     457            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     458              : 
     459            8 :     auto ipcController = m_ipc.createRpcController();
     460            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     461            4 :     m_mediaKeysStub->generateRequest(ipcController.get(), &request, &response, blockingClosure.get());
     462              : 
     463              :     // wait for the call to complete
     464            4 :     blockingClosure->wait();
     465              : 
     466           12 :     return getMediaKeyErrorStatusFromResponse("generateRequest", ipcController, response.error_status());
     467              : }
     468              : 
     469            5 : MediaKeyErrorStatus MediaKeysIpc::loadSession(int32_t keySessionId, const std::string &cdmKeySessionId)
     470              : {
     471            5 :     if (!reattachChannelIfRequired())
     472              :     {
     473            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     474            1 :         return MediaKeyErrorStatus::FAIL;
     475              :     }
     476              : 
     477            4 :     firebolt::rialto::LoadSessionRequest request;
     478            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     479            4 :     request.set_key_session_id(keySessionId);
     480              :     request.set_cdm_key_session_id(cdmKeySessionId);
     481              : 
     482            4 :     firebolt::rialto::LoadSessionResponse response;
     483              :     // Default error status to FAIL
     484            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     485              : 
     486            4 :     auto ipcController = m_ipc.createRpcController();
     487            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     488            4 :     m_mediaKeysStub->loadSession(ipcController.get(), &request, &response, blockingClosure.get());
     489              : 
     490              :     // wait for the call to complete
     491            4 :     blockingClosure->wait();
     492              : 
     493            8 :     return getMediaKeyErrorStatusFromResponse("loadSession", ipcController, response.error_status());
     494            4 : }
     495              : 
     496            5 : MediaKeyErrorStatus MediaKeysIpc::updateSession(int32_t keySessionId, const std::vector<uint8_t> &responseData)
     497              : {
     498            5 :     if (!reattachChannelIfRequired())
     499              :     {
     500            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     501            1 :         return MediaKeyErrorStatus::FAIL;
     502              :     }
     503              : 
     504            4 :     firebolt::rialto::UpdateSessionRequest request;
     505            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     506            4 :     request.set_key_session_id(keySessionId);
     507              : 
     508           16 :     for (auto it = responseData.begin(); it != responseData.end(); it++)
     509              :     {
     510           12 :         request.add_response_data(*it);
     511              :     }
     512              : 
     513            4 :     firebolt::rialto::UpdateSessionResponse response;
     514              :     // Default error status to FAIL
     515            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     516              : 
     517            4 :     auto ipcController = m_ipc.createRpcController();
     518            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     519            4 :     m_mediaKeysStub->updateSession(ipcController.get(), &request, &response, blockingClosure.get());
     520              : 
     521              :     // wait for the call to complete
     522            4 :     blockingClosure->wait();
     523              : 
     524            8 :     return getMediaKeyErrorStatusFromResponse("updateSession", ipcController, response.error_status());
     525            4 : }
     526              : 
     527            5 : MediaKeyErrorStatus MediaKeysIpc::setDrmHeader(int32_t keySessionId, const std::vector<uint8_t> &requestData)
     528              : {
     529            5 :     if (!reattachChannelIfRequired())
     530              :     {
     531            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     532            1 :         return MediaKeyErrorStatus::FAIL;
     533              :     }
     534              : 
     535            4 :     firebolt::rialto::SetDrmHeaderRequest request;
     536            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     537            4 :     request.set_key_session_id(keySessionId);
     538           16 :     for (const auto &requestDataItem : requestData)
     539              :     {
     540           12 :         request.add_request_data(requestDataItem);
     541              :     }
     542              : 
     543            4 :     firebolt::rialto::SetDrmHeaderResponse response;
     544              :     // Default error status to FAIL
     545            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     546              : 
     547            4 :     auto ipcController = m_ipc.createRpcController();
     548            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     549            4 :     m_mediaKeysStub->setDrmHeader(ipcController.get(), &request, &response, blockingClosure.get());
     550              : 
     551              :     // wait for the call to complete
     552            4 :     blockingClosure->wait();
     553              : 
     554            8 :     return getMediaKeyErrorStatusFromResponse("setDrmHeader", ipcController, response.error_status());
     555            4 : }
     556              : 
     557            5 : MediaKeyErrorStatus MediaKeysIpc::closeKeySession(int32_t keySessionId)
     558              : {
     559            5 :     if (!reattachChannelIfRequired())
     560              :     {
     561            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     562            1 :         return MediaKeyErrorStatus::FAIL;
     563              :     }
     564              : 
     565              :     // Reset client
     566            4 :     m_mediaKeysIpcClient.reset();
     567              : 
     568            4 :     firebolt::rialto::CloseKeySessionRequest request;
     569            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     570            4 :     request.set_key_session_id(keySessionId);
     571              : 
     572            4 :     firebolt::rialto::CloseKeySessionResponse response;
     573              :     // Default error status to FAIL
     574            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     575              : 
     576            4 :     auto ipcController = m_ipc.createRpcController();
     577            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     578            4 :     m_mediaKeysStub->closeKeySession(ipcController.get(), &request, &response, blockingClosure.get());
     579              : 
     580              :     // wait for the call to complete
     581            4 :     blockingClosure->wait();
     582              : 
     583            8 :     return getMediaKeyErrorStatusFromResponse("closeKeySession", ipcController, response.error_status());
     584            4 : }
     585              : 
     586            5 : MediaKeyErrorStatus MediaKeysIpc::removeKeySession(int32_t keySessionId)
     587              : {
     588            5 :     if (!reattachChannelIfRequired())
     589              :     {
     590            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     591            1 :         return MediaKeyErrorStatus::FAIL;
     592              :     }
     593              : 
     594            4 :     firebolt::rialto::RemoveKeySessionRequest request;
     595            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     596            4 :     request.set_key_session_id(keySessionId);
     597              : 
     598            4 :     firebolt::rialto::RemoveKeySessionResponse response;
     599              :     // Default error status to FAIL
     600            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     601              : 
     602            4 :     auto ipcController = m_ipc.createRpcController();
     603            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     604            4 :     m_mediaKeysStub->removeKeySession(ipcController.get(), &request, &response, blockingClosure.get());
     605              : 
     606              :     // wait for the call to complete
     607            4 :     blockingClosure->wait();
     608              : 
     609            8 :     return getMediaKeyErrorStatusFromResponse("removeKeySession", ipcController, response.error_status());
     610            4 : }
     611              : 
     612            5 : MediaKeyErrorStatus MediaKeysIpc::deleteDrmStore()
     613              : {
     614            5 :     if (!reattachChannelIfRequired())
     615              :     {
     616            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     617            1 :         return MediaKeyErrorStatus::FAIL;
     618              :     }
     619              : 
     620            4 :     firebolt::rialto::DeleteDrmStoreRequest request;
     621            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     622              : 
     623            4 :     firebolt::rialto::DeleteDrmStoreResponse response;
     624              :     // Default error status to FAIL
     625            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     626              : 
     627            4 :     auto ipcController = m_ipc.createRpcController();
     628            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     629            4 :     m_mediaKeysStub->deleteDrmStore(ipcController.get(), &request, &response, blockingClosure.get());
     630              : 
     631              :     // wait for the call to complete
     632            4 :     blockingClosure->wait();
     633              : 
     634            8 :     return getMediaKeyErrorStatusFromResponse("deleteDrmStore", ipcController, response.error_status());
     635            4 : }
     636              : 
     637            5 : MediaKeyErrorStatus MediaKeysIpc::deleteKeyStore()
     638              : {
     639            5 :     if (!reattachChannelIfRequired())
     640              :     {
     641            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     642            1 :         return MediaKeyErrorStatus::FAIL;
     643              :     }
     644              : 
     645            4 :     firebolt::rialto::DeleteKeyStoreRequest request;
     646            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     647              : 
     648            4 :     firebolt::rialto::DeleteKeyStoreResponse response;
     649              :     // Default error status to FAIL
     650            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     651              : 
     652            4 :     auto ipcController = m_ipc.createRpcController();
     653            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     654            4 :     m_mediaKeysStub->deleteKeyStore(ipcController.get(), &request, &response, blockingClosure.get());
     655              : 
     656              :     // wait for the call to complete
     657            4 :     blockingClosure->wait();
     658              : 
     659            8 :     return getMediaKeyErrorStatusFromResponse("deleteKeyStore", ipcController, response.error_status());
     660            4 : }
     661              : 
     662            5 : MediaKeyErrorStatus MediaKeysIpc::getDrmStoreHash(std::vector<unsigned char> &drmStoreHash)
     663              : {
     664            5 :     if (!reattachChannelIfRequired())
     665              :     {
     666            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     667            1 :         return MediaKeyErrorStatus::FAIL;
     668              :     }
     669              : 
     670            4 :     firebolt::rialto::GetDrmStoreHashRequest request;
     671            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     672              : 
     673            4 :     firebolt::rialto::GetDrmStoreHashResponse response;
     674              :     // Default error status to FAIL
     675            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     676              : 
     677            4 :     auto ipcController = m_ipc.createRpcController();
     678            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     679            4 :     m_mediaKeysStub->getDrmStoreHash(ipcController.get(), &request, &response, blockingClosure.get());
     680              : 
     681              :     // wait for the call to complete
     682            4 :     blockingClosure->wait();
     683              : 
     684            4 :     if (ProtoMediaKeyErrorStatus::OK == response.error_status())
     685              :     {
     686            4 :         drmStoreHash = std::vector<unsigned char>(response.drm_store_hash().begin(), response.drm_store_hash().end());
     687              :     }
     688              : 
     689            8 :     return getMediaKeyErrorStatusFromResponse("getDrmStoreHash", ipcController, response.error_status());
     690            4 : }
     691              : 
     692            5 : MediaKeyErrorStatus MediaKeysIpc::getKeyStoreHash(std::vector<unsigned char> &keyStoreHash)
     693              : {
     694            5 :     if (!reattachChannelIfRequired())
     695              :     {
     696            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     697            1 :         return MediaKeyErrorStatus::FAIL;
     698              :     }
     699              : 
     700            4 :     firebolt::rialto::GetKeyStoreHashRequest request;
     701            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     702              : 
     703            4 :     firebolt::rialto::GetKeyStoreHashResponse response;
     704              :     // Default error status to FAIL
     705            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     706              : 
     707            4 :     auto ipcController = m_ipc.createRpcController();
     708            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     709            4 :     m_mediaKeysStub->getKeyStoreHash(ipcController.get(), &request, &response, blockingClosure.get());
     710              : 
     711              :     // wait for the call to complete
     712            4 :     blockingClosure->wait();
     713              : 
     714            4 :     if (ProtoMediaKeyErrorStatus::OK == response.error_status())
     715              :     {
     716            4 :         keyStoreHash = std::vector<unsigned char>(response.key_store_hash().begin(), response.key_store_hash().end());
     717              :     }
     718              : 
     719            8 :     return getMediaKeyErrorStatusFromResponse("getKeyStoreHash", ipcController, response.error_status());
     720            4 : }
     721              : 
     722            5 : MediaKeyErrorStatus MediaKeysIpc::getLdlSessionsLimit(uint32_t &ldlLimit)
     723              : {
     724            5 :     if (!reattachChannelIfRequired())
     725              :     {
     726            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     727            1 :         return MediaKeyErrorStatus::FAIL;
     728              :     }
     729              : 
     730            4 :     firebolt::rialto::GetLdlSessionsLimitRequest request;
     731            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     732              : 
     733            4 :     firebolt::rialto::GetLdlSessionsLimitResponse response;
     734              :     // Default error status to FAIL
     735            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     736              : 
     737            4 :     auto ipcController = m_ipc.createRpcController();
     738            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     739            4 :     m_mediaKeysStub->getLdlSessionsLimit(ipcController.get(), &request, &response, blockingClosure.get());
     740              : 
     741              :     // wait for the call to complete
     742            4 :     blockingClosure->wait();
     743              : 
     744            4 :     if (ProtoMediaKeyErrorStatus::OK == response.error_status())
     745              :     {
     746            2 :         ldlLimit = response.ldl_limit();
     747              :     }
     748              : 
     749            8 :     return getMediaKeyErrorStatusFromResponse("getLdlSessionsLimit", ipcController, response.error_status());
     750            4 : }
     751              : 
     752            5 : MediaKeyErrorStatus MediaKeysIpc::getLastDrmError(int32_t keySessionId, uint32_t &errorCode)
     753              : {
     754            5 :     if (!reattachChannelIfRequired())
     755              :     {
     756            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     757            1 :         return MediaKeyErrorStatus::FAIL;
     758              :     }
     759              : 
     760            4 :     firebolt::rialto::GetLastDrmErrorRequest request;
     761            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     762            4 :     request.set_key_session_id(keySessionId);
     763              : 
     764            4 :     firebolt::rialto::GetLastDrmErrorResponse response;
     765              :     // Default error status to FAIL
     766            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     767              : 
     768            4 :     auto ipcController = m_ipc.createRpcController();
     769            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     770            4 :     m_mediaKeysStub->getLastDrmError(ipcController.get(), &request, &response, blockingClosure.get());
     771              : 
     772              :     // wait for the call to complete
     773            4 :     blockingClosure->wait();
     774              : 
     775            4 :     if (ProtoMediaKeyErrorStatus::OK == response.error_status())
     776              :     {
     777            2 :         errorCode = response.error_code();
     778              :     }
     779              : 
     780            8 :     return getMediaKeyErrorStatusFromResponse("getLastDrmError", ipcController, response.error_status());
     781            4 : }
     782              : 
     783            5 : MediaKeyErrorStatus MediaKeysIpc::getDrmTime(uint64_t &drmTime)
     784              : {
     785            5 :     if (!reattachChannelIfRequired())
     786              :     {
     787            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     788            1 :         return MediaKeyErrorStatus::FAIL;
     789              :     }
     790              : 
     791            4 :     firebolt::rialto::GetDrmTimeRequest request;
     792            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     793              : 
     794            4 :     firebolt::rialto::GetDrmTimeResponse response;
     795              :     // Default error status to FAIL
     796            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     797              : 
     798            4 :     auto ipcController = m_ipc.createRpcController();
     799            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     800            4 :     m_mediaKeysStub->getDrmTime(ipcController.get(), &request, &response, blockingClosure.get());
     801              : 
     802              :     // wait for the call to complete
     803            4 :     blockingClosure->wait();
     804              : 
     805            4 :     if (ProtoMediaKeyErrorStatus::OK == response.error_status())
     806              :     {
     807            2 :         drmTime = response.drm_time();
     808              :     }
     809              : 
     810            8 :     return getMediaKeyErrorStatusFromResponse("getDrmTime", ipcController, response.error_status());
     811            4 : }
     812              : 
     813            5 : MediaKeyErrorStatus MediaKeysIpc::getCdmKeySessionId(int32_t keySessionId, std::string &cdmKeySessionId)
     814              : {
     815            5 :     if (!reattachChannelIfRequired())
     816              :     {
     817            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     818            1 :         return MediaKeyErrorStatus::FAIL;
     819              :     }
     820              : 
     821            4 :     firebolt::rialto::GetCdmKeySessionIdRequest request;
     822            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     823            4 :     request.set_key_session_id(keySessionId);
     824              : 
     825            4 :     firebolt::rialto::GetCdmKeySessionIdResponse response;
     826              :     // Default error status to FAIL
     827            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     828              : 
     829            4 :     auto ipcController = m_ipc.createRpcController();
     830            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     831            4 :     m_mediaKeysStub->getCdmKeySessionId(ipcController.get(), &request, &response, blockingClosure.get());
     832              : 
     833              :     // wait for the call to complete
     834            4 :     blockingClosure->wait();
     835              : 
     836            4 :     cdmKeySessionId = response.cdm_key_session_id();
     837              : 
     838            8 :     return getMediaKeyErrorStatusFromResponse("getCdmKeySessionId", ipcController, response.error_status());
     839            4 : }
     840              : 
     841            5 : MediaKeyErrorStatus MediaKeysIpc::releaseKeySession(int32_t keySessionId)
     842              : {
     843            5 :     if (!reattachChannelIfRequired())
     844              :     {
     845            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     846            1 :         return MediaKeyErrorStatus::FAIL;
     847              :     }
     848              : 
     849              :     // Reset client
     850            4 :     m_mediaKeysIpcClient.reset();
     851              : 
     852            4 :     firebolt::rialto::ReleaseKeySessionRequest request;
     853            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     854            4 :     request.set_key_session_id(keySessionId);
     855              : 
     856            4 :     firebolt::rialto::ReleaseKeySessionResponse response;
     857              :     // Default error status to FAIL
     858            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     859              : 
     860            4 :     auto ipcController = m_ipc.createRpcController();
     861            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     862            4 :     m_mediaKeysStub->releaseKeySession(ipcController.get(), &request, &response, blockingClosure.get());
     863              : 
     864              :     // wait for the call to complete
     865            4 :     blockingClosure->wait();
     866              : 
     867            8 :     return getMediaKeyErrorStatusFromResponse("releaseKeySession", ipcController, response.error_status());
     868            4 : }
     869              : 
     870            3 : void MediaKeysIpc::onLicenseRequest(const std::shared_ptr<firebolt::rialto::LicenseRequestEvent> &event)
     871              : {
     872            3 :     std::shared_ptr<IMediaKeysClient> mediaKeysIpcClient = m_mediaKeysIpcClient.lock();
     873              : 
     874              :     /* Ignore event if not for this session or no client */
     875            3 :     if ((event->media_keys_handle() == m_mediaKeysHandle) && (mediaKeysIpcClient))
     876              :     {
     877            1 :         std::vector<unsigned char> messageVector = std::vector<unsigned char>{event->license_request_message().begin(),
     878            2 :                                                                               event->license_request_message().end()};
     879            1 :         mediaKeysIpcClient->onLicenseRequest(event->key_session_id(), messageVector, event->url());
     880              :     }
     881            3 : }
     882              : 
     883            6 : void MediaKeysIpc::onLicenseRenewal(const std::shared_ptr<firebolt::rialto::LicenseRenewalEvent> &event)
     884              : {
     885            6 :     std::shared_ptr<IMediaKeysClient> mediaKeysIpcClient = m_mediaKeysIpcClient.lock();
     886              : 
     887              :     /* Ignore event if not for this session or no client */
     888            6 :     if ((event->media_keys_handle() == m_mediaKeysHandle) && (mediaKeysIpcClient))
     889              :     {
     890            2 :         std::vector<unsigned char> messageVector = std::vector<unsigned char>{event->license_renewal_message().begin(),
     891            4 :                                                                               event->license_renewal_message().end()};
     892            2 :         mediaKeysIpcClient->onLicenseRenewal(event->key_session_id(), messageVector);
     893              :     }
     894            6 : }
     895              : 
     896            3 : void MediaKeysIpc::onKeyStatusesChanged(const std::shared_ptr<firebolt::rialto::KeyStatusesChangedEvent> &event)
     897              : {
     898            3 :     std::shared_ptr<IMediaKeysClient> mediaKeysIpcClient = m_mediaKeysIpcClient.lock();
     899              : 
     900              :     /* Ignore event if not for this session or no client */
     901            3 :     if ((event->media_keys_handle() == m_mediaKeysHandle) && (mediaKeysIpcClient))
     902              :     {
     903            1 :         KeyStatusVector keyStatuses;
     904            4 :         for (auto it = event->key_statuses().begin(); it != event->key_statuses().end(); it++)
     905              :         {
     906            6 :             std::vector<unsigned char> keyVector = std::vector<unsigned char>{it->key_id().begin(), it->key_id().end()};
     907            3 :             KeyStatus keyStatus = convertKeyStatus(it->key_status());
     908            3 :             keyStatuses.push_back(std::make_pair(keyVector, keyStatus));
     909              :         }
     910            1 :         mediaKeysIpcClient->onKeyStatusesChanged(event->key_session_id(), keyStatuses);
     911              :     }
     912            3 : }
     913              : 
     914              : MediaKeyErrorStatus
     915           84 : MediaKeysIpc::getMediaKeyErrorStatusFromResponse(const std::string methodName,
     916              :                                                  const std::shared_ptr<google::protobuf::RpcController> &controller,
     917              :                                                  ProtoMediaKeyErrorStatus status)
     918              : {
     919           84 :     if (controller->Failed())
     920              :     {
     921           17 :         RIALTO_CLIENT_LOG_ERROR("%s failed due to '%s'", methodName.c_str(), controller->ErrorText().c_str());
     922           17 :         return MediaKeyErrorStatus::FAIL;
     923              :     }
     924           67 :     MediaKeyErrorStatus returnStatus = convertMediaKeyErrorStatus(status);
     925           67 :     if (MediaKeyErrorStatus::OK != returnStatus)
     926              :     {
     927           17 :         RIALTO_CLIENT_LOG_ERROR("%s failed due to MediaKeyErrorStatus '%s'", methodName.c_str(), toString(returnStatus));
     928           17 :         return returnStatus;
     929              :     }
     930              : 
     931           50 :     return returnStatus;
     932              : }
     933              : 
     934            5 : MediaKeyErrorStatus MediaKeysIpc::getMetricSystemData(std::vector<uint8_t> &buffer)
     935              : {
     936            5 :     if (!reattachChannelIfRequired())
     937              :     {
     938            1 :         RIALTO_CLIENT_LOG_ERROR("Reattachment of the ipc channel failed, ipc disconnected");
     939            1 :         return MediaKeyErrorStatus::FAIL;
     940              :     }
     941              : 
     942            4 :     firebolt::rialto::GetMetricSystemDataRequest request;
     943            4 :     request.set_media_keys_handle(m_mediaKeysHandle);
     944              : 
     945            4 :     firebolt::rialto::GetMetricSystemDataResponse response;
     946              :     // Default error status to FAIL
     947            4 :     response.set_error_status(ProtoMediaKeyErrorStatus::FAIL);
     948              : 
     949            4 :     auto ipcController = m_ipc.createRpcController();
     950            4 :     auto blockingClosure = m_ipc.createBlockingClosure();
     951            4 :     m_mediaKeysStub->getMetricSystemData(ipcController.get(), &request, &response, blockingClosure.get());
     952              : 
     953              :     // wait for the call to complete
     954            4 :     blockingClosure->wait();
     955              : 
     956            4 :     if (ProtoMediaKeyErrorStatus::OK == response.error_status())
     957              :     {
     958            4 :         buffer = std::vector<uint8_t>(response.buffer().begin(), response.buffer().end());
     959              :     }
     960              : 
     961            8 :     return getMediaKeyErrorStatusFromResponse("getMetricSystemData", ipcController, response.error_status());
     962            4 : }
     963              : 
     964              : }; // namespace firebolt::rialto::client
        

Generated by: LCOV version 2.0-1