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