Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions media/client/ipc/include/MediaKeysIpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ class MediaKeysIpc : public IMediaKeys, public IpcModule

bool containsKey(int32_t keySessionId, const std::vector<uint8_t> &keyId) override;

MediaKeyErrorStatus createKeySession(KeySessionType sessionType, std::weak_ptr<IMediaKeysClient> client, bool isLDL,
MediaKeyErrorStatus createKeySession(KeySessionType sessionType, std::weak_ptr<IMediaKeysClient> client,
int32_t &keySessionId) override;

MediaKeyErrorStatus generateRequest(int32_t keySessionId, InitDataType initDataType,
const std::vector<uint8_t> &initData) override;
const std::vector<uint8_t> &initData,
const LimitedDurationLicense &ldlState) override;

MediaKeyErrorStatus loadSession(int32_t keySessionId) override;

Expand Down
2 changes: 1 addition & 1 deletion media/client/ipc/include/MediaPipelineIpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class MediaPipelineIpc : public IMediaPipelineIpc, public IpcModule

bool setVideoWindow(uint32_t x, uint32_t y, uint32_t width, uint32_t height) override;

bool play() override;
bool play(bool &async) override;

bool pause() override;

Expand Down
4 changes: 3 additions & 1 deletion media/client/ipc/interface/IMediaPipelineIpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,11 @@ class IMediaPipelineIpc
/**
* @brief Request play on the playback session.
*
* @param[out] async : True if play method call is asynchronous
*
* @retval true on success.
*/
virtual bool play() = 0;
virtual bool play(bool &async) = 0;

