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