Skip to content
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ if( NATIVE_BUILD )
add_subdirectory( stubs/opencdm )
add_subdirectory( stubs/wpeframework-core )
add_subdirectory( stubs/wpeframework-com )
add_subdirectory( stubs/rdk_perf )

add_compile_options(-DFREE_MEM_BEFORE_EXIT)
add_compile_options(-ggdb)
Expand Down
2 changes: 2 additions & 0 deletions media/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ target_include_directories (
$<TARGET_PROPERTY:RialtoServerService,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:RialtoPlayerPublic,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:RialtoCommon,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:RialtoWrappers,INTERFACE_INCLUDE_DIRECTORIES>
)

set_target_properties(
Expand All @@ -61,6 +62,7 @@ target_link_libraries(
RialtoServerIpc
RialtoServerMain
RialtoServerService
RialtoWrappers
protobuf::libprotobuf
)

Expand Down
10 changes: 10 additions & 0 deletions media/server/gstplayer/include/GstGenericPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "IGstProtectionMetadataHelperFactory.h"
#include "IGstSrc.h"
#include "IGstWrapper.h"
#include "IRdkPerfWrapper.h"
#include "ITimer.h"
#include "IWorkerThread.h"
#include "tasks/IGenericPlayerTaskFactory.h"
Expand Down Expand Up @@ -80,19 +81,23 @@ class GstGenericPlayer : public IGstGenericPlayer, public IGstGenericPlayerPriva
* @param[in] videoRequirements : The video requirements for the playback.
* @param[in] gstWrapper : The gstreamer wrapper.
* @param[in] glibWrapper : The glib wrapper.
* @param[in] rdkGstreamerUtilsWrapper : The rdk gstreamer utils wrapper
* @param[in] rdkPerfWrapperFactory : The rdk perf wrapper factory
* @param[in] gstInitialiser : The gst initialiser
* @param[in] flushWatcher : The flush watcher
* @param[in] gstSrcFactory : The gstreamer rialto src factory.
* @param[in] timerFactory : The Timer factory
* @param[in] taskFactory : The task factory
* @param[in] workerThreadFactory : The worker thread factory
* @param[in] gstDispatcherThreadFactory : The gst dispatcher thread factory
* @param[in] gstProtectionMetadataFactory : The gst protection metadata helper factory
*/
GstGenericPlayer(IGstGenericPlayerClient *client, IDecryptionService &decryptionService, MediaType type,
const VideoRequirements &videoRequirements,
const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> &glibWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IRdkGstreamerUtilsWrapper> &rdkGstreamerUtilsWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IRdkPerfWrapperFactory> &rdkPerfWrapperFactory,
const IGstInitialiser &gstInitialiser, std::unique_ptr<IFlushWatcher> &&flushWatcher,
const std::shared_ptr<IGstSrcFactory> &gstSrcFactory,
std::shared_ptr<common::ITimerFactory> timerFactory,
Expand Down Expand Up @@ -431,6 +436,11 @@ class GstGenericPlayer : public IGstGenericPlayer, public IGstGenericPlayerPriva
*/
std::shared_ptr<firebolt::rialto::wrappers::IRdkGstreamerUtilsWrapper> m_rdkGstreamerUtilsWrapper;

/**
* @brief The rdk perf wrapper factory object
*/
std::shared_ptr<firebolt::rialto::wrappers::IRdkPerfWrapperFactory> m_rdkPerfWrapperFactory;

/**
* @brief Thread for handling player tasks.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "IGstTextTrackSinkFactory.h"
#include "IGstWrapper.h"
#include "IMediaPipeline.h"
#include "IRdkPerfWrapper.h"
#include <memory>
#include <string>

Expand All @@ -38,6 +39,7 @@ class GenericPlayerTaskFactory : public IGenericPlayerTaskFactory
IGstGenericPlayerClient *client, const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> &glibWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IRdkGstreamerUtilsWrapper> &rdkGstreamerUtilsWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IRdkPerfWrapperFactory> &rdkPerfWrapperFactory,
const std::shared_ptr<IGstTextTrackSinkFactory> &gstTextTrackSinkFactory);
~GenericPlayerTaskFactory() override = default;

Expand Down Expand Up @@ -140,6 +142,7 @@ class GenericPlayerTaskFactory : public IGenericPlayerTaskFactory
std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> m_gstWrapper;
std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> m_glibWrapper;
std::shared_ptr<firebolt::rialto::wrappers::IRdkGstreamerUtilsWrapper> m_rdkGstreamerUtilsWrapper;
std::shared_ptr<firebolt::rialto::wrappers::IRdkPerfWrapperFactory> m_rdkPerfWrapperFactory;
std::shared_ptr<IGstTextTrackSinkFactory> m_gstTextTrackSinkFactory;
};
} // namespace firebolt::rialto::server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,26 @@
#include "IGstGenericPlayerPrivate.h"
#include "IGstWrapper.h"
#include "IPlayerTask.h"
#include "IRdkPerfWrapper.h"
#include <memory>

namespace firebolt::rialto::server::tasks::generic
{
class ReadShmDataAndAttachSamples : public IPlayerTask
{
public:
ReadShmDataAndAttachSamples(GenericPlayerContext &context,
const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
IGstGenericPlayerPrivate &player, const std::shared_ptr<IDataReader> &dataReader);
ReadShmDataAndAttachSamples(
GenericPlayerContext &context, const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IRdkPerfWrapperFactory> &rdkPerfWrapperFactory,
IGstGenericPlayerPrivate &player, const std::shared_ptr<IDataReader> &dataReader);
~ReadShmDataAndAttachSamples() override;
void execute() const override;

private:
void attachData(const firebolt::rialto::MediaSourceType mediaType, GstBuffer *buffer) const;
GenericPlayerContext &m_context;
std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> m_gstWrapper;
std::shared_ptr<firebolt::rialto::wrappers::IRdkPerfWrapperFactory> m_rdkPerfWrapperFactory;
IGstGenericPlayerPrivate &m_player;
std::shared_ptr<IDataReader> m_dataReader;
};
Expand Down
18 changes: 13 additions & 5 deletions media/server/gstplayer/source/GstGenericPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ std::unique_ptr<IGstGenericPlayer> GstGenericPlayerFactory::createGstGenericPlay
{
auto gstWrapperFactory = firebolt::rialto::wrappers::IGstWrapperFactory::getFactory();
auto glibWrapperFactory = firebolt::rialto::wrappers::IGlibWrapperFactory::getFactory();
auto rdkPerfWrapperFactory = firebolt::rialto::wrappers::IRdkPerfWrapperFactory::createFactory();
std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> gstWrapper;
std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> glibWrapper;
std::shared_ptr<firebolt::rialto::wrappers::IRdkGstreamerUtilsWrapper> rdkGstreamerUtilsWrapper;
Expand All @@ -105,12 +106,17 @@ std::unique_ptr<IGstGenericPlayer> GstGenericPlayerFactory::createGstGenericPlay
{
throw std::runtime_error("Cannot create RdkGstreamerUtilsWrapper");
}
if (!rdkPerfWrapperFactory)
{
throw std::runtime_error("Cannot create RdkPerfWrapperFactory");
}
gstPlayer = std::make_unique<
GstGenericPlayer>(client, decryptionService, type, videoRequirements, gstWrapper, glibWrapper,
rdkGstreamerUtilsWrapper, IGstInitialiser::instance(), std::make_unique<FlushWatcher>(),
IGstSrcFactory::getFactory(), common::ITimerFactory::getFactory(),
rdkGstreamerUtilsWrapper, rdkPerfWrapperFactory, IGstInitialiser::instance(),
std::make_unique<FlushWatcher>(), IGstSrcFactory::getFactory(),
common::ITimerFactory::getFactory(),
std::make_unique<GenericPlayerTaskFactory>(client, gstWrapper, glibWrapper,
rdkGstreamerUtilsWrapper,
rdkGstreamerUtilsWrapper, rdkPerfWrapperFactory,
IGstTextTrackSinkFactory::createFactory()),
std::make_unique<WorkerThreadFactory>(), std::make_unique<GstDispatcherThreadFactory>(),
IGstProtectionMetadataHelperFactory::createFactory());
Expand All @@ -129,14 +135,15 @@ GstGenericPlayer::GstGenericPlayer(
const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> &glibWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IRdkGstreamerUtilsWrapper> &rdkGstreamerUtilsWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IRdkPerfWrapperFactory> &rdkPerfWrapperFactory,
const IGstInitialiser &gstInitialiser, std::unique_ptr<IFlushWatcher> &&flushWatcher,
const std::shared_ptr<IGstSrcFactory> &gstSrcFactory, std::shared_ptr<common::ITimerFactory> timerFactory,
std::unique_ptr<IGenericPlayerTaskFactory> taskFactory, std::unique_ptr<IWorkerThreadFactory> workerThreadFactory,
std::unique_ptr<IGstDispatcherThreadFactory> gstDispatcherThreadFactory,
std::shared_ptr<IGstProtectionMetadataHelperFactory> gstProtectionMetadataFactory)
: m_gstPlayerClient(client), m_gstWrapper{gstWrapper}, m_glibWrapper{glibWrapper},
m_rdkGstreamerUtilsWrapper{rdkGstreamerUtilsWrapper}, m_timerFactory{timerFactory},
m_taskFactory{std::move(taskFactory)}, m_flushWatcher{std::move(flushWatcher)}
m_rdkGstreamerUtilsWrapper{rdkGstreamerUtilsWrapper}, m_rdkPerfWrapperFactory{rdkPerfWrapperFactory},
m_timerFactory{timerFactory}, m_taskFactory{std::move(taskFactory)}, m_flushWatcher{std::move(flushWatcher)}
{
RIALTO_SERVER_LOG_DEBUG("GstGenericPlayer is constructed.");

Expand Down Expand Up @@ -1471,6 +1478,7 @@ void GstGenericPlayer::pushSampleIfRequired(GstElement *source, const std::strin
// GstAppSrc does not replace segment, if it's the same as previous one.
// It causes problems with position reporing in amlogic devices, so we need to push
// two segments with different reset time value.
auto perf = m_rdkPerfWrapperFactory->createRdkPerfWrapper(__FUNCTION__);
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perf is never used, and the repo builds with -Werror, so this will fail compilation due to -Wunused-variable. If the intent is RAII timing, mark it [[maybe_unused]] or explicitly cast to void while keeping it in scope.

Suggested change
auto perf = m_rdkPerfWrapperFactory->createRdkPerfWrapper(__FUNCTION__);
auto perf = m_rdkPerfWrapperFactory->createRdkPerfWrapper(__FUNCTION__);
static_cast<void>(perf);

Copilot uses AI. Check for mistakes.
pushAdditionalSegmentIfRequired(source);

for (const auto &[position, resetTime, appliedRate, stopPosition] : initialPosition->second)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ GenericPlayerTaskFactory::GenericPlayerTaskFactory(
IGstGenericPlayerClient *client, const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> &glibWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IRdkGstreamerUtilsWrapper> &rdkGstreamerUtilsWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IRdkPerfWrapperFactory> &rdkPerfWrapperFactory,
const std::shared_ptr<IGstTextTrackSinkFactory> &gstTextTrackSinkFactory)
: m_client{client}, m_gstWrapper{gstWrapper}, m_glibWrapper{glibWrapper},
m_rdkGstreamerUtilsWrapper{rdkGstreamerUtilsWrapper}, m_gstTextTrackSinkFactory{gstTextTrackSinkFactory}
m_rdkGstreamerUtilsWrapper{rdkGstreamerUtilsWrapper}, m_rdkPerfWrapperFactory{rdkPerfWrapperFactory},
m_gstTextTrackSinkFactory{gstTextTrackSinkFactory}
{
}

Expand Down Expand Up @@ -144,7 +146,8 @@ std::unique_ptr<IPlayerTask> GenericPlayerTaskFactory::createPlay(IGstGenericPla
std::unique_ptr<IPlayerTask> GenericPlayerTaskFactory::createReadShmDataAndAttachSamples(
GenericPlayerContext &context, IGstGenericPlayerPrivate &player, const std::shared_ptr<IDataReader> &dataReader) const
{
return std::make_unique<tasks::generic::ReadShmDataAndAttachSamples>(context, m_gstWrapper, player, dataReader);
return std::make_unique<tasks::generic::ReadShmDataAndAttachSamples>(context, m_gstWrapper, m_rdkPerfWrapperFactory,
player, dataReader);
}

std::unique_ptr<IPlayerTask> GenericPlayerTaskFactory::createReportPosition(GenericPlayerContext &context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ namespace firebolt::rialto::server::tasks::generic
{
ReadShmDataAndAttachSamples::ReadShmDataAndAttachSamples(
GenericPlayerContext &context, const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
const std::shared_ptr<firebolt::rialto::wrappers::IRdkPerfWrapperFactory> &rdkPerfWrapperFactory,
IGstGenericPlayerPrivate &player, const std::shared_ptr<IDataReader> &dataReader)
: m_context{context}, m_gstWrapper{gstWrapper}, m_player{player}, m_dataReader{dataReader}
: m_context{context}, m_gstWrapper{gstWrapper}, m_rdkPerfWrapperFactory{rdkPerfWrapperFactory}, m_player{player},
m_dataReader{dataReader}
{
RIALTO_SERVER_LOG_DEBUG("Constructing ReadShmDataAndAttachSamples");
}
Expand All @@ -43,6 +45,7 @@ ReadShmDataAndAttachSamples::~ReadShmDataAndAttachSamples()
void ReadShmDataAndAttachSamples::execute() const
{
RIALTO_SERVER_LOG_DEBUG("Executing ReadShmDataAndAttachSamples");
auto perf = m_rdkPerfWrapperFactory->createRdkPerfWrapper(__FUNCTION__);
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perf is never used, and the build uses -Werror, so this will fail compilation with -Wunused-variable. If this is RAII-only instrumentation, mark it [[maybe_unused]] or cast to void while keeping it alive for the intended scope.

Suggested change
auto perf = m_rdkPerfWrapperFactory->createRdkPerfWrapper(__FUNCTION__);
[[maybe_unused]] auto perf = m_rdkPerfWrapperFactory->createRdkPerfWrapper(__FUNCTION__);

Copilot uses AI. Check for mistakes.
// Read media segments from shared memory
IMediaPipeline::MediaSegmentVector mediaSegments = m_dataReader->readData();

Expand Down
2 changes: 2 additions & 0 deletions media/server/service/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "IApplicationSessionServer.h"
#include "IGstInitialiser.h"
#include "IRdkPerfWrapper.h"
#include "RialtoServerLogging.h"

// NOLINT(build/filename_format)
Expand All @@ -31,6 +32,7 @@ int main(int argc, char *argv[])
const char kSrcRev[] = SRCREV;
const char kTags[] = TAGS;

auto perf = firebolt::rialto::wrappers::IRdkPerfWrapperFactory::createFactory()->createRdkPerfWrapper(__FUNCTION__);
if (std::strlen(kSrcRev) > 0)
{
if (std::strlen(kTags) > 0)
Expand Down
44 changes: 44 additions & 0 deletions stubs/rdk_perf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# If not stated otherwise in this file or this component's LICENSE file the
# following copyright and licenses apply:
#
# Copyright 2026 Sky UK
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set( CMAKE_CXX_STANDARD 17 )

set( CMAKE_CXX_STANDARD_REQUIRED ON )
include( CheckCXXCompilerFlag )
include( GNUInstallDirs )
include(ExternalProject)

add_library(
rdkperf

STATIC
rdk_perf.cpp
)

target_include_directories(
rdkperf

PUBLIC
.
)

install (
TARGETS rdkperf LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
22 changes: 22 additions & 0 deletions stubs/rdk_perf/rdk_perf.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2026 Sky UK
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "rdk_perf.h"

RDKPerf::RDKPerf(const char *szName) {}
27 changes: 27 additions & 0 deletions stubs/rdk_perf/rdk_perf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2026 Sky UK
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

class RDKPerf
{
public:
explicit RDKPerf(const char *szName);
~RDKPerf() = default;
};
36 changes: 36 additions & 0 deletions tests/common/externalLibraryMocks/RdkPerfWrapperFactoryMock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2026 Sky UK
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef FIREBOLT_RIALTO_WRAPPERS_RDK_PERF_WRAPPER_FACTORY_MOCK_H_
#define FIREBOLT_RIALTO_WRAPPERS_RDK_PERF_WRAPPER_FACTORY_MOCK_H_

#include "IRdkPerfWrapper.h"
#include <gmock/gmock.h>
#include <memory>

namespace firebolt::rialto::wrappers
{
class RdkPerfWrapperFactoryMock : public IRdkPerfWrapperFactory
{
public:
MOCK_METHOD(std::unique_ptr<IRdkPerfWrapper>, createRdkPerfWrapper, (const char *), (const, override));
};
} // namespace firebolt::rialto::wrappers

#endif // FIREBOLT_RIALTO_WRAPPERS_RDK_PERF_WRAPPER_FACTORY_MOCK_H_
Loading
Loading