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 "MediaPipelineModuleService.h"
21 : #include "IMediaPipelineService.h"
22 : #include "MediaPipelineClient.h"
23 : #include "RialtoCommonModule.h"
24 : #include "RialtoServerLogging.h"
25 : #include <IIpcController.h>
26 : #include <algorithm>
27 : #include <cstdint>
28 : #include <unordered_map>
29 :
30 : namespace
31 : {
32 20 : int generateSessionId()
33 : {
34 : static int sessionId{0};
35 20 : return sessionId++;
36 : }
37 :
38 2 : firebolt::rialto::MediaType convertMediaType(const firebolt::rialto::LoadRequest_MediaType &mediaType)
39 : {
40 2 : switch (mediaType)
41 : {
42 0 : case firebolt::rialto::LoadRequest_MediaType::LoadRequest_MediaType_UNKNOWN:
43 : {
44 0 : return firebolt::rialto::MediaType::UNKNOWN;
45 : }
46 2 : case firebolt::rialto::LoadRequest_MediaType::LoadRequest_MediaType_MSE:
47 : {
48 2 : return firebolt::rialto::MediaType::MSE;
49 : }
50 : }
51 0 : return firebolt::rialto::MediaType::UNKNOWN;
52 : }
53 :
54 2 : firebolt::rialto::EaseType convertEaseType(const firebolt::rialto::SetVolumeRequest_EaseType &easeType)
55 : {
56 2 : switch (easeType)
57 : {
58 2 : case firebolt::rialto::SetVolumeRequest_EaseType::SetVolumeRequest_EaseType_EASE_LINEAR:
59 : {
60 2 : return firebolt::rialto::EaseType::EASE_LINEAR;
61 : }
62 0 : case firebolt::rialto::SetVolumeRequest_EaseType::SetVolumeRequest_EaseType_EASE_IN_CUBIC:
63 : {
64 0 : return firebolt::rialto::EaseType::EASE_IN_CUBIC;
65 : }
66 0 : case firebolt::rialto::SetVolumeRequest_EaseType::SetVolumeRequest_EaseType_EASE_OUT_CUBIC:
67 : {
68 0 : return firebolt::rialto::EaseType::EASE_OUT_CUBIC;
69 : }
70 : }
71 0 : return firebolt::rialto::EaseType::EASE_LINEAR;
72 : }
73 :
74 : firebolt::rialto::MediaSourceStatus
75 2 : convertMediaSourceStatus(const firebolt::rialto::HaveDataRequest_MediaSourceStatus &status)
76 : {
77 2 : switch (status)
78 : {
79 0 : case firebolt::rialto::HaveDataRequest_MediaSourceStatus_UNKNOWN:
80 : {
81 0 : return firebolt::rialto::MediaSourceStatus::ERROR;
82 : }
83 0 : case firebolt::rialto::HaveDataRequest_MediaSourceStatus_OK:
84 : {
85 0 : return firebolt::rialto::MediaSourceStatus::OK;
86 : }
87 0 : case firebolt::rialto::HaveDataRequest_MediaSourceStatus_EOS:
88 : {
89 0 : return firebolt::rialto::MediaSourceStatus::EOS;
90 : }
91 0 : case firebolt::rialto::HaveDataRequest_MediaSourceStatus_ERROR:
92 : {
93 0 : return firebolt::rialto::MediaSourceStatus::ERROR;
94 : }
95 2 : case firebolt::rialto::HaveDataRequest_MediaSourceStatus_CODEC_CHANGED:
96 : {
97 2 : return firebolt::rialto::MediaSourceStatus::CODEC_CHANGED;
98 : }
99 0 : case firebolt::rialto::HaveDataRequest_MediaSourceStatus_NO_AVAILABLE_SAMPLES:
100 : {
101 0 : return firebolt::rialto::MediaSourceStatus::NO_AVAILABLE_SAMPLES;
102 : }
103 : }
104 0 : return firebolt::rialto::MediaSourceStatus::ERROR;
105 : }
106 :
107 9 : firebolt::rialto::SourceConfigType convertConfigType(const firebolt::rialto::AttachSourceRequest_ConfigType &configType)
108 : {
109 9 : switch (configType)
110 : {
111 1 : case firebolt::rialto::AttachSourceRequest_ConfigType_CONFIG_TYPE_UNKNOWN:
112 : {
113 1 : return firebolt::rialto::SourceConfigType::UNKNOWN;
114 : }
115 5 : case firebolt::rialto::AttachSourceRequest_ConfigType_CONFIG_TYPE_AUDIO:
116 : {
117 5 : return firebolt::rialto::SourceConfigType::AUDIO;
118 : }
119 1 : case firebolt::rialto::AttachSourceRequest_ConfigType_CONFIG_TYPE_VIDEO:
120 : {
121 1 : return firebolt::rialto::SourceConfigType::VIDEO;
122 : }
123 1 : case firebolt::rialto::AttachSourceRequest_ConfigType_CONFIG_TYPE_VIDEO_DOLBY_VISION:
124 : {
125 1 : return firebolt::rialto::SourceConfigType::VIDEO_DOLBY_VISION;
126 : }
127 1 : case firebolt::rialto::AttachSourceRequest_ConfigType_CONFIG_TYPE_SUBTITLE:
128 : {
129 1 : return firebolt::rialto::SourceConfigType::SUBTITLE;
130 : }
131 : }
132 0 : return firebolt::rialto::SourceConfigType::UNKNOWN;
133 : }
134 :
135 : firebolt::rialto::SegmentAlignment
136 7 : convertSegmentAlignment(const firebolt::rialto::AttachSourceRequest_SegmentAlignment &alignment)
137 : {
138 7 : switch (alignment)
139 : {
140 7 : case firebolt::rialto::AttachSourceRequest_SegmentAlignment_ALIGNMENT_UNDEFINED:
141 : {
142 7 : return firebolt::rialto::SegmentAlignment::UNDEFINED;
143 : }
144 0 : case firebolt::rialto::AttachSourceRequest_SegmentAlignment_ALIGNMENT_NAL:
145 : {
146 0 : return firebolt::rialto::SegmentAlignment::NAL;
147 : }
148 0 : case firebolt::rialto::AttachSourceRequest_SegmentAlignment_ALIGNMENT_AU:
149 : {
150 0 : return firebolt::rialto::SegmentAlignment::AU;
151 : }
152 : }
153 :
154 0 : return firebolt::rialto::SegmentAlignment::UNDEFINED;
155 : }
156 :
157 7 : firebolt::rialto::StreamFormat convertStreamFormat(const firebolt::rialto::AttachSourceRequest_StreamFormat &streamFormat)
158 : {
159 7 : switch (streamFormat)
160 : {
161 1 : case firebolt::rialto::AttachSourceRequest_StreamFormat_STREAM_FORMAT_RAW:
162 : {
163 1 : return firebolt::rialto::StreamFormat::RAW;
164 : }
165 0 : case firebolt::rialto::AttachSourceRequest_StreamFormat_STREAM_FORMAT_AVC:
166 : {
167 0 : return firebolt::rialto::StreamFormat::AVC;
168 : }
169 0 : case firebolt::rialto::AttachSourceRequest_StreamFormat_STREAM_FORMAT_BYTE_STREAM:
170 : {
171 0 : return firebolt::rialto::StreamFormat::BYTE_STREAM;
172 : }
173 0 : case firebolt::rialto::AttachSourceRequest_StreamFormat_STREAM_FORMAT_HVC1:
174 : {
175 0 : return firebolt::rialto::StreamFormat::HVC1;
176 : }
177 0 : case firebolt::rialto::AttachSourceRequest_StreamFormat_STREAM_FORMAT_HEV1:
178 : {
179 0 : return firebolt::rialto::StreamFormat::HEV1;
180 : }
181 6 : default:
182 6 : return firebolt::rialto::StreamFormat::UNDEFINED;
183 : }
184 : }
185 :
186 1 : firebolt::rialto::CodecDataType convertCodecDataType(const firebolt::rialto::AttachSourceRequest_CodecData_Type &type)
187 : {
188 1 : if (firebolt::rialto::AttachSourceRequest_CodecData_Type_STRING == type)
189 : {
190 0 : return firebolt::rialto::CodecDataType::STRING;
191 : }
192 1 : return firebolt::rialto::CodecDataType::BUFFER;
193 : }
194 :
195 1 : firebolt::rialto::Format convertFormat(const firebolt::rialto::AttachSourceRequest_AudioConfig_Format &format)
196 : {
197 : static const std::unordered_map<firebolt::rialto::AttachSourceRequest_AudioConfig_Format, firebolt::rialto::Format>
198 : kFormatConversionMap{
199 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S8, firebolt::rialto::Format::S8},
200 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U8, firebolt::rialto::Format::U8},
201 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S16LE, firebolt::rialto::Format::S16LE},
202 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S16BE, firebolt::rialto::Format::S16BE},
203 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U16LE, firebolt::rialto::Format::U16LE},
204 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U16BE, firebolt::rialto::Format::U16BE},
205 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S24_32LE, firebolt::rialto::Format::S24_32LE},
206 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S24_32BE, firebolt::rialto::Format::S24_32BE},
207 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U24_32LE, firebolt::rialto::Format::U24_32LE},
208 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U24_32BE, firebolt::rialto::Format::U24_32BE},
209 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S32LE, firebolt::rialto::Format::S32LE},
210 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S32BE, firebolt::rialto::Format::S32BE},
211 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U32LE, firebolt::rialto::Format::U32LE},
212 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U32BE, firebolt::rialto::Format::U32BE},
213 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S24LE, firebolt::rialto::Format::S24LE},
214 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S24BE, firebolt::rialto::Format::S24BE},
215 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U24LE, firebolt::rialto::Format::U24LE},
216 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U24BE, firebolt::rialto::Format::U24BE},
217 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S20LE, firebolt::rialto::Format::S20LE},
218 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S20BE, firebolt::rialto::Format::S20BE},
219 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U20LE, firebolt::rialto::Format::U20LE},
220 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U20BE, firebolt::rialto::Format::U20BE},
221 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S18LE, firebolt::rialto::Format::S18LE},
222 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_S18BE, firebolt::rialto::Format::S18BE},
223 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U18LE, firebolt::rialto::Format::U18LE},
224 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_U18BE, firebolt::rialto::Format::U18BE},
225 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_F32LE, firebolt::rialto::Format::F32LE},
226 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_F32BE, firebolt::rialto::Format::F32BE},
227 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_F64LE, firebolt::rialto::Format::F64LE},
228 1 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Format_F64BE, firebolt::rialto::Format::F64BE}};
229 1 : const auto kIt = kFormatConversionMap.find(format);
230 1 : if (kFormatConversionMap.end() != kIt)
231 : {
232 1 : return kIt->second;
233 : }
234 0 : return firebolt::rialto::Format::S8;
235 : }
236 :
237 1 : firebolt::rialto::Layout convertLayout(const firebolt::rialto::AttachSourceRequest_AudioConfig_Layout &layout)
238 : {
239 : static const std::unordered_map<firebolt::rialto::AttachSourceRequest_AudioConfig_Layout, firebolt::rialto::Layout>
240 : kLayoutConversionMap{{firebolt::rialto::AttachSourceRequest_AudioConfig_Layout_INTERLEAVED,
241 : firebolt::rialto::Layout::INTERLEAVED},
242 : {firebolt::rialto::AttachSourceRequest_AudioConfig_Layout_NON_INTERLEAVED,
243 1 : firebolt::rialto::Layout::NON_INTERLEAVED}};
244 1 : const auto kIt = kLayoutConversionMap.find(layout);
245 1 : if (kLayoutConversionMap.end() != kIt)
246 : {
247 1 : return kIt->second;
248 : }
249 0 : return firebolt::rialto::Layout::INTERLEAVED;
250 : }
251 : } // namespace
252 :
253 : namespace firebolt::rialto::server::ipc
254 : {
255 1 : std::shared_ptr<IMediaPipelineModuleServiceFactory> IMediaPipelineModuleServiceFactory::createFactory()
256 : {
257 1 : std::shared_ptr<IMediaPipelineModuleServiceFactory> factory;
258 :
259 : try
260 : {
261 1 : factory = std::make_shared<MediaPipelineModuleServiceFactory>();
262 : }
263 0 : catch (const std::exception &e)
264 : {
265 0 : RIALTO_SERVER_LOG_ERROR("Failed to create the media player module service factory, reason: %s", e.what());
266 : }
267 :
268 1 : return factory;
269 : }
270 :
271 : std::shared_ptr<IMediaPipelineModuleService>
272 1 : MediaPipelineModuleServiceFactory::create(service::IMediaPipelineService &mediaPipelineService) const
273 : {
274 1 : std::shared_ptr<IMediaPipelineModuleService> mediaPipelineModule;
275 :
276 : try
277 : {
278 1 : mediaPipelineModule = std::make_shared<MediaPipelineModuleService>(mediaPipelineService);
279 : }
280 0 : catch (const std::exception &e)
281 : {
282 0 : RIALTO_SERVER_LOG_ERROR("Failed to create the media player module service, reason: %s", e.what());
283 : }
284 :
285 1 : return mediaPipelineModule;
286 : }
287 :
288 90 : MediaPipelineModuleService::MediaPipelineModuleService(service::IMediaPipelineService &mediaPipelineService)
289 90 : : m_mediaPipelineService{mediaPipelineService}
290 : {
291 : }
292 :
293 : MediaPipelineModuleService::~MediaPipelineModuleService() {}
294 :
295 2 : void MediaPipelineModuleService::clientConnected(const std::shared_ptr<::firebolt::rialto::ipc::IClient> &ipcClient)
296 : {
297 2 : RIALTO_SERVER_LOG_INFO("Client Connected!");
298 : {
299 2 : m_clientSessions.emplace(ipcClient, std::set<int>());
300 : }
301 2 : ipcClient->exportService(shared_from_this());
302 : }
303 :
304 1 : void MediaPipelineModuleService::clientDisconnected(const std::shared_ptr<::firebolt::rialto::ipc::IClient> &ipcClient)
305 : {
306 1 : RIALTO_SERVER_LOG_INFO("Client disconnected!");
307 1 : std::set<int> sessionIds;
308 : {
309 1 : auto sessionIter = m_clientSessions.find(ipcClient);
310 1 : if (sessionIter == m_clientSessions.end())
311 : {
312 0 : RIALTO_SERVER_LOG_ERROR("unknown client disconnected");
313 0 : return;
314 : }
315 1 : sessionIds = sessionIter->second; // copy to avoid deadlock
316 1 : m_clientSessions.erase(sessionIter);
317 : }
318 2 : for (const auto &sessionId : sessionIds)
319 : {
320 1 : m_mediaPipelineService.destroySession(sessionId);
321 : }
322 : }
323 :
324 20 : void MediaPipelineModuleService::createSession(::google::protobuf::RpcController *controller,
325 : const ::firebolt::rialto::CreateSessionRequest *request,
326 : ::firebolt::rialto::CreateSessionResponse *response,
327 : ::google::protobuf::Closure *done)
328 : {
329 20 : RIALTO_SERVER_LOG_DEBUG("entry:");
330 20 : auto ipcController = dynamic_cast<firebolt::rialto::ipc::IController *>(controller);
331 20 : if (!ipcController)
332 : {
333 0 : RIALTO_SERVER_LOG_ERROR("ipc library provided incompatible controller object");
334 0 : controller->SetFailed("ipc library provided incompatible controller object");
335 0 : done->Run();
336 0 : return;
337 : }
338 :
339 20 : int sessionId = generateSessionId();
340 : bool sessionCreated =
341 40 : m_mediaPipelineService.createSession(sessionId,
342 40 : std::make_shared<MediaPipelineClient>(sessionId, ipcController->getClient()),
343 : request->max_width(), request->max_height());
344 20 : if (sessionCreated)
345 : {
346 : // Assume that IPC library works well and client is present
347 19 : m_clientSessions[ipcController->getClient()].insert(sessionId);
348 19 : response->set_session_id(sessionId);
349 : }
350 : else
351 : {
352 1 : RIALTO_SERVER_LOG_ERROR("Create session failed");
353 1 : controller->SetFailed("Operation failed");
354 : }
355 20 : done->Run();
356 : }
357 :
358 2 : void MediaPipelineModuleService::destroySession(::google::protobuf::RpcController *controller,
359 : const ::firebolt::rialto::DestroySessionRequest *request,
360 : ::firebolt::rialto::DestroySessionResponse *response,
361 : ::google::protobuf::Closure *done)
362 : {
363 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
364 2 : auto ipcController = dynamic_cast<firebolt::rialto::ipc::IController *>(controller);
365 2 : if (!ipcController)
366 : {
367 0 : RIALTO_SERVER_LOG_ERROR("ipc library provided incompatible controller object");
368 0 : controller->SetFailed("ipc library provided incompatible controller object");
369 0 : done->Run();
370 1 : return;
371 : }
372 :
373 2 : if (!m_mediaPipelineService.destroySession(request->session_id()))
374 : {
375 1 : RIALTO_SERVER_LOG_ERROR("Destroy session failed");
376 1 : controller->SetFailed("Operation failed");
377 1 : done->Run();
378 1 : return;
379 : }
380 1 : auto sessionIter = m_clientSessions.find(ipcController->getClient());
381 1 : if (sessionIter != m_clientSessions.end())
382 : {
383 0 : sessionIter->second.erase(request->session_id());
384 : }
385 1 : done->Run();
386 : }
387 :
388 2 : void MediaPipelineModuleService::load(::google::protobuf::RpcController *controller,
389 : const ::firebolt::rialto::LoadRequest *request,
390 : ::firebolt::rialto::LoadResponse *response, ::google::protobuf::Closure *done)
391 : {
392 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
393 2 : if (!m_mediaPipelineService.load(request->session_id(), convertMediaType(request->type()), request->mime_type(),
394 : request->url()))
395 : {
396 1 : RIALTO_SERVER_LOG_ERROR("Load failed");
397 1 : controller->SetFailed("Operation failed");
398 : }
399 2 : done->Run();
400 : }
401 :
402 2 : void MediaPipelineModuleService::setVideoWindow(::google::protobuf::RpcController *controller,
403 : const ::firebolt::rialto::SetVideoWindowRequest *request,
404 : ::firebolt::rialto::SetVideoWindowResponse *response,
405 : ::google::protobuf::Closure *done)
406 : {
407 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
408 2 : if (!m_mediaPipelineService.setVideoWindow(request->session_id(), request->x(), request->y(), request->width(),
409 : request->height()))
410 : {
411 1 : RIALTO_SERVER_LOG_ERROR("Set Video Window failed");
412 1 : controller->SetFailed("Operation failed");
413 : }
414 2 : done->Run();
415 : }
416 :
417 9 : void MediaPipelineModuleService::attachSource(::google::protobuf::RpcController *controller,
418 : const ::firebolt::rialto::AttachSourceRequest *request,
419 : ::firebolt::rialto::AttachSourceResponse *response,
420 : ::google::protobuf::Closure *done)
421 : {
422 9 : RIALTO_SERVER_LOG_DEBUG("mime_type: %s", request->mime_type().c_str());
423 :
424 9 : std::shared_ptr<CodecData> codecData{};
425 9 : if (request->has_codec_data())
426 : {
427 1 : auto codecDataProto = request->codec_data();
428 1 : codecData = std::make_shared<CodecData>();
429 1 : codecData->data = std::vector<std::uint8_t>(codecDataProto.data().begin(), codecDataProto.data().end());
430 1 : codecData->type = convertCodecDataType(codecDataProto.type());
431 : }
432 9 : std::unique_ptr<IMediaPipeline::MediaSource> mediaSource;
433 9 : firebolt::rialto::SourceConfigType configType = convertConfigType(request->config_type());
434 9 : bool hasDrm = request->has_drm();
435 :
436 9 : if (configType == firebolt::rialto::SourceConfigType::AUDIO)
437 : {
438 5 : const auto &kConfig = request->audio_config();
439 5 : uint32_t numberofchannels = kConfig.number_of_channels();
440 5 : uint32_t sampleRate = kConfig.sample_rate();
441 :
442 5 : std::vector<uint8_t> codecSpecificConfig;
443 5 : if (kConfig.has_codec_specific_config())
444 : {
445 1 : auto codecSpecificConfigStr = kConfig.codec_specific_config();
446 1 : codecSpecificConfig.assign(codecSpecificConfigStr.begin(), codecSpecificConfigStr.end());
447 : }
448 5 : std::optional<firebolt::rialto::Format> format{std::nullopt};
449 5 : if (kConfig.has_format())
450 : {
451 1 : format = convertFormat(kConfig.format());
452 : }
453 5 : std::optional<firebolt::rialto::Layout> layout{std::nullopt};
454 5 : if (kConfig.has_layout())
455 : {
456 1 : layout = convertLayout(kConfig.layout());
457 : }
458 5 : std::optional<uint64_t> channelMask{std::nullopt};
459 5 : if (kConfig.has_channel_mask())
460 : {
461 1 : channelMask = kConfig.channel_mask();
462 : }
463 5 : AudioConfig audioConfig{numberofchannels, sampleRate, codecSpecificConfig, format, layout, channelMask};
464 :
465 : mediaSource =
466 10 : std::make_unique<IMediaPipeline::MediaSourceAudio>(request->mime_type(), hasDrm, audioConfig,
467 5 : convertSegmentAlignment(request->segment_alignment()),
468 10 : convertStreamFormat(request->stream_format()), codecData);
469 5 : }
470 4 : else if (configType == firebolt::rialto::SourceConfigType::VIDEO)
471 : {
472 : mediaSource =
473 2 : std::make_unique<IMediaPipeline::MediaSourceVideo>(request->mime_type().c_str(), hasDrm, request->width(),
474 1 : request->height(),
475 1 : convertSegmentAlignment(request->segment_alignment()),
476 3 : convertStreamFormat(request->stream_format()), codecData);
477 : }
478 3 : else if (configType == firebolt::rialto::SourceConfigType::VIDEO_DOLBY_VISION)
479 : {
480 : mediaSource =
481 2 : std::make_unique<IMediaPipeline::MediaSourceVideoDolbyVision>(request->mime_type().c_str(),
482 1 : request->dolby_vision_profile(), hasDrm,
483 1 : request->width(), request->height(),
484 1 : convertSegmentAlignment(
485 1 : request->segment_alignment()),
486 2 : convertStreamFormat(request->stream_format()),
487 1 : codecData);
488 : }
489 2 : else if (configType == firebolt::rialto::SourceConfigType::SUBTITLE)
490 : {
491 2 : mediaSource = std::make_unique<IMediaPipeline::MediaSourceSubtitle>(request->mime_type().c_str(),
492 2 : request->text_track_identifier());
493 : }
494 : else
495 : {
496 1 : RIALTO_SERVER_LOG_ERROR("Unknown source type");
497 1 : controller->SetFailed("Operation failed");
498 1 : done->Run();
499 1 : return;
500 : }
501 :
502 8 : if (!request->has_switch_source() || !request->switch_source())
503 : {
504 6 : RIALTO_SERVER_LOG_DEBUG("Attaching source");
505 6 : if (!m_mediaPipelineService.attachSource(request->session_id(), mediaSource))
506 : {
507 1 : RIALTO_SERVER_LOG_ERROR("Attach source failed");
508 1 : controller->SetFailed("Operation failed");
509 : }
510 : }
511 : else
512 : {
513 2 : RIALTO_SERVER_LOG_DEBUG("Switching source");
514 2 : if (!m_mediaPipelineService.switchSource(request->session_id(), mediaSource))
515 : {
516 1 : RIALTO_SERVER_LOG_ERROR("Switch source failed");
517 1 : controller->SetFailed("Operation failed");
518 : }
519 : }
520 8 : response->set_source_id(mediaSource->getId());
521 8 : done->Run();
522 10 : }
523 :
524 0 : void MediaPipelineModuleService::removeSource(::google::protobuf::RpcController *controller,
525 : const ::firebolt::rialto::RemoveSourceRequest *request,
526 : ::firebolt::rialto::RemoveSourceResponse *response,
527 : ::google::protobuf::Closure *done)
528 : {
529 0 : RIALTO_SERVER_LOG_DEBUG("entry:");
530 0 : if (!m_mediaPipelineService.removeSource(request->session_id(), request->source_id()))
531 : {
532 0 : RIALTO_SERVER_LOG_ERROR("Remove source failed");
533 0 : controller->SetFailed("Operation failed");
534 : }
535 0 : done->Run();
536 : }
537 :
538 2 : void MediaPipelineModuleService::allSourcesAttached(::google::protobuf::RpcController *controller,
539 : const ::firebolt::rialto::AllSourcesAttachedRequest *request,
540 : ::firebolt::rialto::AllSourcesAttachedResponse *response,
541 : ::google::protobuf::Closure *done)
542 : {
543 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
544 2 : if (!m_mediaPipelineService.allSourcesAttached(request->session_id()))
545 : {
546 1 : RIALTO_SERVER_LOG_ERROR("All sources attached failed");
547 1 : controller->SetFailed("Operation failed");
548 : }
549 2 : done->Run();
550 : }
551 :
552 2 : void MediaPipelineModuleService::play(::google::protobuf::RpcController *controller,
553 : const ::firebolt::rialto::PlayRequest *request,
554 : ::firebolt::rialto::PlayResponse *response, ::google::protobuf::Closure *done)
555 : {
556 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
557 2 : if (!m_mediaPipelineService.play(request->session_id()))
558 : {
559 1 : RIALTO_SERVER_LOG_ERROR("Play failed");
560 1 : controller->SetFailed("Operation failed");
561 : }
562 2 : done->Run();
563 : }
564 :
565 2 : void MediaPipelineModuleService::pause(::google::protobuf::RpcController *controller,
566 : const ::firebolt::rialto::PauseRequest *request,
567 : ::firebolt::rialto::PauseResponse *response, ::google::protobuf::Closure *done)
568 : {
569 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
570 2 : if (!m_mediaPipelineService.pause(request->session_id()))
571 : {
572 1 : RIALTO_SERVER_LOG_ERROR("pause failed");
573 1 : controller->SetFailed("Operation failed");
574 : }
575 2 : done->Run();
576 : }
577 :
578 2 : void MediaPipelineModuleService::stop(::google::protobuf::RpcController *controller,
579 : const ::firebolt::rialto::StopRequest *request,
580 : ::firebolt::rialto::StopResponse *response, ::google::protobuf::Closure *done)
581 : {
582 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
583 2 : if (!m_mediaPipelineService.stop(request->session_id()))
584 : {
585 1 : RIALTO_SERVER_LOG_ERROR("Stop failed");
586 1 : controller->SetFailed("Operation failed");
587 : }
588 2 : done->Run();
589 : }
590 :
591 2 : void MediaPipelineModuleService::setPosition(::google::protobuf::RpcController *controller,
592 : const ::firebolt::rialto::SetPositionRequest *request,
593 : ::firebolt::rialto::SetPositionResponse *response,
594 : ::google::protobuf::Closure *done)
595 : {
596 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
597 2 : if (!m_mediaPipelineService.setPosition(request->session_id(), request->position()))
598 : {
599 1 : RIALTO_SERVER_LOG_ERROR("Set Position failed");
600 1 : controller->SetFailed("Operation failed");
601 : }
602 2 : done->Run();
603 : }
604 :
605 2 : void MediaPipelineModuleService::haveData(::google::protobuf::RpcController *controller,
606 : const ::firebolt::rialto::HaveDataRequest *request,
607 : ::firebolt::rialto::HaveDataResponse *response,
608 : ::google::protobuf::Closure *done)
609 : {
610 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
611 2 : firebolt::rialto::MediaSourceStatus status{convertMediaSourceStatus(request->status())};
612 2 : if (!m_mediaPipelineService.haveData(request->session_id(), status, request->num_frames(), request->request_id()))
613 : {
614 1 : RIALTO_SERVER_LOG_ERROR("Have data failed");
615 1 : controller->SetFailed("Operation failed");
616 : }
617 2 : done->Run();
618 : }
619 :
620 2 : void MediaPipelineModuleService::setPlaybackRate(::google::protobuf::RpcController *controller,
621 : const ::firebolt::rialto::SetPlaybackRateRequest *request,
622 : ::firebolt::rialto::SetPlaybackRateResponse *response,
623 : ::google::protobuf::Closure *done)
624 : {
625 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
626 2 : if (!m_mediaPipelineService.setPlaybackRate(request->session_id(), request->rate()))
627 : {
628 1 : RIALTO_SERVER_LOG_ERROR("Set playback rate failed");
629 1 : controller->SetFailed("Operation failed");
630 : }
631 2 : done->Run();
632 : }
633 :
634 2 : void MediaPipelineModuleService::getPosition(::google::protobuf::RpcController *controller,
635 : const ::firebolt::rialto::GetPositionRequest *request,
636 : ::firebolt::rialto::GetPositionResponse *response,
637 : ::google::protobuf::Closure *done)
638 : {
639 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
640 2 : int64_t position{};
641 2 : if (!m_mediaPipelineService.getPosition(request->session_id(), position))
642 : {
643 1 : RIALTO_SERVER_LOG_ERROR("Get position failed");
644 1 : controller->SetFailed("Operation failed");
645 : }
646 : else
647 : {
648 1 : response->set_position(position);
649 : }
650 2 : done->Run();
651 : }
652 :
653 2 : void MediaPipelineModuleService::setImmediateOutput(::google::protobuf::RpcController *controller,
654 : const ::firebolt::rialto::SetImmediateOutputRequest *request,
655 : ::firebolt::rialto::SetImmediateOutputResponse *response,
656 : ::google::protobuf::Closure *done)
657 : {
658 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
659 2 : if (!m_mediaPipelineService.setImmediateOutput(request->session_id(), request->source_id(),
660 2 : request->immediate_output()))
661 : {
662 1 : RIALTO_SERVER_LOG_ERROR("Set Immediate Output failed");
663 1 : controller->SetFailed("Operation failed");
664 : }
665 2 : done->Run();
666 : }
667 :
668 2 : void MediaPipelineModuleService::getImmediateOutput(::google::protobuf::RpcController *controller,
669 : const ::firebolt::rialto::GetImmediateOutputRequest *request,
670 : ::firebolt::rialto::GetImmediateOutputResponse *response,
671 : ::google::protobuf::Closure *done)
672 : {
673 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
674 : bool immediateOutputState;
675 2 : if (!m_mediaPipelineService.getImmediateOutput(request->session_id(), request->source_id(), immediateOutputState))
676 : {
677 1 : RIALTO_SERVER_LOG_ERROR("Get Immediate Output failed");
678 1 : controller->SetFailed("Operation failed");
679 : }
680 : else
681 : {
682 1 : response->set_immediate_output(immediateOutputState);
683 : }
684 2 : done->Run();
685 : }
686 :
687 2 : void MediaPipelineModuleService::getStats(::google::protobuf::RpcController *controller,
688 : const ::firebolt::rialto::GetStatsRequest *request,
689 : ::firebolt::rialto::GetStatsResponse *response,
690 : ::google::protobuf::Closure *done)
691 : {
692 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
693 : uint64_t renderedFrames;
694 : uint64_t droppedFrames;
695 2 : if (!m_mediaPipelineService.getStats(request->session_id(), request->source_id(), renderedFrames, droppedFrames))
696 : {
697 1 : RIALTO_SERVER_LOG_ERROR("Get stats failed");
698 1 : controller->SetFailed("Operation failed");
699 : }
700 : else
701 : {
702 1 : response->set_rendered_frames(renderedFrames);
703 1 : response->set_dropped_frames(droppedFrames);
704 : }
705 2 : done->Run();
706 : }
707 :
708 2 : void MediaPipelineModuleService::renderFrame(::google::protobuf::RpcController *controller,
709 : const ::firebolt::rialto::RenderFrameRequest *request,
710 : ::firebolt::rialto::RenderFrameResponse *response,
711 : ::google::protobuf::Closure *done)
712 : {
713 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
714 :
715 2 : if (!m_mediaPipelineService.renderFrame(request->session_id()))
716 : {
717 1 : RIALTO_SERVER_LOG_ERROR("Render frame");
718 1 : controller->SetFailed("Operation failed");
719 : }
720 :
721 2 : done->Run();
722 : }
723 :
724 2 : void MediaPipelineModuleService::setVolume(::google::protobuf::RpcController *controller,
725 : const ::firebolt::rialto::SetVolumeRequest *request,
726 : ::firebolt::rialto::SetVolumeResponse *response,
727 : ::google::protobuf::Closure *done)
728 : {
729 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
730 :
731 2 : if (!m_mediaPipelineService.setVolume(request->session_id(), request->volume(), request->volume_duration(),
732 4 : convertEaseType(request->ease_type())))
733 : {
734 1 : RIALTO_SERVER_LOG_ERROR("Set volume failed.");
735 1 : controller->SetFailed("Operation failed");
736 : }
737 :
738 2 : done->Run();
739 : }
740 :
741 2 : void MediaPipelineModuleService::getVolume(::google::protobuf::RpcController *controller,
742 : const ::firebolt::rialto::GetVolumeRequest *request,
743 : ::firebolt::rialto::GetVolumeResponse *response,
744 : ::google::protobuf::Closure *done)
745 : {
746 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
747 2 : double volume{};
748 :
749 2 : if (!m_mediaPipelineService.getVolume(request->session_id(), volume))
750 : {
751 1 : RIALTO_SERVER_LOG_ERROR("Get volume failed.");
752 1 : controller->SetFailed("Operation failed");
753 : }
754 : else
755 : {
756 1 : response->set_volume(volume);
757 : }
758 :
759 2 : done->Run();
760 : }
761 :
762 2 : void MediaPipelineModuleService::setMute(::google::protobuf::RpcController *controller,
763 : const ::firebolt::rialto::SetMuteRequest *request,
764 : ::firebolt::rialto::SetMuteResponse *response, ::google::protobuf::Closure *done)
765 : {
766 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
767 :
768 2 : if (!m_mediaPipelineService.setMute(request->session_id(), request->source_id(), request->mute()))
769 : {
770 1 : RIALTO_SERVER_LOG_ERROR("Set mute failed.");
771 1 : controller->SetFailed("Operation failed");
772 : }
773 :
774 2 : done->Run();
775 : }
776 :
777 2 : void MediaPipelineModuleService::getMute(::google::protobuf::RpcController *controller,
778 : const ::firebolt::rialto::GetMuteRequest *request,
779 : ::firebolt::rialto::GetMuteResponse *response, ::google::protobuf::Closure *done)
780 : {
781 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
782 2 : bool mute{};
783 :
784 2 : if (!m_mediaPipelineService.getMute(request->session_id(), request->source_id(), mute))
785 : {
786 1 : RIALTO_SERVER_LOG_ERROR("Get mute failed.");
787 1 : controller->SetFailed("Operation failed");
788 : }
789 : else
790 : {
791 1 : response->set_mute(mute);
792 : }
793 :
794 2 : done->Run();
795 : }
796 :
797 2 : void MediaPipelineModuleService::setTextTrackIdentifier(::google::protobuf::RpcController *controller,
798 : const ::firebolt::rialto::SetTextTrackIdentifierRequest *request,
799 : ::firebolt::rialto::SetTextTrackIdentifierResponse *response,
800 : ::google::protobuf::Closure *done)
801 : {
802 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
803 :
804 2 : if (!m_mediaPipelineService.setTextTrackIdentifier(request->session_id(), request->text_track_identifier()))
805 : {
806 1 : RIALTO_SERVER_LOG_ERROR("Set text track identifier failed.");
807 1 : controller->SetFailed("Operation failed");
808 : }
809 :
810 2 : done->Run();
811 : }
812 :
813 2 : void MediaPipelineModuleService::getTextTrackIdentifier(::google::protobuf::RpcController *controller,
814 : const ::firebolt::rialto::GetTextTrackIdentifierRequest *request,
815 : ::firebolt::rialto::GetTextTrackIdentifierResponse *response,
816 : ::google::protobuf::Closure *done)
817 : {
818 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
819 2 : std::string textTrackIdentifier{};
820 :
821 2 : if (!m_mediaPipelineService.getTextTrackIdentifier(request->session_id(), textTrackIdentifier))
822 : {
823 1 : RIALTO_SERVER_LOG_ERROR("Get TextTrackIdentifier failed.");
824 1 : controller->SetFailed("Operation failed");
825 : }
826 : else
827 : {
828 1 : response->set_text_track_identifier(textTrackIdentifier);
829 : }
830 :
831 2 : done->Run();
832 : }
833 :
834 2 : void MediaPipelineModuleService::setLowLatency(::google::protobuf::RpcController *controller,
835 : const ::firebolt::rialto::SetLowLatencyRequest *request,
836 : ::firebolt::rialto::SetLowLatencyResponse *response,
837 : ::google::protobuf::Closure *done)
838 : {
839 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
840 :
841 2 : if (!m_mediaPipelineService.setLowLatency(request->session_id(), request->low_latency()))
842 : {
843 1 : RIALTO_SERVER_LOG_ERROR("Set low latency failed.");
844 1 : controller->SetFailed("Operation failed");
845 : }
846 :
847 2 : done->Run();
848 : }
849 :
850 2 : void MediaPipelineModuleService::setSync(::google::protobuf::RpcController *controller,
851 : const ::firebolt::rialto::SetSyncRequest *request,
852 : ::firebolt::rialto::SetSyncResponse *response, ::google::protobuf::Closure *done)
853 : {
854 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
855 :
856 2 : if (!m_mediaPipelineService.setSync(request->session_id(), request->sync()))
857 : {
858 1 : RIALTO_SERVER_LOG_ERROR("Set sync failed.");
859 1 : controller->SetFailed("Operation failed");
860 : }
861 :
862 2 : done->Run();
863 : }
864 :
865 2 : void MediaPipelineModuleService::getSync(::google::protobuf::RpcController *controller,
866 : const ::firebolt::rialto::GetSyncRequest *request,
867 : ::firebolt::rialto::GetSyncResponse *response, ::google::protobuf::Closure *done)
868 : {
869 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
870 2 : bool sync{};
871 :
872 2 : if (!m_mediaPipelineService.getSync(request->session_id(), sync))
873 : {
874 1 : RIALTO_SERVER_LOG_ERROR("Get sync failed.");
875 1 : controller->SetFailed("Operation failed");
876 : }
877 : else
878 : {
879 1 : response->set_sync(sync);
880 : }
881 :
882 2 : done->Run();
883 : }
884 :
885 2 : void MediaPipelineModuleService::setSyncOff(::google::protobuf::RpcController *controller,
886 : const ::firebolt::rialto::SetSyncOffRequest *request,
887 : ::firebolt::rialto::SetSyncOffResponse *response,
888 : ::google::protobuf::Closure *done)
889 : {
890 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
891 :
892 2 : if (!m_mediaPipelineService.setSyncOff(request->session_id(), request->sync_off()))
893 : {
894 1 : RIALTO_SERVER_LOG_ERROR("Set sync off failed.");
895 1 : controller->SetFailed("Operation failed");
896 : }
897 :
898 2 : done->Run();
899 : }
900 :
901 2 : void MediaPipelineModuleService::setStreamSyncMode(::google::protobuf::RpcController *controller,
902 : const ::firebolt::rialto::SetStreamSyncModeRequest *request,
903 : ::firebolt::rialto::SetStreamSyncModeResponse *response,
904 : ::google::protobuf::Closure *done)
905 : {
906 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
907 :
908 2 : if (!m_mediaPipelineService.setStreamSyncMode(request->session_id(), request->source_id(),
909 : request->stream_sync_mode()))
910 : {
911 1 : RIALTO_SERVER_LOG_ERROR("Set stream sync mode failed.");
912 1 : controller->SetFailed("Operation failed");
913 : }
914 :
915 2 : done->Run();
916 : }
917 :
918 2 : void MediaPipelineModuleService::getStreamSyncMode(::google::protobuf::RpcController *controller,
919 : const ::firebolt::rialto::GetStreamSyncModeRequest *request,
920 : ::firebolt::rialto::GetStreamSyncModeResponse *response,
921 : ::google::protobuf::Closure *done)
922 : {
923 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
924 2 : int32_t streamSyncMode{};
925 :
926 2 : if (!m_mediaPipelineService.getStreamSyncMode(request->session_id(), streamSyncMode))
927 : {
928 1 : RIALTO_SERVER_LOG_ERROR("Get stream sync mode failed.");
929 1 : controller->SetFailed("Operation failed");
930 : }
931 : else
932 : {
933 1 : response->set_stream_sync_mode(streamSyncMode);
934 : }
935 :
936 2 : done->Run();
937 : }
938 :
939 2 : void MediaPipelineModuleService::flush(::google::protobuf::RpcController *controller,
940 : const ::firebolt::rialto::FlushRequest *request,
941 : ::firebolt::rialto::FlushResponse *response, ::google::protobuf::Closure *done)
942 : {
943 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
944 :
945 2 : if (!m_mediaPipelineService.flush(request->session_id(), request->source_id(), request->reset_time()))
946 : {
947 1 : RIALTO_SERVER_LOG_ERROR("Flush failed.");
948 1 : controller->SetFailed("Operation failed");
949 : }
950 :
951 2 : done->Run();
952 : }
953 :
954 2 : void MediaPipelineModuleService::setSourcePosition(::google::protobuf::RpcController *controller,
955 : const ::firebolt::rialto::SetSourcePositionRequest *request,
956 : ::firebolt::rialto::SetSourcePositionResponse *response,
957 : ::google::protobuf::Closure *done)
958 : {
959 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
960 4 : if (!m_mediaPipelineService.setSourcePosition(request->session_id(), request->source_id(), request->position(),
961 2 : request->reset_time(), request->applied_rate(),
962 : request->stop_position()))
963 : {
964 1 : RIALTO_SERVER_LOG_ERROR("Set Source Position failed.");
965 1 : controller->SetFailed("Operation failed");
966 : }
967 2 : done->Run();
968 : }
969 :
970 2 : void MediaPipelineModuleService::processAudioGap(::google::protobuf::RpcController *controller,
971 : const ::firebolt::rialto::ProcessAudioGapRequest *request,
972 : ::firebolt::rialto::ProcessAudioGapResponse *response,
973 : ::google::protobuf::Closure *done)
974 : {
975 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
976 2 : if (!m_mediaPipelineService.processAudioGap(request->session_id(), request->position(), request->duration(),
977 2 : request->discontinuity_gap(), request->audio_aac()))
978 : {
979 1 : RIALTO_SERVER_LOG_ERROR("Process audio gap failed.");
980 1 : controller->SetFailed("Operation failed");
981 : }
982 2 : done->Run();
983 : }
984 :
985 2 : void MediaPipelineModuleService::setBufferingLimit(::google::protobuf::RpcController *controller,
986 : const ::firebolt::rialto::SetBufferingLimitRequest *request,
987 : ::firebolt::rialto::SetBufferingLimitResponse *response,
988 : ::google::protobuf::Closure *done)
989 : {
990 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
991 2 : if (!m_mediaPipelineService.setBufferingLimit(request->session_id(), request->limit_buffering_ms()))
992 : {
993 1 : RIALTO_SERVER_LOG_ERROR("Set buffering limit failed.");
994 1 : controller->SetFailed("Operation failed");
995 : }
996 2 : done->Run();
997 : }
998 :
999 2 : void MediaPipelineModuleService::getBufferingLimit(::google::protobuf::RpcController *controller,
1000 : const ::firebolt::rialto::GetBufferingLimitRequest *request,
1001 : ::firebolt::rialto::GetBufferingLimitResponse *response,
1002 : ::google::protobuf::Closure *done)
1003 : {
1004 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
1005 2 : uint32_t bufferingLimit{};
1006 :
1007 2 : if (!m_mediaPipelineService.getBufferingLimit(request->session_id(), bufferingLimit))
1008 : {
1009 1 : RIALTO_SERVER_LOG_ERROR("Get buffering limit failed.");
1010 1 : controller->SetFailed("Operation failed");
1011 : }
1012 : else
1013 : {
1014 1 : response->set_limit_buffering_ms(bufferingLimit);
1015 : }
1016 :
1017 2 : done->Run();
1018 : }
1019 :
1020 2 : void MediaPipelineModuleService::setUseBuffering(::google::protobuf::RpcController *controller,
1021 : const ::firebolt::rialto::SetUseBufferingRequest *request,
1022 : ::firebolt::rialto::SetUseBufferingResponse *response,
1023 : ::google::protobuf::Closure *done)
1024 : {
1025 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
1026 2 : if (!m_mediaPipelineService.setUseBuffering(request->session_id(), request->use_buffering()))
1027 : {
1028 1 : RIALTO_SERVER_LOG_ERROR("Set use buffering failed.");
1029 1 : controller->SetFailed("Operation failed");
1030 : }
1031 2 : done->Run();
1032 : }
1033 :
1034 2 : void MediaPipelineModuleService::getUseBuffering(::google::protobuf::RpcController *controller,
1035 : const ::firebolt::rialto::GetUseBufferingRequest *request,
1036 : ::firebolt::rialto::GetUseBufferingResponse *response,
1037 : ::google::protobuf::Closure *done)
1038 : {
1039 2 : RIALTO_SERVER_LOG_DEBUG("entry:");
1040 2 : bool useBuffering{};
1041 :
1042 2 : if (!m_mediaPipelineService.getUseBuffering(request->session_id(), useBuffering))
1043 : {
1044 1 : RIALTO_SERVER_LOG_ERROR("Get use buffering failed.");
1045 1 : controller->SetFailed("Operation failed");
1046 : }
1047 : else
1048 : {
1049 1 : response->set_use_buffering(useBuffering);
1050 : }
1051 :
1052 2 : done->Run();
1053 : }
1054 : } // namespace firebolt::rialto::server::ipc
|