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