/**
* @brief Request pause on the playback session.
Expand Down
25 changes: 22 additions & 3 deletions media/client/ipc/source/MediaKeysIpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ bool MediaKeysIpc::containsKey(int32_t keySessionId, const std::vector<uint8_t>
}

MediaKeyErrorStatus MediaKeysIpc::createKeySession(KeySessionType sessionType, std::weak_ptr<IMediaKeysClient> client,
bool isLDL, int32_t &keySessionId)
int32_t &keySessionId)
{
if (!reattachChannelIfRequired())
{
Expand Down Expand Up @@ -362,7 +362,6 @@ MediaKeyErrorStatus MediaKeysIpc::createKeySession(KeySessionType sessionType, s
firebolt::rialto::CreateKeySessionRequest request;
request.set_media_keys_handle(m_mediaKeysHandle);
request.set_session_type(protoSessionType);
request.set_is_ldl(isLDL);

firebolt::rialto::CreateKeySessionResponse response;
// Default error status to FAIL
Expand All @@ -387,7 +386,8 @@ MediaKeyErrorStatus MediaKeysIpc::createKeySession(KeySessionType sessionType, s
}

MediaKeyErrorStatus MediaKeysIpc::generateRequest(int32_t keySessionId, InitDataType initDataType,
const std::vector<uint8_t> &initData)
const std::vector<uint8_t> &initData,
const LimitedDurationLicense &ldlState)
{
if (!reattachChannelIfRequired())
{
Expand Down Expand Up @@ -415,10 +415,29 @@ MediaKeyErrorStatus MediaKeysIpc::generateRequest(int32_t keySessionId, InitData
break;
}

GenerateRequestRequest_LimitedDurationLicense protoLimitedDurationLicense{
GenerateRequestRequest_LimitedDurationLicense_NOT_SPECIFIED};
switch (ldlState)
{
case LimitedDurationLicense::NOT_SPECIFIED:
protoLimitedDurationLicense = GenerateRequestRequest_LimitedDurationLicense_NOT_SPECIFIED;
break;
case LimitedDurationLicense::ENABLED:
protoLimitedDurationLicense = GenerateRequestRequest_LimitedDurationLicense_ENABLED;
break;
case LimitedDurationLicense::DISABLED:
protoLimitedDurationLicense = GenerateRequestRequest_LimitedDurationLicense_DISABLED;
break;
default:
RIALTO_CLIENT_LOG_WARN("Received unknown limited duration license state");
break;
}

firebolt::rialto::GenerateRequestRequest request;
request.set_media_keys_handle(m_mediaKeysHandle);
request.set_key_session_id(keySessionId);
request.set_init_data_type(protoInitDataType);
request.set_ldl_state(protoLimitedDurationLicense);

for (auto it = initData.begin(); it != initData.end(); it++)
{
Expand Down
4 changes: 3 additions & 1 deletion media/client/ipc/source/MediaPipelineIpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ bool MediaPipelineIpc::setVideoWindow(uint32_t x, uint32_t y, uint32_t width, ui
return true;
}

bool MediaPipelineIpc::play()
bool MediaPipelineIpc::play(bool &async)
{
if (!reattachChannelIfRequired())
{
Expand All @@ -375,6 +375,8 @@ bool MediaPipelineIpc::play()
return false;
}

async = response.async();

return true;
}

Expand Down
5 changes: 3 additions & 2 deletions media/client/main/include/MediaKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ class MediaKeys : public IMediaKeys

bool containsKey(int32_t keySessionId, const std::vector<uint8_t> &keyId) override;

MediaKeyErrorStatus createKeySession(KeySessionType sessionType, std::weak_ptr<IMediaKeysClient> client, bool isLDL,
MediaKeyErrorStatus createKeySession(KeySessionType sessionType, std::weak_ptr<IMediaKeysClient> client,
int32_t &keySessionId) override;

MediaKeyErrorStatus generateRequest(int32_t keySessionId, InitDataType initDataType,
const std::vector<uint8_t> &initData) override;
const std::vector<uint8_t> &initData,
const LimitedDurationLicense &ldlState) override;

MediaKeyErrorStatus loadSession(int32_t keySessionId) override;

Expand Down
2 changes: 1 addition & 1 deletion media/client/main/include/MediaPipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class MediaPipeline : public IMediaPipelineAndIControlClient, public IMediaPipel

bool allSourcesAttached() override;

bool play() override;
bool play(bool &async) override;

bool pause() override;

Expand Down
2 changes: 1 addition & 1 deletion media/client/main/include/MediaPipelineProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MediaPipelineProxy : public IMediaPipelineAndIControlClient

bool allSourcesAttached() override { return m_mediaPipeline->allSourcesAttached(); }

bool play() override { return m_mediaPipeline->play(); }
bool play(bool &async) override { return m_mediaPipeline->play(async); }

bool pause() override { return m_mediaPipeline->pause(); }

Expand Down
9 changes: 5 additions & 4 deletions media/client/main/source/MediaKeys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ bool MediaKeys::containsKey(int32_t keySessionId, const std::vector<uint8_t> &ke
}

MediaKeyErrorStatus MediaKeys::createKeySession(KeySessionType sessionType, std::weak_ptr<IMediaKeysClient> client,
bool isLDL, int32_t &keySessionId)
int32_t &keySessionId)
{
RIALTO_CLIENT_LOG_DEBUG("entry:");

auto result{m_mediaKeysIpc->createKeySession(sessionType, client, isLDL, keySessionId)};
auto result{m_mediaKeysIpc->createKeySession(sessionType, client, keySessionId)};
if (isNetflixPlayready(m_keySystem) && MediaKeyErrorStatus::OK == result)
{
KeyIdMap::instance().addSession(keySessionId);
Expand All @@ -128,11 +128,12 @@ MediaKeyErrorStatus MediaKeys::createKeySession(KeySessionType sessionType, std:
}

MediaKeyErrorStatus MediaKeys::generateRequest(int32_t keySessionId, InitDataType initDataType,
const std::vector<uint8_t> &initData)
const std::vector<uint8_t> &initData,
const LimitedDurationLicense &ldlState)
{
RIALTO_CLIENT_LOG_DEBUG("entry:");

return m_mediaKeysIpc->generateRequest(keySessionId, initDataType, initData);
return m_mediaKeysIpc->generateRequest(keySessionId, initDataType, initData, ldlState);
}

MediaKeyErrorStatus MediaKeys::loadSession(int32_t keySessionId)
Expand Down
4 changes: 2 additions & 2 deletions media/client/main/source/MediaPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,11 @@ bool MediaPipeline::allSourcesAttached()
return m_mediaPipelineIpc->allSourcesAttached();
}

bool MediaPipeline::play()
bool MediaPipeline::play(bool &async)
{
RIALTO_CLIENT_LOG_DEBUG("entry:");

return m_mediaPipelineIpc->play();
return m_mediaPipelineIpc->play(async);
}

bool MediaPipeline::pause()
Expand Down
10 changes: 6 additions & 4 deletions media/public/include/IMediaKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,12 @@ class IMediaKeys
*
* @param[in] sessionType : The session type.
* @param[in] client : Client object for callbacks
* @param[in] isLDL : Is this an LDL
* @param[out] keySessionId: The key session id
*
* @retval an error status.
*/
virtual MediaKeyErrorStatus createKeySession(KeySessionType sessionType, std::weak_ptr<IMediaKeysClient> client,
bool isLDL, int32_t &keySessionId) = 0;
int32_t &keySessionId) = 0;

/**
* @brief Generates a licence request.
Expand All @@ -130,11 +129,14 @@ class IMediaKeys
* @param[in] keySessionId : The key session id for the session.
* @param[in] initDataType : The init data type.
* @param[in] initData : The init data.
* @param[in] ldlState : The Limited Duration License state. Most of key systems do not need this parameter,
* so the default value is NOT_SPECIFIED.
*
* @retval an error status.
*/
virtual MediaKeyErrorStatus generateRequest(int32_t keySessionId, InitDataType initDataType,
const std::vector<uint8_t> &initData) = 0;
virtual MediaKeyErrorStatus
generateRequest(int32_t keySessionId, InitDataType initDataType, const std::vector<uint8_t> &initData,
const LimitedDurationLicense &ldlState = LimitedDurationLicense::NOT_SPECIFIED) = 0;

