LCOV - code coverage report
Current view: top level - media/server/main/include - MediaPipelineServerInternal.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2026-07-31 13:30:47 Functions: 100.0 % 2 2

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

Generated by: LCOV version 2.0-1