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 : #ifndef FIREBOLT_RIALTO_SERVER_MEDIA_PIPELINE_SERVER_INTERNAL_H_
21 : #define FIREBOLT_RIALTO_SERVER_MEDIA_PIPELINE_SERVER_INTERNAL_H_
22 :
23 : #include "DataReaderFactory.h"
24 : #include "IActiveRequests.h"
25 : #include "IGstGenericPlayer.h"
26 : #include "IMainThread.h"
27 : #include "IMediaPipelineServerInternal.h"
28 : #include "ITimer.h"
29 : #include <map>
30 : #include <memory>
31 : #include <shared_mutex>
32 : #include <string>
33 : #include <unordered_map>
34 : #include <vector>
35 :
36 : namespace firebolt::rialto::server
37 : {
38 : /**
39 : * @brief IMediaPipelineServerInternal factory class definition.
40 : */
41 : class MediaPipelineServerInternalFactory : public server::IMediaPipelineServerInternalFactory
42 : {
43 : public:
44 2 : MediaPipelineServerInternalFactory() = default;
45 2 : ~MediaPipelineServerInternalFactory() override = default;
46 :
47 : std::unique_ptr<IMediaPipeline> createMediaPipeline(std::weak_ptr<IMediaPipelineClient> client,
48 : const VideoRequirements &videoRequirements) const override;
49 :
50 : std::unique_ptr<server::IMediaPipelineServerInternal> createMediaPipelineServerInternal(
51 : std::weak_ptr<IMediaPipelineClient> client, const VideoRequirements &videoRequirements, int sessionId,
52 : const std::shared_ptr<ISharedMemoryBuffer> &shmBuffer, IDecryptionService &decryptionService) const override;
53 :
54 : /**
55 : * @brief Create the generic media player factory object.
56 : *
57 : * @retval the generic media player factory instance or null on error.
58 : */
59 : static std::shared_ptr<MediaPipelineServerInternalFactory> createFactory();
60 : };
61 :
62 : /**
63 : * @brief The definition of the MediaPipelineServerInternal.
64 : */
65 : class MediaPipelineServerInternal : public IMediaPipelineServerInternal, public IGstGenericPlayerClient
66 : {
67 : public:
68 : /**
69 : * @brief The constructor.
70 : *
71 : * @param[in] client : The Rialto media player client.
72 : * @param[in] videoRequirements : The video decoder requirements for the MediaPipeline session.
73 : * @param[in] gstPlayerFactory : The gstreamer player factory.
74 : * @param[in] sessionId : The session id
75 : * @param[in] shmBuffer : The shared memory buffer
76 : * @param[in] mainThreadFactory : The main thread factory.
77 : * @param[in] dataReaderFactory : The data reader factory
78 : * @param[in] activeRequests : The active requests
79 : * @param[in] decryptionService : The decryption service
80 : */
81 : MediaPipelineServerInternal(std::shared_ptr<IMediaPipelineClient> client, const VideoRequirements &videoRequirements,
82 : const std::shared_ptr<IGstGenericPlayerFactory> &gstPlayerFactory, int sessionId,
83 : const std::shared_ptr<ISharedMemoryBuffer> &shmBuffer,
84 : const std::shared_ptr<IMainThreadFactory> &mainThreadFactory,
85 : std::shared_ptr<common::ITimerFactory> timerFactory,
86 : std::unique_ptr<IDataReaderFactory> &&dataReaderFactory,
87 : std::unique_ptr<IActiveRequests> &&activeRequests, IDecryptionService &decryptionService);
88 :
89 : /**
90 : * @brief Virtual destructor.
91 : */
92 : virtual ~MediaPipelineServerInternal();
93 :
94 : bool load(MediaType type, const std::string &mimeType, const std::string &url) override;
95 :
96 : bool attachSource(const std::unique_ptr<MediaSource> &source) override;
97 :
98 : bool removeSource(int32_t id) override;
99 :
100 : bool allSourcesAttached() override;
101 :
102 : bool play() override;
103 :
104 : bool pause() override;
105 :
106 : bool stop() override;
107 :
108 : bool setPlaybackRate(double rate) override;
109 :
110 : bool setPosition(int64_t position) override;
111 :
112 : bool getPosition(int64_t &position) override;
113 :
114 : bool setImmediateOutput(int32_t sourceId, bool immediateOutput) override;
115 :
116 : bool getImmediateOutput(int32_t sourceId, bool &immediateOutput) override;
117 :
118 : bool getStats(int32_t sourceId, uint64_t &renderedFrames, uint64_t &droppedFrames) override;
119 :
120 : bool setVideoWindow(uint32_t x, uint32_t y, uint32_t width, uint32_t height) override;
121 :
122 : bool haveData(MediaSourceStatus status, uint32_t needDataRequestId) override;
123 :
124 : bool haveData(MediaSourceStatus status, uint32_t numFrames, uint32_t needDataRequestId) override;
125 :
126 : void ping(std::unique_ptr<IHeartbeatHandler> &&heartbeatHandler) override;
127 :
128 : bool renderFrame() override;
129 :
130 : bool setVolume(double targetVolume, uint32_t volumeDuration, EaseType easeType) override;
131 :
132 : bool getVolume(double ¤tVolume) override;
133 :
134 : bool setMute(std::int32_t sourceId, bool mute) override;
135 :
136 : bool getMute(std::int32_t sourceId, bool &mute) override;
137 :
138 : bool setTextTrackIdentifier(const std::string &textTrackIdentifier) override;
139 :
140 : bool getTextTrackIdentifier(std::string &textTrackIdentifier) override;
141 :
142 : bool setLowLatency(bool lowLatency) override;
143 :
144 : bool setSync(bool sync) override;
145 :
146 : bool getSync(bool &sync) override;
147 :
148 : bool setSyncOff(bool syncOff) override;
149 :
150 : bool setStreamSyncMode(int32_t sourceId, int32_t streamSyncMode) override;
151 :
152 : bool getStreamSyncMode(int32_t &streamSyncMode) override;
153 :
154 : bool flush(int32_t sourceId, bool resetTime, bool &async) override;
155 :
156 : bool setSourcePosition(int32_t sourceId, int64_t position, bool resetTime, double appliedRate,
157 : uint64_t stopPosition) override;
158 :
159 : bool setSubtitleOffset(int32_t sourceId, int64_t position) override;
160 :
161 : bool processAudioGap(int64_t position, uint32_t duration, int64_t discontinuityGap, bool audioAac) override;
162 :
163 : bool setBufferingLimit(uint32_t limitBufferingMs) override;
164 :
165 : bool getBufferingLimit(uint32_t &limitBufferingMs) override;
166 :
167 : bool setUseBuffering(bool useBuffering) override;
168 :
169 : bool getUseBuffering(bool &useBuffering) override;
170 :
171 : bool switchSource(const std::unique_ptr<MediaSource> &source) override;
172 :
173 : AddSegmentStatus addSegment(uint32_t needDataRequestId, const std::unique_ptr<MediaSegment> &mediaSegment) override;
174 :
175 : std::weak_ptr<IMediaPipelineClient> getClient() override;
176 :
177 : void notifyPlaybackState(PlaybackState state) override;
178 :
179 : bool notifyNeedMediaData(MediaSourceType mediaSourceType) override;
180 :
181 : void notifyPosition(std::int64_t position) override;
182 :
183 : void notifyNetworkState(NetworkState state) override;
184 :
185 : void clearActiveRequestsCache() override;
186 :
187 : void invalidateActiveRequests(const MediaSourceType &type) override;
188 :
189 : void notifyQos(MediaSourceType mediaSourceType, const QosInfo &qosInfo) override;
190 :
191 : void notifyBufferUnderflow(MediaSourceType mediaSourceType) override;
192 :
193 : void notifyPlaybackError(MediaSourceType mediaSourceType, PlaybackError error) override;
194 :
195 : void notifySourceFlushed(MediaSourceType mediaSourceType) override;
196 :
197 : protected:
198 : /**
199 : * @brief The media player client.
200 : */
201 : std::shared_ptr<IMediaPipelineClient> m_mediaPipelineClient;
202 :
203 : /**
204 : * @brief The mainThread object.
205 : */
206 : std::shared_ptr<IMainThread> m_mainThread;
207 :
208 : /**
209 : * @brief The gstreamer player factory object.
210 : */
211 : const std::shared_ptr<IGstGenericPlayerFactory> m_kGstPlayerFactory;
212 :
213 : /**
214 : * @brief The gstreamer player.
215 : */
216 : std::unique_ptr<IGstGenericPlayer> m_gstPlayer;
217 :
218 : /**
219 : * @brief The video decoder requirements for the MediaPipeline session.
220 : */
221 : const VideoRequirements m_kVideoRequirements;
222 :
223 : /**
224 : * @brief ID of a session represented by this MediaPipeline
225 : */
226 : int m_sessionId;
227 :
228 : /**
229 : * @brief Shared memory buffer
230 : */
231 : std::shared_ptr<ISharedMemoryBuffer> m_shmBuffer;
232 :
233 : /**
234 : * @brief DataReader factory
235 : */
236 : std::unique_ptr<IDataReaderFactory> m_dataReaderFactory;
237 :
238 : /**
239 : * @brief Factory creating timers
240 : */
241 : std::shared_ptr<common::ITimerFactory> m_timerFactory;
242 :
243 : /**
244 : * @brief Object containing all active NeedDataRequests
245 : */
246 : std::unique_ptr<IActiveRequests> m_activeRequests;
247 :
248 : /**
249 : * @brief This objects id registered on the main thread
250 : */
251 : uint32_t m_mainThreadClientId;
252 :
253 : /**
254 : * @brief Decryption service
255 : */
256 : IDecryptionService &m_decryptionService;
257 :
258 : /**
259 : * @brief Current playback state
260 : */
261 : PlaybackState m_currentPlaybackState;
262 :
263 : /**
264 : * @brief Map containing scheduled need media data requests.
265 : */
266 : std::unordered_map<MediaSourceType, std::unique_ptr<firebolt::rialto::common::ITimer>> m_needMediaDataTimers;
267 :
268 : /**
269 : * @brief Currently attached sources
270 : */
271 : std::map<MediaSourceType, std::int32_t> m_attachedSources;
272 :
273 : /**
274 : * @brief Map to keep track of the count of MediaSourceStatus with the value NO_AVAILABLE_SAMPLES for each MediaSource
275 : */
276 : std::map<MediaSourceType, unsigned int> m_noAvailableSamplesCounter;
277 :
278 : /**
279 : * @brief Flag used to check if allSourcesAttached was already called
280 : */
281 : bool m_wasAllSourcesAttachedCalled;
282 :
283 : /**
284 : * @brief Flag used to check if low latency is set for video source
285 : */
286 : bool m_IsLowLatencyVideoPlayer{false};
287 :
288 : /**
289 : * @brief Flag used to check if low latency is set for audio source
290 : */
291 : bool m_IsLowLatencyAudioPlayer{false};
292 :
293 : /**
294 : * @brief Map of flags used to check if Eos has been set on the media type for this playback
295 : */
296 : std::map<MediaSourceType, bool> m_isMediaTypeEosMap;
297 :
298 : /**
299 : * @brief Mutex to protect gstPlayer access in getPosition method
300 : */
301 : std::shared_mutex m_getPositionMutex;
302 :
303 : /**
304 : * @brief Load internally, only to be called on the main thread.
305 : *
306 : * @param[in] type : The media type.
307 : * @param[in] mimeType : The MIME type.
308 : * @param[in] url : The URL.
309 : *
310 : * @retval true on success.
311 : */
312 : bool loadInternal(MediaType type, const std::string &mimeType, const std::string &url);
313 :
314 : /**
315 : * @brief Attach source internally, only to be called on the main thread.
316 : *
317 : * @param[in] source : The source.
318 : *
319 : * @retval true on success.
320 : */
321 : bool attachSourceInternal(const std::unique_ptr<MediaSource> &source);
322 :
323 : /**
324 : * @brief Remove source internally, only to be called on the main thread.
325 : *
326 : * @param[in] id : The source id.
327 : *
328 : * @retval true on success.
329 : */
330 : bool removeSourceInternal(int32_t id);
331 :
332 : /**
333 : * @brief Notify all sources attached internally, only to be called on the main thread.
334 : *
335 : * @retval true on success.
336 : */
337 : bool allSourcesAttachedInternal();
338 :
339 : /**
340 : * @brief Play internally, only to be called on the main thread.
341 : *
342 : * @retval true on success.
343 : */
344 : bool playInternal();
345 :
346 : /**
347 : * @brief Pause internally, only to be called on the main thread.
348 : *
349 : * @retval true on success.
350 : */
351 : bool pauseInternal();
352 :
353 : /**
354 : * @brief Stop internally, only to be called on the main thread.
355 : *
356 : * @retval true on success.
357 : */
358 : bool stopInternal();
359 :
360 : /**
361 : * @brief Set the playback rate internally, only to be called on the main thread.
362 : *
363 : * @param[in] rate : The playback rate.
364 : *
365 : * @retval true on success.
366 : */
367 : bool setPlaybackRateInternal(double rate);
368 :
369 : /**
370 : * @brief Set the position internally, only to be called on the main thread.
371 : *
372 : * @param[in] position : The playback position in nanoseconds.
373 : *
374 : * @retval true on success.
375 : */
376 : bool setPositionInternal(int64_t position);
377 :
378 : /**
379 : * @brief Sets the "Immediate Output" property for this source.
380 : *
381 : * This method is asynchronous
382 : *
383 : * @param[in] sourceId : The source id. Value should be set to the MediaSource.id returned after attachSource()
384 : * @param[in] immediateOutput : The desired immediate output mode on the sink
385 : *
386 : * @retval true on success.
387 : */
388 : bool setImmediateOutputInternal(int32_t sourceId, bool immediateOutput);
389 :
390 : /**
391 : * @brief Gets the "Immediate Output" property for this source.
392 : *
393 : * This method is sychronous
394 : *
395 : * @param[in] sourceId : The source id. Value should be set to the MediaSource.id returned after attachSource()
396 : * @param[out] immediateOutput : Returns the immediate output mode on the sink
397 : *
398 : * @retval true on success.
399 : */
400 : bool getImmediateOutputInternal(int32_t sourceId, bool &immediateOutput);
401 :
402 : /**
403 : * @brief Get stats for this source.
404 : *
405 : * This method is sychronous, it returns dropped frames and rendered frames
406 : *
407 : * @param[in] sourceId : The source id. Value should be set to the MediaSource.id returned after attachSource()
408 : * @param[out] renderedFrames : The number of rendered frames
409 : * @param[out] droppedFrames : The number of dropped frames
410 : *
411 : * @retval true on success.
412 : */
413 : bool getStatsInternal(int32_t sourceId, uint64_t &renderedFrames, uint64_t &droppedFrames);
414 :
415 : /**
416 : * @brief Set video window internally, only to be called on the main thread.
417 : *
418 : * @param[in] x : The x position in pixels.
419 : * @param[in] y : The y position in pixels.
420 : * @param[in] width : The width in pixels.
421 : * @param[in] height : The height in pixels.
422 : *
423 : * @retval true on success.
424 : */
425 : bool setVideoWindowInternal(uint32_t x, uint32_t y, uint32_t width, uint32_t height);
426 :
427 : /**
428 : * @brief Have data internally, only to be called on the main thread.
429 : *
430 : * @param[in] status : The status
431 : * @param[in] needDataRequestId : Need data request id
432 : *
433 : * @retval true on success.
434 : */
435 : bool haveDataInternal(MediaSourceStatus status, uint32_t needDataRequestId);
436 :
437 : /**
438 : * @brief Render frame internally, only to be called on the main thread.
439 : *
440 : * @retval true on success.
441 : */
442 : bool renderFrameInternal();
443 :
444 : /**
445 : * @brief Have data internally, only to be called on the main thread.
446 : *
447 : * @param[in] status : The status
448 : * @param[in] numFrames : The number of frames written.
449 : * @param[in] needDataRequestId : Need data request id
450 : *
451 : * @retval true on success.
452 : */
453 : bool haveDataInternal(MediaSourceStatus status, uint32_t numFrames, uint32_t needDataRequestId);
454 :
455 : /**
456 : * @brief Add segment internally, only to be called on the main thread.
457 : *
458 : * @param[in] needDataRequestId : The status
459 : * @param[in] mediaSegment : The data returned.
460 : *
461 : * @retval status of adding segment
462 : */
463 : AddSegmentStatus addSegmentInternal(uint32_t needDataRequestId, const std::unique_ptr<MediaSegment> &mediaSegment);
464 :
465 : /**
466 : * @brief Notify need media data internally, only to be called on the main thread.
467 : *
468 : * @param[in] mediaSourceType : The media source type.
469 : */
470 : bool notifyNeedMediaDataInternal(MediaSourceType mediaSourceType);
471 :
472 : /**
473 : * @brief Schedules resending of NeedMediaData after a short delay. Used when no segments were received in the
474 : * haveData() call to prevent a storm of needData()/haveData() calls, only to be called on the main thread.
475 : *
476 : * @param[in] mediaSourceType : The media source type.
477 : */
478 : void scheduleNotifyNeedMediaData(MediaSourceType mediaSourceType);
479 :
480 : /**
481 : * @brief Set the target volume level with a transition internally, only to be called on the main thread.
482 : *
483 : * @param[in] targetVolume : Target volume level (0.0 - 1.0)
484 : * @param[in] volumeDuration : Duration of the volume transition in milliseconds
485 : * @param[in] ease_type : Easing type for the volume transition
486 : *
487 : * @retval true on success, false otherwise
488 : */
489 : bool setVolumeInternal(double targetVolume, uint32_t volumeDuration, EaseType easeType);
490 :
491 : /**
492 : * @brief Get the current volume level internally, only to be called on the main thread.
493 : * Fetches the current volume level for the pipeline.
494 : *
495 : * @param[out] currentVolume : Current volume level (range 0.0 - 1.0)
496 : *
497 : * @retval true on success, false otherwise
498 : */
499 : bool getVolumeInternal(double ¤tVolume);
500 :
501 : /**
502 : * @brief Set mute internally, only to be called on the main thread.
503 : *
504 : * @param[in] mute Desired mute state, true=muted, false=not muted
505 : *
506 : * @retval true on success false otherwise
507 : */
508 : bool setMuteInternal(std::int32_t sourceId, bool mute);
509 :
510 : /**
511 : * @brief Get mute internally, only to be called on the main thread.
512 : *
513 : * @param[out] mute Current mute state
514 : *
515 : * @retval true on success false otherwise
516 : */
517 : bool getMuteInternal(std::int32_t sourceId, bool &mute);
518 :
519 : /**
520 : * @brief Change Text Track Identifier
521 : *
522 : * @param[in] textTrackIdentifier Text track identifier of subtitle stream
523 : *
524 : * @retval true on success false otherwise
525 : */
526 : bool setTextTrackIdentifierInternal(const std::string &textTrackIdentifier);
527 :
528 : /**
529 : * @brief Get Text Track Identifier
530 : *
531 : * @param[in] textTrackIdentifier Text track identifier of subtitle stream
532 : *
533 : * @retval true on success false otherwise
534 : */
535 : bool getTextTrackIdentifierInternal(std::string &textTrackIdentifier);
536 :
537 : /**
538 : * @brief Set low latency internally, only to be called on the main thread.
539 : *
540 : * @param[in] lowLatency : The low latency value to set.
541 : *
542 : * @retval true on success false otherwise
543 : */
544 : bool setLowLatencyInternal(bool lowLatency);
545 :
546 : /**
547 : * @brief Set sync internally, only to be called on the main thread.
548 : *
549 : * @param[in] sync : The sync value to set.
550 : *
551 : * @retval true on success false otherwise
552 : */
553 : bool setSyncInternal(bool sync);
554 :
555 : /**
556 : * @brief Get sync internally, only to be called on the main thread.
557 : *
558 : * @param[out] sync : Current sync value.
559 : *
560 : * @retval true on success false otherwise
561 : */
562 : bool getSyncInternal(bool &sync);
563 :
564 : /**
565 : * @brief Set sync off internally, only to be called on the main thread.
566 : *
567 : * @param[in] syncOff : The sync off value to set.
568 : *
569 : * @retval true on success false otherwise
570 : */
571 : bool setSyncOffInternal(bool syncOff);
572 :
573 : /**
574 : * @brief Set stream sync mode internally, only to be called on the main thread.
575 : *
576 : * @param[in] sourceId : The source id. Value should be set to the MediaSource.id returned after attachSource()
577 : * @param[in] streamSyncMode : The stream sync mode value to set.
578 : *
579 : * @retval true on success false otherwise
580 : */
581 : bool setStreamSyncModeInternal(int32_t sourceId, int32_t streamSyncMode);
582 :
583 : /**
584 : * @brief Get stream sync mode internally, only to be called on the main thread.
585 : *
586 : * @param[out] streamSyncMode : Current stream sync mode value.
587 : *
588 : * @retval true on success false otherwise
589 : */
590 : bool getStreamSyncModeInternal(int32_t &streamSyncMode);
591 :
592 : /**
593 : * @brief Checks if MediaPipeline threads are not deadlocked internally
594 : *
595 : * @param[out] heartbeatHandler : The heartbeat handler instance
596 : */
597 : void pingInternal(std::unique_ptr<IHeartbeatHandler> &&heartbeatHandler);
598 :
599 : /**
600 : * @brief Flushes a source.
601 : *
602 : * @param[in] sourceId : The source id. Value should be set to the MediaSource.id returned after attachSource()
603 : * @param[in] resetTime : True if time should be reset
604 : * @param[out] async : True if flushed source is asynchronous (will preroll after flush)
605 : *
606 : * @retval true on success.
607 : */
608 : bool flushInternal(int32_t sourceId, bool resetTime, bool &async);
609 :
610 : /**
611 : * @brief Set the source position in nanoseconds.
612 : *
613 : * This method sets the start position for a source.
614 : *
615 : * @param[in] sourceId : The source id. Value should be set to the MediaSource.id returned after attachSource()
616 : * @param[in] position : The position in nanoseconds.
617 : * @param[in] resetTime : True if time should be reset
618 : * @param[in] appliedRate : The applied rate after seek
619 : * @param[in] stopPosition : The position of last pushed buffer
620 : *
621 : * @retval true on success.
622 : */
623 : bool setSourcePositionInternal(int32_t sourceId, int64_t position, bool resetTime, double appliedRate,
624 : uint64_t stopPosition);
625 :
626 : /**
627 : * @brief Set subtitle offset for a subtitle source.
628 : *
629 : * This method is used to set the subtitle offset for a subtitle source.
630 : *
631 : * @param[in] sourceId : The id of the subtitle source
632 : * @param[in] position : The subtitle offset position in nanoseconds
633 : *
634 : * @retval true on success.
635 : */
636 : bool setSubtitleOffsetInternal(int32_t sourceId, int64_t position);
637 :
638 : /**
639 : * @brief Process audio gap
640 : *
641 : * This method handles audio gap in order to avoid audio pops during transitions.
642 : *
643 : * @param[in] position : Audio pts fade position
644 : * @param[in] duration : Audio pts fade duration
645 : * @param[in] discontinuityGap : Audio discontinuity gap
646 : * @param[in] audioAac : True if audio codec is AAC
647 : *
648 : * @retval true on success.
649 : */
650 : bool processAudioGapInternal(int64_t position, uint32_t duration, int64_t discontinuityGap, bool audioAac);
651 :
652 : /**
653 : * @brief Set buffering limit
654 : *
655 : * This method enables/disables limit buffering and sets millisecond threshold used.
656 : * Use kInvalidLimitBuffering to disable limit buffering
657 : *
658 : * @param[in] limitBufferingMs : buffering limit in ms
659 : *
660 : * @retval true on success.
661 : */
662 : bool setBufferingLimitInternal(uint32_t limitBufferingMs);
663 :
664 : /**
665 : * @brief Get buffering limit
666 : *
667 : * This method returns current value of buffering limit in milliseconds
668 : * Method will return kInvalidLimitBuffering limit buffering is disabled
669 : *
670 : * @param[out] limitBufferingMs : buffering limit in ms
671 : *
672 : * @retval true on success.
673 : */
674 : bool getBufferingLimitInternal(uint32_t &limitBufferingMs);
675 :
676 : /**
677 : * @brief Enables/disables the buffering option
678 : *
679 : * This method enables the buffering option so that BUFFERING messages are
680 : * emitted based on low-/high-percent thresholds.
681 : *
682 : * @param[in] useBuffering : true if buffering option enabled.
683 : *
684 : * @retval true on success.
685 : */
686 : bool setUseBufferingInternal(bool useBuffering);
687 :
688 : /**
689 : * @brief Checks, if buffering is enabled
690 : *
691 : * This method returns true, if buffering is enabled
692 : *
693 : * @param[out] useBuffering : true if buffering option is enabled.
694 : *
695 : * @retval true on success.
696 : */
697 : bool getUseBufferingInternal(bool &useBuffering);
698 :
699 : /**
700 : * @brief Switches a source.
701 : *
702 : * @param[in] mediaSource : The media source.
703 : *
704 : */
705 : bool switchSourceInternal(const std::unique_ptr<MediaSource> &source);
706 :
707 : /**
708 : * @brief Returns how long should we wait to send next NeedMediaData
709 : * if rialto client returns NO_AVAILABLE_SAMPLES
710 : *
711 : * @param[in] mediaSourceType : The media source type.
712 : *
713 : * @retval NeedMediaData timeout
714 : */
715 : std::chrono::milliseconds getNeedMediaDataTimeout(MediaSourceType mediaSourceType) const;
716 : };
717 :
718 : }; // namespace firebolt::rialto::server
719 :
720 : #endif // FIREBOLT_RIALTO_SERVER_MEDIA_PIPELINE_SERVER_INTERNAL_H_
|