/**
* @brief Loads an existing key session
Expand Down
7 changes: 3 additions & 4 deletions media/public/include/IMediaPipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -1119,16 +1119,15 @@ class IMediaPipeline
/**
* @brief Starts playback of the media.
*
* This method is considered to be asynchronous and MUST NOT block
* but should request playback and then return.
*
* Once the backend is successfully playing it should notify the
* media player client of playback state
* IMediaPipelineClient::PlaybackState::PLAYING.
*
* @param[out] async : True if play method call is asynchronous
*
* @retval true on success.
*/
virtual bool play() = 0;
virtual bool play(bool &async) = 0;

/**
* @brief Pauses playback of the media.
Expand Down
10 changes: 10 additions & 0 deletions media/public/include/MediaCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,16 @@ struct PlaybackInfo
int64_t currentPosition{-1}; /**< The current playback position */
double volume{1.0}; /**< The current volume */
};

/**
* @brief Limited duration license state.
*/
enum class LimitedDurationLicense
{
NOT_SPECIFIED, /**< The license duration is not specified */
ENABLED, /**< The license has a limited duration */
DISABLED /**< The license does not have a limited duration */
};
} // namespace firebolt::rialto

#endif // FIREBOLT_RIALTO_MEDIA_COMMON_H_
1 change: 0 additions & 1 deletion media/server/gstplayer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ add_library(
source/tasks/generic/Play.cpp
source/tasks/generic/ProcessAudioGap.cpp
source/tasks/generic/ReadShmDataAndAttachSamples.cpp
source/tasks/generic/RemoveSource.cpp
source/tasks/generic/RenderFrame.cpp
source/tasks/generic/ReportPosition.cpp
source/tasks/generic/SetBufferingLimit.cpp
Expand Down
10 changes: 7 additions & 3 deletions media/server/gstplayer/include/FlushOnPrerollController.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define FIREBOLT_RIALTO_SERVER_FLUSH_ONPREROLL_CONTROLLER_H_

#include "IFlushOnPrerollController.h"
#include <condition_variable>
#include <mutex>
#include <optional>
#include <set>
Expand All @@ -37,13 +38,16 @@ class FlushOnPrerollController : public IFlushOnPrerollController
FlushOnPrerollController() = default;
~FlushOnPrerollController() override = default;

bool shouldPostponeFlush(const MediaSourceType &type) const override;
void setFlushing(const MediaSourceType &type, const GstState &currentPipelineState) override;
void waitIfRequired(const MediaSourceType &type) override;
void setFlushing(const MediaSourceType &type) override;
void setPrerolling() override;
void stateReached(const GstState &newPipelineState) override;
void setTargetState(const GstState &state) override;
void reset() override;

private:
mutable std::mutex m_mutex{};
std::mutex m_mutex{};
std::condition_variable m_conditionVariable{};
std::set<MediaSourceType> m_flushingSources{};
std::optional<GstState> m_targetState{std::nullopt};
bool m_isPrerolled{false};
Expand Down
9 changes: 1 addition & 8 deletions media/server/gstplayer/include/GenericPlayerContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,6 @@ struct GenericPlayerContext
*/
IDecryptionService *decryptionService{nullptr};

/**
* @brief Flag used to check, if audio source has been recently removed
*
* Flag can be used only in worker thread
*/
bool audioSourceRemoved{false};

/**
* @brief Audio elements of gst pipeline.
*
Expand Down Expand Up @@ -270,7 +263,7 @@ struct GenericPlayerContext
/**
* @brief Workaround for the gstreamer flush issue
*/
FlushOnPrerollController flushOnPrerollController;
std::shared_ptr<IFlushOnPrerollController> flushOnPrerollController{std::make_shared<FlushOnPrerollController>()};
};
} // namespace firebolt::rialto::server

Expand Down
7 changes: 7 additions & 0 deletions media/server/gstplayer/include/GstDispatcherThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ class GstDispatcherThreadFactory : public IGstDispatcherThreadFactory
~GstDispatcherThreadFactory() override = default;
std::unique_ptr<IGstDispatcherThread>
createGstDispatcherThread(IGstDispatcherThreadClient &client, GstElement *pipeline,
const std::shared_ptr<IFlushOnPrerollController> &flushOnPrerollController,
const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper) const override;
};

class GstDispatcherThread : public IGstDispatcherThread
{
public:
GstDispatcherThread(IGstDispatcherThreadClient &client, GstElement *pipeline,
const std::shared_ptr<IFlushOnPrerollController> &flushOnPrerollController,
const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper);
~GstDispatcherThread() override;

Expand All @@ -58,6 +60,11 @@ class GstDispatcherThread : public IGstDispatcherThread
*/
IGstDispatcherThreadClient &m_client;

/**
* @brief The flush on preroll controller.
*/
std::shared_ptr<IFlushOnPrerollController> m_flushOnPrerollController;

/**
* @brief The gstreamer wrapper object.
*/
Expand Down
Loading
Loading