From 7c1fa73733c907a8b7f18abf3e8f94320f730b7b Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Wed, 15 Apr 2026 02:49:46 +0000 Subject: [PATCH 01/11] RDKEMW-16714: refactor hard-coded array-based approach to a generic Signed-off-by: yuvaramachandran_gurusamy --- ds/frameRate.cpp | 335 ++++++++++++++++++++++++++------------- ds/include/frameRate.hpp | 3 + ds/manager.cpp | 9 ++ 3 files changed, 233 insertions(+), 114 deletions(-) diff --git a/ds/frameRate.cpp b/ds/frameRate.cpp index e5b54bcc..8e8687a8 100644 --- a/ds/frameRate.cpp +++ b/ds/frameRate.cpp @@ -33,136 +33,243 @@ #include "dsTypes.h" #include "dsUtl.h" #include "dslogger.h" - -#define MAX_VIDEO_FRAMERATE_SUPPORTED 18 +#include +#include +#include +#include namespace { - const float _values[MAX_VIDEO_FRAMERATE_SUPPORTED] = { - 0, //unknown - 24, - 25, - 30, - 60, - 23.98, - 29.97, - 50, - 59.94, - 100, - 119.88, - 120, - 200, - 239.76, - 240, - 59, - 23, - 0 //unknown - }; - const char * _names[MAX_VIDEO_FRAMERATE_SUPPORTED] = { - "UnKnown", //unknown - "24", - "25", - "30", - "60", - "23.98", - "29.97", - "50", - "59.94", - "100", - "119.88", - "120", - "200", - "239.76", - "240", - "59", - "23", - "UnKnown" //unknown - }; - - inline bool isValid(int id) { - if ( MAX_VIDEO_FRAMERATE_SUPPORTED <= id ) { - return false; - } - return dsVideoPortFrameRate_isValid(id); - } + typedef struct _frameRateInfo + { + std::string name; + float value; + } + FrameRateInfo; + + std::map _frameRates; + inline bool isValid(int id) { + bool valid = false; + valid = dsVideoPortFrameRate_isValid(id); + // now check if the frame rate id is supported in the map, as some devices may not support all frame rates defined in dsVideoFrameRate_t enum + if (valid) { + auto it = _frameRates.find(static_cast(id)); + if (it == _frameRates.end()) { + valid = false; + INT_WARN("Frame rate id: %d is not supported in the map", id); + } + } + return valid; + } } namespace device { + const int FrameRate::kUnknown = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k24 = dsVIDEO_FRAMERATE_24; + const int FrameRate::k25 = dsVIDEO_FRAMERATE_25; + const int FrameRate::k30 = dsVIDEO_FRAMERATE_30; + const int FrameRate::k60 = dsVIDEO_FRAMERATE_60; + const int FrameRate::k23dot98 = dsVIDEO_FRAMERATE_23dot98; + const int FrameRate::k29dot97 = dsVIDEO_FRAMERATE_29dot97; + const int FrameRate::k50 = dsVIDEO_FRAMERATE_50; + const int FrameRate::k59dot94 = dsVIDEO_FRAMERATE_59dot94; + const int FrameRate::kMax = dsVIDEO_FRAMERATE_MAX; -const int FrameRate::kUnknown = dsVIDEO_FRAMERATE_UNKNOWN; -const int FrameRate::k24 = dsVIDEO_FRAMERATE_24; -const int FrameRate::k25 = dsVIDEO_FRAMERATE_25; -const int FrameRate::k30 = dsVIDEO_FRAMERATE_30; -const int FrameRate::k60 = dsVIDEO_FRAMERATE_60; -const int FrameRate::k23dot98 = dsVIDEO_FRAMERATE_23dot98; -const int FrameRate::k29dot97 = dsVIDEO_FRAMERATE_29dot97; -const int FrameRate::k50 = dsVIDEO_FRAMERATE_50; -const int FrameRate::k59dot94 = dsVIDEO_FRAMERATE_59dot94; -const int FrameRate::kMax = dsVIDEO_FRAMERATE_MAX; - -const FrameRate & FrameRate::getInstance(int id) -{ - if (::isValid(id)) { - return VideoOutputPortConfig::getInstance().getFrameRate(id); - } - else { - throw IllegalArgumentException(); - } -} + void initializeFrameRates() { + _frameRates.clear(); + _frameRates.insert({dsVIDEO_FRAMERATE_UNKNOWN, {"Unknown", 0}}); -FrameRate::FrameRate(int id) -{ - if (::isValid(id)) { - _value = _values[id]; - _name = std::string(_names[id]); - _id = id; - } - else { - throw IllegalArgumentException(); - } + INT_INFO("Initializing frame rates map with supported frame rates, count: %d", dsVIDEO_FRAMERATE_MAX); -} + for (size_t i = dsVIDEO_FRAMERATE_UNKNOWN + 1; i < dsVIDEO_FRAMERATE_MAX; i++) { + FrameRateInfo framerateInfo; + framerateInfo.name.clear(); + framerateInfo.value = 0; -FrameRate::FrameRate(float value) : _value(value){ - if (_value == 24.0) { - _id = dsVIDEO_FRAMERATE_24; - } - else if (_value == 25.0) { - _id = dsVIDEO_FRAMERATE_25; - } - else if (_value == 30.0) { - _id = dsVIDEO_FRAMERATE_30; - } - else if (_value == 60.0) { - _id = dsVIDEO_FRAMERATE_60; - } - else if (_value == 23.98) { - _id = dsVIDEO_FRAMERATE_23dot98; - } - else if (_value == 29.97) { - _id = dsVIDEO_FRAMERATE_29dot97; - } - else if (_value == 50.0) { - _id = dsVIDEO_FRAMERATE_50; - } - else if (_value == 59.94) { - _id = dsVIDEO_FRAMERATE_59dot94; - } - else { - throw IllegalArgumentException(); - } - _name = std::string(_names[_id]); -} + switch (i) { + case dsVIDEO_FRAMERATE_24: { + framerateInfo.value = 24.0f; + } + break; + case dsVIDEO_FRAMERATE_25: { + framerateInfo.value = 25.0f; + } + break; + case dsVIDEO_FRAMERATE_30: { + framerateInfo.value = 30.0f; + } + break; + case dsVIDEO_FRAMERATE_60: { + framerateInfo.value = 60.0f; + } + break; + case dsVIDEO_FRAMERATE_23dot98: { + framerateInfo.value = 23.98f; + } + break; + case dsVIDEO_FRAMERATE_29dot97: { + framerateInfo.value = 29.97f; + } + break; + case dsVIDEO_FRAMERATE_50: { + framerateInfo.value = 50.0f; + } + break; + case dsVIDEO_FRAMERATE_59dot94: { + framerateInfo.value = 59.94f; + } + break; + case dsVIDEO_FRAMERATE_100: { + framerateInfo.value = 100.0f; + } + break; + case dsVIDEO_FRAMERATE_119dot88: { + framerateInfo.value = 119.88f; + } + break; + case dsVIDEO_FRAMERATE_120: { + framerateInfo.value = 120.0f; + } + break; + case dsVIDEO_FRAMERATE_200: { + framerateInfo.value = 200.0f; + } + break; + case dsVIDEO_FRAMERATE_239dot76: { + framerateInfo.value = 239.76f; + } + break; + case dsVIDEO_FRAMERATE_240: { + framerateInfo.value = 240.0f; + } + break; + #if 0 // dsVIDEO_FRAMERATE_59 and dsVIDEO_FRAMERATE_23 are not supported in all devices, this will be enabled once all devices support them + case dsVIDEO_FRAMERATE_59: { + framerateInfo.value = 59.0f; + } + break; + case dsVIDEO_FRAMERATE_23: { + framerateInfo.value = 23.0f; + } + break; + #endif + default: { + framerateInfo.name = "Unknown"; + INT_WARN("Invalid frame rate id: %d", i); + } + break; + } + if (framerateInfo.name.empty()) { + char buf[64] = {0}; + std::string tempFloatName = "Unknown"; -FrameRate::~FrameRate() { - // TODO Auto-generated destructor stub -} + // e.g. 24.0f -> "24", 23.98f -> "23.98", 119.88f -> "119.88" + // e.g. 59.94f -> "59.94", 119.88f -> "119.88", 239.76f -> "239.76" + // e.g. 100.0f -> "100", 200.0f -> "200", 240.0f -> "240" + // e.g. 59.946f -> "59.946", 59.9467f -> "59.9467" + int len = std::snprintf( buf, sizeof(buf), "%.*g", std::numeric_limits::max_digits10, framerateInfo.value ); + if (len > 0 && len < static_cast(sizeof(buf))) { + tempFloatName = std::string(buf); + // remove trailing zeros and decimal point if not needed, e.g. "24.0" -> "24", "23.980000" -> "23.98", "100.00" -> "100" + tempFloatName.erase(tempFloatName.find_last_not_of('0') + 1, std::string::npos); + if (tempFloatName.back() == '.') { + tempFloatName.pop_back(); + } + framerateInfo.name = tempFloatName; + } + else { + INT_WARN("Failed to convert frame rate value: %f to string for frame rate id: %d", framerateInfo.value, i); + } + } + INT_INFO("Frame rate id: %d, name: %s, value: %f", i, framerateInfo.name.c_str(), framerateInfo.value); + // inserting the frame rate info in the map with frame rate id as key and FrameRateInfo struct as value + _frameRates.insert({static_cast(i), framerateInfo}); + } + } + void dumpFrameRates() { + if ( -1 == access("/opt/dsMgrDumpFramerates", F_OK) ) { + INT_INFO("Dumping of frame rates is disabled"); + return; + } + for (const auto& frameRate : _frameRates) { + INT_INFO("Frame rate id: %d, name: %s, value: %f", frameRate.first, frameRate.second.name.c_str(), frameRate.second.value); + } + } -} + void deinitializeFrameRates() { + _frameRates.clear(); + } + const FrameRate & FrameRate::getInstance(int id) + { + if (::isValid(id)) { + return VideoOutputPortConfig::getInstance().getFrameRate(id); + } + else { + throw IllegalArgumentException(); + } + } + + const FrameRate & FrameRate::getInstance(const std::string &name) + { + for (const auto& frameRate : _frameRates) { + if (frameRate.second.name == name) { + return VideoOutputPortConfig::getInstance().getFrameRate(frameRate.first); + } + } + throw IllegalArgumentException(); + } + + FrameRate::FrameRate(int id) + { + if (::isValid(id)) { + auto it = _frameRates.find(static_cast(id)); + if (it != _frameRates.end()) { + _value = it->second.value; + _name = it->second.name; + _id = id; + INT_INFO("Creating FrameRate with id: %d, name: %s, value: %f", _id, _name.c_str(), _value); + } + else { + // this should never happen as we are already validating the id, but adding this check to avoid potential crash in case of map lookup failure + INT_ERROR("Frame rate id: %d is valid but not found in the map", id); + throw IllegalArgumentException(); + } + } + else { + throw IllegalArgumentException(); + } + + } + + FrameRate::FrameRate(float value) : _value(value){ + for (const auto& frameRate : _frameRates) { + // check if the value matches with any of the supported frame rates in the map, if found initialize the FrameRate object with corresponding name and id + if (std::fabs(frameRate.second.value - value) < std::numeric_limits::epsilon()) { + _name = frameRate.second.name; + _id = frameRate.first; + INT_INFO("Creating FrameRate with id: %d, name: %s, value: %f", _id, _name.c_str(), _value); + return; + } + } + // if the value is not found in the map, throw exception + throw IllegalArgumentException(); + } + + FrameRate::~FrameRate() { + // TODO Auto-generated destructor stub + for (const auto& frameRate : _frameRates) { + if (frameRate.first == _id) { + INT_INFO("Destroying FrameRate with id: %d, name: %s, value: %f", frameRate.first, frameRate.second.name.c_str(), frameRate.second.value); + return; + } + } + _frameRates.clear(); + } +} /** @} */ /** @} */ diff --git a/ds/include/frameRate.hpp b/ds/include/frameRate.hpp index a8d4b150..a993e411 100644 --- a/ds/include/frameRate.hpp +++ b/ds/include/frameRate.hpp @@ -40,6 +40,9 @@ #include namespace device { + void initializeFrameRates(); + void dumpFrameRates(); + void deinitializeFrameRates(); /** * @class FrameRate diff --git a/ds/manager.cpp b/ds/manager.cpp index 7c88ed71..f2bba632 100644 --- a/ds/manager.cpp +++ b/ds/manager.cpp @@ -292,6 +292,12 @@ void Manager::Initialize() err = initializeFunctionWithRetry("dsVideoDeviceInit", dsVideoDeviceInit); CHECK_RET_VAL(err); + + // initialize the frame rates map with supported frame rates, as some of the APIs in this module depend on this map to return the supported frame rates and its values. + initializeFrameRates(); + + // dump the supported frame rates to the log for debugging purposes, as some of the frame rate related APIs depend on this map to return the supported frame rates and its values. + dumpFrameRates(); loadDeviceCapabilities(device::DEVICE_CAPABILITY_VIDEO_PORT | device::DEVICE_CAPABILITY_AUDIO_PORT | @@ -352,6 +358,9 @@ void Manager::DeInitialize() dsVideoPortTerm(); dsAudioPortTerm(); dsDisplayTerm(); + + // deinitialize the frame rates map to release the resources allocated for the map and its contents, as some of the frame rate APIs depend on this map to return the supported frame rates and its values. + deinitializeFrameRates(); } } INT_INFO("Exiting ... with thread %lu",pthread_self()); From 0e49a2c4248d66bd838770bbce711cb3efda3af0 Mon Sep 17 00:00:00 2001 From: Yuvaramachandran Gurusamy <123441336+yuvaramachandran-gurusamy@users.noreply.github.com> Date: Wed, 15 Apr 2026 08:51:51 +0530 Subject: [PATCH 02/11] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- ds/frameRate.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ds/frameRate.cpp b/ds/frameRate.cpp index 8e8687a8..abfd6e4f 100644 --- a/ds/frameRate.cpp +++ b/ds/frameRate.cpp @@ -260,14 +260,6 @@ namespace device { } FrameRate::~FrameRate() { - // TODO Auto-generated destructor stub - for (const auto& frameRate : _frameRates) { - if (frameRate.first == _id) { - INT_INFO("Destroying FrameRate with id: %d, name: %s, value: %f", frameRate.first, frameRate.second.name.c_str(), frameRate.second.value); - return; - } - } - _frameRates.clear(); } } From dc7467e1b86639773d5531229d43bcfd3ded63f3 Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Wed, 15 Apr 2026 03:37:28 +0000 Subject: [PATCH 03/11] RDKEMW-16714: Address CoPilot review comments Signed-off-by: yuvaramachandran_gurusamy --- ds/frameRate.cpp | 8 ++++++++ ds/manager.cpp | 9 --------- ds/videoOutputPortConfig.cpp | 25 ++++++++++++++++--------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/ds/frameRate.cpp b/ds/frameRate.cpp index abfd6e4f..448418d7 100644 --- a/ds/frameRate.cpp +++ b/ds/frameRate.cpp @@ -35,6 +35,8 @@ #include "dslogger.h" #include #include +#include +#include #include #include @@ -47,6 +49,7 @@ namespace { FrameRateInfo; std::map _frameRates; + std::mutex _frameRatesMutex; inline bool isValid(int id) { bool valid = false; @@ -76,6 +79,7 @@ namespace device { const int FrameRate::kMax = dsVIDEO_FRAMERATE_MAX; void initializeFrameRates() { + std::lock_guard lock(_frameRatesMutex); _frameRates.clear(); _frameRates.insert({dsVIDEO_FRAMERATE_UNKNOWN, {"Unknown", 0}}); @@ -190,6 +194,7 @@ namespace device { } void dumpFrameRates() { + std::lock_guard lock(_frameRatesMutex); if ( -1 == access("/opt/dsMgrDumpFramerates", F_OK) ) { INT_INFO("Dumping of frame rates is disabled"); return; @@ -200,6 +205,7 @@ namespace device { } void deinitializeFrameRates() { + std::lock_guard lock(_frameRatesMutex); _frameRates.clear(); } @@ -225,6 +231,7 @@ namespace device { FrameRate::FrameRate(int id) { + std::lock_guard lock(_frameRatesMutex); if (::isValid(id)) { auto it = _frameRates.find(static_cast(id)); if (it != _frameRates.end()) { @@ -246,6 +253,7 @@ namespace device { } FrameRate::FrameRate(float value) : _value(value){ + std::lock_guard lock(_frameRatesMutex); for (const auto& frameRate : _frameRates) { // check if the value matches with any of the supported frame rates in the map, if found initialize the FrameRate object with corresponding name and id if (std::fabs(frameRate.second.value - value) < std::numeric_limits::epsilon()) { diff --git a/ds/manager.cpp b/ds/manager.cpp index f2bba632..7c88ed71 100644 --- a/ds/manager.cpp +++ b/ds/manager.cpp @@ -292,12 +292,6 @@ void Manager::Initialize() err = initializeFunctionWithRetry("dsVideoDeviceInit", dsVideoDeviceInit); CHECK_RET_VAL(err); - - // initialize the frame rates map with supported frame rates, as some of the APIs in this module depend on this map to return the supported frame rates and its values. - initializeFrameRates(); - - // dump the supported frame rates to the log for debugging purposes, as some of the frame rate related APIs depend on this map to return the supported frame rates and its values. - dumpFrameRates(); loadDeviceCapabilities(device::DEVICE_CAPABILITY_VIDEO_PORT | device::DEVICE_CAPABILITY_AUDIO_PORT | @@ -358,9 +352,6 @@ void Manager::DeInitialize() dsVideoPortTerm(); dsAudioPortTerm(); dsDisplayTerm(); - - // deinitialize the frame rates map to release the resources allocated for the map and its contents, as some of the frame rate APIs depend on this map to return the supported frame rates and its values. - deinitializeFrameRates(); } } INT_INFO("Exiting ... with thread %lu",pthread_self()); diff --git a/ds/videoOutputPortConfig.cpp b/ds/videoOutputPortConfig.cpp index faf80a23..6a3d5611 100644 --- a/ds/videoOutputPortConfig.cpp +++ b/ds/videoOutputPortConfig.cpp @@ -345,6 +345,11 @@ void VideoOutputPortConfig::load(videoPortConfigs_t* dynamicVideoPortConfigs) videoPortConfigs_t configuration = {0}; try { + // initialize the frame rates map with supported frame rates. This is required to be done before loading the video port configs as some of the frame rate related APIs depend on this map to return the supported frame rates and its values. + initializeFrameRates(); + + // dump the supported frame rates to the log for debugging purposes, as some of the frame rate related APIs depend on this map to return the supported frame rates and its values. + dumpFrameRates(); /* * Load Constants First. */ @@ -457,15 +462,17 @@ void VideoOutputPortConfig::load(videoPortConfigs_t* dynamicVideoPortConfigs) void VideoOutputPortConfig::release() { try { - _vPixelResolutions.clear(); - _vAspectRatios.clear(); - _vStereoScopieModes.clear(); - _vFrameRates.clear(); - _vPortTypes.clear(); - {std::lock_guard lock(gSupportedResolutionsMutex); - _supportedResolutions.clear(); - } - _vPorts.clear(); + _vPixelResolutions.clear(); + _vAspectRatios.clear(); + _vStereoScopieModes.clear(); + _vFrameRates.clear(); + _vPortTypes.clear(); + {std::lock_guard lock(gSupportedResolutionsMutex); + _supportedResolutions.clear(); + } + _vPorts.clear(); + // deinitialize the frame rates map to release the resources allocated for the map and its contents, as some of the frame rate APIs depend on this map to return the supported frame rates and its values. + deinitializeFrameRates(); } catch (const Exception &e) { throw e; From 7105957fc96e95ed84e330822225b40ae0d55af3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 03:52:48 +0000 Subject: [PATCH 04/11] Fix size_t/int format specifier mismatch in initializeFrameRates log statements Agent-Logs-Url: https://github.com/rdkcentral/devicesettings/sessions/2a1df342-47cc-4d33-85c0-b0963487d4a5 Co-authored-by: yuvaramachandran-gurusamy <123441336+yuvaramachandran-gurusamy@users.noreply.github.com> --- ds/frameRate.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ds/frameRate.cpp b/ds/frameRate.cpp index 448418d7..11bb193a 100644 --- a/ds/frameRate.cpp +++ b/ds/frameRate.cpp @@ -159,7 +159,7 @@ namespace device { #endif default: { framerateInfo.name = "Unknown"; - INT_WARN("Invalid frame rate id: %d", i); + INT_WARN("Invalid frame rate id: %d", static_cast(i)); } break; } @@ -183,11 +183,11 @@ namespace device { framerateInfo.name = tempFloatName; } else { - INT_WARN("Failed to convert frame rate value: %f to string for frame rate id: %d", framerateInfo.value, i); + INT_WARN("Failed to convert frame rate value: %f to string for frame rate id: %d", framerateInfo.value, static_cast(i)); } } - INT_INFO("Frame rate id: %d, name: %s, value: %f", i, framerateInfo.name.c_str(), framerateInfo.value); + INT_INFO("Frame rate id: %d, name: %s, value: %f", static_cast(i), framerateInfo.name.c_str(), framerateInfo.value); // inserting the frame rate info in the map with frame rate id as key and FrameRateInfo struct as value _frameRates.insert({static_cast(i), framerateInfo}); } From 9d262fe2d08decef10c0304824714cac81f782a8 Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Wed, 15 Apr 2026 10:59:05 +0000 Subject: [PATCH 05/11] RDKEMW-16714: Fix Float to string conversion issue Signed-off-by: yuvaramachandran_gurusamy --- ds/frameRate.cpp | 81 +++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/ds/frameRate.cpp b/ds/frameRate.cpp index 448418d7..61eaeba4 100644 --- a/ds/frameRate.cpp +++ b/ds/frameRate.cpp @@ -92,101 +92,95 @@ namespace device { switch (i) { case dsVIDEO_FRAMERATE_24: { - framerateInfo.value = 24.0f; + framerateInfo.value = 24.0; + framerateInfo.name = "24"; } break; case dsVIDEO_FRAMERATE_25: { - framerateInfo.value = 25.0f; + framerateInfo.value = 25.0; + framerateInfo.name = "25"; } break; case dsVIDEO_FRAMERATE_30: { - framerateInfo.value = 30.0f; + framerateInfo.value = 30.0; + framerateInfo.name = "30"; } break; case dsVIDEO_FRAMERATE_60: { - framerateInfo.value = 60.0f; + framerateInfo.value = 60.0; + framerateInfo.name = "60"; } break; case dsVIDEO_FRAMERATE_23dot98: { - framerateInfo.value = 23.98f; + framerateInfo.value = 23.98; + framerateInfo.name = "23.98"; } break; case dsVIDEO_FRAMERATE_29dot97: { - framerateInfo.value = 29.97f; + framerateInfo.value = 29.97; + framerateInfo.name = "29.97"; } break; case dsVIDEO_FRAMERATE_50: { - framerateInfo.value = 50.0f; + framerateInfo.value = 50.0; + framerateInfo.name = "50"; } break; case dsVIDEO_FRAMERATE_59dot94: { - framerateInfo.value = 59.94f; + framerateInfo.value = 59.94; + framerateInfo.name = "59.94"; } break; case dsVIDEO_FRAMERATE_100: { - framerateInfo.value = 100.0f; + framerateInfo.value = 100.0; + framerateInfo.name = "100"; } break; case dsVIDEO_FRAMERATE_119dot88: { - framerateInfo.value = 119.88f; + framerateInfo.value = 119.88; + framerateInfo.name = "119.88"; } break; case dsVIDEO_FRAMERATE_120: { - framerateInfo.value = 120.0f; + framerateInfo.value = 120.0; + framerateInfo.name = "120"; } break; case dsVIDEO_FRAMERATE_200: { - framerateInfo.value = 200.0f; + framerateInfo.value = 200.0; + framerateInfo.name = "200"; } break; case dsVIDEO_FRAMERATE_239dot76: { - framerateInfo.value = 239.76f; + framerateInfo.value = 239.76; + framerateInfo.name = "239.76"; } break; case dsVIDEO_FRAMERATE_240: { - framerateInfo.value = 240.0f; + framerateInfo.value = 240.0; + framerateInfo.name = "240"; } break; #if 0 // dsVIDEO_FRAMERATE_59 and dsVIDEO_FRAMERATE_23 are not supported in all devices, this will be enabled once all devices support them case dsVIDEO_FRAMERATE_59: { - framerateInfo.value = 59.0f; + framerateInfo.value = 59.0; + framerateInfo.name = "59"; } break; case dsVIDEO_FRAMERATE_23: { - framerateInfo.value = 23.0f; + framerateInfo.value = 23.0; + framerateInfo.name = "23"; } break; #endif default: { framerateInfo.name = "Unknown"; + framerateInfo.value = 0; INT_WARN("Invalid frame rate id: %d", i); } break; } - if (framerateInfo.name.empty()) { - char buf[64] = {0}; - std::string tempFloatName = "Unknown"; - - // e.g. 24.0f -> "24", 23.98f -> "23.98", 119.88f -> "119.88" - // e.g. 59.94f -> "59.94", 119.88f -> "119.88", 239.76f -> "239.76" - // e.g. 100.0f -> "100", 200.0f -> "200", 240.0f -> "240" - // e.g. 59.946f -> "59.946", 59.9467f -> "59.9467" - int len = std::snprintf( buf, sizeof(buf), "%.*g", std::numeric_limits::max_digits10, framerateInfo.value ); - if (len > 0 && len < static_cast(sizeof(buf))) { - tempFloatName = std::string(buf); - // remove trailing zeros and decimal point if not needed, e.g. "24.0" -> "24", "23.980000" -> "23.98", "100.00" -> "100" - tempFloatName.erase(tempFloatName.find_last_not_of('0') + 1, std::string::npos); - if (tempFloatName.back() == '.') { - tempFloatName.pop_back(); - } - framerateInfo.name = tempFloatName; - } - else { - INT_WARN("Failed to convert frame rate value: %f to string for frame rate id: %d", framerateInfo.value, i); - } - } - INT_INFO("Frame rate id: %d, name: %s, value: %f", i, framerateInfo.name.c_str(), framerateInfo.value); // inserting the frame rate info in the map with frame rate id as key and FrameRateInfo struct as value _frameRates.insert({static_cast(i), framerateInfo}); @@ -215,6 +209,7 @@ namespace device { return VideoOutputPortConfig::getInstance().getFrameRate(id); } else { + INT_ERROR("Frame rate id: %d is not valid", id); throw IllegalArgumentException(); } } @@ -226,6 +221,7 @@ namespace device { return VideoOutputPortConfig::getInstance().getFrameRate(frameRate.first); } } + INT_ERROR("Frame rate name: %s is not valid", name.c_str()); throw IllegalArgumentException(); } @@ -247,6 +243,7 @@ namespace device { } } else { + INT_ERROR("Frame rate id: %d is not valid", id); throw IllegalArgumentException(); } @@ -257,13 +254,13 @@ namespace device { for (const auto& frameRate : _frameRates) { // check if the value matches with any of the supported frame rates in the map, if found initialize the FrameRate object with corresponding name and id if (std::fabs(frameRate.second.value - value) < std::numeric_limits::epsilon()) { - _name = frameRate.second.name; _id = frameRate.first; - INT_INFO("Creating FrameRate with id: %d, name: %s, value: %f", _id, _name.c_str(), _value); + _name = frameRate.second.name; + INT_INFO("Creating FrameRate with value: %f, name: %s, id: %d", _value, _name.c_str(), _id); return; } } - // if the value is not found in the map, throw exception + INT_ERROR("Frame rate value: %f is not valid", value); throw IllegalArgumentException(); } From 127caca52b028bcb6d1b67b322c36efd0906f632 Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Fri, 17 Apr 2026 17:58:38 +0000 Subject: [PATCH 06/11] RDKEMW-16714: Update Framerates into member variables Signed-off-by: yuvaramachandran_gurusamy --- ds/frameRate.cpp | 41 ++++++++++++++++++++++++++++++++-------- ds/include/frameRate.hpp | 28 +++++++++++++++++---------- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/ds/frameRate.cpp b/ds/frameRate.cpp index cd2ec5dc..452934de 100644 --- a/ds/frameRate.cpp +++ b/ds/frameRate.cpp @@ -67,15 +67,24 @@ namespace { } namespace device { + // initializing with UNKNOWN, actual value will be set in initializeFrameRates() function const int FrameRate::kUnknown = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k24 = dsVIDEO_FRAMERATE_24; - const int FrameRate::k25 = dsVIDEO_FRAMERATE_25; - const int FrameRate::k30 = dsVIDEO_FRAMERATE_30; - const int FrameRate::k60 = dsVIDEO_FRAMERATE_60; - const int FrameRate::k23dot98 = dsVIDEO_FRAMERATE_23dot98; - const int FrameRate::k29dot97 = dsVIDEO_FRAMERATE_29dot97; - const int FrameRate::k50 = dsVIDEO_FRAMERATE_50; - const int FrameRate::k59dot94 = dsVIDEO_FRAMERATE_59dot94; + const int FrameRate::k24 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k25 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k30 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k60 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k23dot98 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k29dot97 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k50 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k59dot94 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k100 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k119dot88 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k120 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k200 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k239dot76 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k240 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k59 = dsVIDEO_FRAMERATE_UNKNOWN; + const int FrameRate::k23 = dsVIDEO_FRAMERATE_UNKNOWN; const int FrameRate::kMax = dsVIDEO_FRAMERATE_MAX; void initializeFrameRates() { @@ -94,82 +103,98 @@ namespace device { case dsVIDEO_FRAMERATE_24: { framerateInfo.value = 24.0; framerateInfo.name = "24"; + FrameRate::k24 = dsVIDEO_FRAMERATE_24; } break; case dsVIDEO_FRAMERATE_25: { framerateInfo.value = 25.0; framerateInfo.name = "25"; + FrameRate::k25 = dsVIDEO_FRAMERATE_25; } break; case dsVIDEO_FRAMERATE_30: { framerateInfo.value = 30.0; framerateInfo.name = "30"; + FrameRate::k30 = dsVIDEO_FRAMERATE_30; } break; case dsVIDEO_FRAMERATE_60: { framerateInfo.value = 60.0; framerateInfo.name = "60"; + FrameRate::k60 = dsVIDEO_FRAMERATE_60; } break; case dsVIDEO_FRAMERATE_23dot98: { framerateInfo.value = 23.98; framerateInfo.name = "23.98"; + FrameRate::k23dot98 = dsVIDEO_FRAMERATE_23dot98; } break; case dsVIDEO_FRAMERATE_29dot97: { framerateInfo.value = 29.97; framerateInfo.name = "29.97"; + FrameRate::k29dot97 = dsVIDEO_FRAMERATE_29dot97; } break; case dsVIDEO_FRAMERATE_50: { framerateInfo.value = 50.0; framerateInfo.name = "50"; + FrameRate::k50 = dsVIDEO_FRAMERATE_50; } break; case dsVIDEO_FRAMERATE_59dot94: { framerateInfo.value = 59.94; framerateInfo.name = "59.94"; + FrameRate::k59dot94 = dsVIDEO_FRAMERATE_59dot94; } break; case dsVIDEO_FRAMERATE_100: { framerateInfo.value = 100.0; framerateInfo.name = "100"; + FrameRate::k100 = dsVIDEO_FRAMERATE_100; } break; case dsVIDEO_FRAMERATE_119dot88: { framerateInfo.value = 119.88; framerateInfo.name = "119.88"; + FrameRate::k119dot88 = dsVIDEO_FRAMERATE_119dot88; } break; case dsVIDEO_FRAMERATE_120: { framerateInfo.value = 120.0; framerateInfo.name = "120"; + FrameRate::k120 = dsVIDEO_FRAMERATE_120; } break; case dsVIDEO_FRAMERATE_200: { framerateInfo.value = 200.0; framerateInfo.name = "200"; + FrameRate::k200 = dsVIDEO_FRAMERATE_200; } break; case dsVIDEO_FRAMERATE_239dot76: { framerateInfo.value = 239.76; framerateInfo.name = "239.76"; + FrameRate::k239dot76 = dsVIDEO_FRAMERATE_239dot76; } break; case dsVIDEO_FRAMERATE_240: { framerateInfo.value = 240.0; framerateInfo.name = "240"; + FrameRate::k240 = dsVIDEO_FRAMERATE_240; } break; #if 0 // dsVIDEO_FRAMERATE_59 and dsVIDEO_FRAMERATE_23 are not supported in all devices, this will be enabled once all devices support them case dsVIDEO_FRAMERATE_59: { framerateInfo.value = 59.0; framerateInfo.name = "59"; + FrameRate::k59 = dsVIDEO_FRAMERATE_59; } break; case dsVIDEO_FRAMERATE_23: { framerateInfo.value = 23.0; framerateInfo.name = "23"; + FrameRate::k23 = dsVIDEO_FRAMERATE_23; } break; #endif diff --git a/ds/include/frameRate.hpp b/ds/include/frameRate.hpp index a993e411..3b00e5f4 100644 --- a/ds/include/frameRate.hpp +++ b/ds/include/frameRate.hpp @@ -52,16 +52,24 @@ namespace device { class FrameRate : public DSConstant { float _value; //!< Indicates the supported frame rate value in fps. public: - static const int kUnknown; //!< Indicates video frame rate of unknown type. - static const int k24; //!< Indicates video frame rate of 24 fps. - static const int k25; //!< Indicates video frame rate of 25 fps. - static const int k30; //!< Indicates video frame rate of 30 fps. - static const int k60; //!< Indicates video frame rate of 60 fps. - static const int k23dot98; //!< Indicates video frame rate of 23.98 fps. - static const int k29dot97; //!< Indicates video frame rate of 29.97 fps. - static const int k50; //!< Indicates video frame rate of 50 fps. - static const int k59dot94; //!< Indicates video frame rate of 59.94 fps. - static const int kMax; //!< Indicates maximum number of frame rates supported. + static const int kUnknown; //!< Indicates video frame rate of unknown type. + static const int k24; //!< Indicates video frame rate of 24 fps. + static const int k25; //!< Indicates video frame rate of 25 fps. + static const int k30; //!< Indicates video frame rate of 30 fps. + static const int k60; //!< Indicates video frame rate of 60 fps. + static const int k23dot98; //!< Indicates video frame rate of 23.98 fps. + static const int k29dot97; //!< Indicates video frame rate of 29.97 fps. + static const int k50; //!< Indicates video frame rate of 50 fps. + static const int k59dot94; //!< Indicates video frame rate of 59.94 fps. + static const int k100; //!< Indicates video frame rate of 100 fps. + static const int k119dot88; //!< Indicates video frame rate of 119.88 fps. + static const int k120; //!< Indicates video frame rate of 120 fps. + static const int k200; //!< Indicates video frame rate of 200 fps. + static const int k239dot76; //!< Indicates video frame rate of 239.76 fps. + static const int k240; //!< Indicates video frame rate of 240 fps. + static const int k59; //!< Indicates video frame rate of 59 fps. + static const int k23; //!< Indicates video frame rate of 23 fps. + static const int kMax; //!< Indicates maximum number of frame rates supported. static const FrameRate & getInstance(int id); static const FrameRate & getInstance(const std::string &name); From eb61b2fc46c64f7fc64d683918207e26036b546f Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Fri, 17 Apr 2026 18:05:22 +0000 Subject: [PATCH 07/11] RDKEMW-16714: Removing Mutex as not needed Signed-off-by: yuvaramachandran_gurusamy --- ds/frameRate.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/ds/frameRate.cpp b/ds/frameRate.cpp index 452934de..17af6804 100644 --- a/ds/frameRate.cpp +++ b/ds/frameRate.cpp @@ -34,7 +34,6 @@ #include "dsUtl.h" #include "dslogger.h" #include -#include #include #include #include @@ -49,7 +48,6 @@ namespace { FrameRateInfo; std::map _frameRates; - std::mutex _frameRatesMutex; inline bool isValid(int id) { bool valid = false; @@ -88,7 +86,6 @@ namespace device { const int FrameRate::kMax = dsVIDEO_FRAMERATE_MAX; void initializeFrameRates() { - std::lock_guard lock(_frameRatesMutex); _frameRates.clear(); _frameRates.insert({dsVIDEO_FRAMERATE_UNKNOWN, {"Unknown", 0}}); @@ -213,7 +210,6 @@ namespace device { } void dumpFrameRates() { - std::lock_guard lock(_frameRatesMutex); if ( -1 == access("/opt/dsMgrDumpFramerates", F_OK) ) { INT_INFO("Dumping of frame rates is disabled"); return; @@ -224,7 +220,6 @@ namespace device { } void deinitializeFrameRates() { - std::lock_guard lock(_frameRatesMutex); _frameRates.clear(); } @@ -252,7 +247,6 @@ namespace device { FrameRate::FrameRate(int id) { - std::lock_guard lock(_frameRatesMutex); if (::isValid(id)) { auto it = _frameRates.find(static_cast(id)); if (it != _frameRates.end()) { @@ -275,7 +269,6 @@ namespace device { } FrameRate::FrameRate(float value) : _value(value){ - std::lock_guard lock(_frameRatesMutex); for (const auto& frameRate : _frameRates) { // check if the value matches with any of the supported frame rates in the map, if found initialize the FrameRate object with corresponding name and id if (std::fabs(frameRate.second.value - value) < std::numeric_limits::epsilon()) { From 4919c341eeb444f035779b5a5d083f18a1b77762 Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Fri, 17 Apr 2026 18:26:46 +0000 Subject: [PATCH 08/11] RDKEMW-16714: Fix build error Signed-off-by: yuvaramachandran_gurusamy --- ds/frameRate.cpp | 36 ++++++++++++++++++------------------ ds/include/frameRate.hpp | 36 ++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/ds/frameRate.cpp b/ds/frameRate.cpp index 17af6804..0cd6a484 100644 --- a/ds/frameRate.cpp +++ b/ds/frameRate.cpp @@ -66,24 +66,24 @@ namespace { namespace device { // initializing with UNKNOWN, actual value will be set in initializeFrameRates() function - const int FrameRate::kUnknown = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k24 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k25 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k30 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k60 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k23dot98 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k29dot97 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k50 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k59dot94 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k100 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k119dot88 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k120 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k200 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k239dot76 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k240 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k59 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::k23 = dsVIDEO_FRAMERATE_UNKNOWN; - const int FrameRate::kMax = dsVIDEO_FRAMERATE_MAX; + int FrameRate::kUnknown = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k24 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k25 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k30 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k60 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k23dot98 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k29dot97 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k50 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k59dot94 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k100 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k119dot88 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k120 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k200 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k239dot76 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k240 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k59 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::k23 = dsVIDEO_FRAMERATE_UNKNOWN; + int FrameRate::kMax = dsVIDEO_FRAMERATE_MAX; void initializeFrameRates() { _frameRates.clear(); diff --git a/ds/include/frameRate.hpp b/ds/include/frameRate.hpp index 3b00e5f4..d231beaf 100644 --- a/ds/include/frameRate.hpp +++ b/ds/include/frameRate.hpp @@ -52,24 +52,24 @@ namespace device { class FrameRate : public DSConstant { float _value; //!< Indicates the supported frame rate value in fps. public: - static const int kUnknown; //!< Indicates video frame rate of unknown type. - static const int k24; //!< Indicates video frame rate of 24 fps. - static const int k25; //!< Indicates video frame rate of 25 fps. - static const int k30; //!< Indicates video frame rate of 30 fps. - static const int k60; //!< Indicates video frame rate of 60 fps. - static const int k23dot98; //!< Indicates video frame rate of 23.98 fps. - static const int k29dot97; //!< Indicates video frame rate of 29.97 fps. - static const int k50; //!< Indicates video frame rate of 50 fps. - static const int k59dot94; //!< Indicates video frame rate of 59.94 fps. - static const int k100; //!< Indicates video frame rate of 100 fps. - static const int k119dot88; //!< Indicates video frame rate of 119.88 fps. - static const int k120; //!< Indicates video frame rate of 120 fps. - static const int k200; //!< Indicates video frame rate of 200 fps. - static const int k239dot76; //!< Indicates video frame rate of 239.76 fps. - static const int k240; //!< Indicates video frame rate of 240 fps. - static const int k59; //!< Indicates video frame rate of 59 fps. - static const int k23; //!< Indicates video frame rate of 23 fps. - static const int kMax; //!< Indicates maximum number of frame rates supported. + static int kUnknown; //!< Indicates video frame rate of unknown type. + static int k24; //!< Indicates video frame rate of 24 fps. + static int k25; //!< Indicates video frame rate of 25 fps. + static int k30; //!< Indicates video frame rate of 30 fps. + static int k60; //!< Indicates video frame rate of 60 fps. + static int k23dot98; //!< Indicates video frame rate of 23.98 fps. + static int k29dot97; //!< Indicates video frame rate of 29.97 fps. + static int k50; //!< Indicates video frame rate of 50 fps. + static int k59dot94; //!< Indicates video frame rate of 59.94 fps. + static int k100; //!< Indicates video frame rate of 100 fps. + static int k119dot88; //!< Indicates video frame rate of 119.88 fps. + static int k120; //!< Indicates video frame rate of 120 fps. + static int k200; //!< Indicates video frame rate of 200 fps. + static int k239dot76; //!< Indicates video frame rate of 239.76 fps. + static int k240; //!< Indicates video frame rate of 240 fps. + static int k59; //!< Indicates video frame rate of 59 fps. + static int k23; //!< Indicates video frame rate of 23 fps. + static int kMax; //!< Indicates maximum number of frame rates supported. static const FrameRate & getInstance(int id); static const FrameRate & getInstance(const std::string &name); From 3e7638c3ef85db1f18df8362632dd56b7f4941bf Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Fri, 17 Apr 2026 18:44:02 +0000 Subject: [PATCH 09/11] RDKEMW-16714: Addressing CoPilot review comments Signed-off-by: yuvaramachandran_gurusamy --- ds/frameRate.cpp | 18 ++++++++++++++++-- ds/include/frameRate.hpp | 1 - ds/videoOutputPortConfig.cpp | 2 -- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ds/frameRate.cpp b/ds/frameRate.cpp index 0cd6a484..89ab32d9 100644 --- a/ds/frameRate.cpp +++ b/ds/frameRate.cpp @@ -207,9 +207,7 @@ namespace device { // inserting the frame rate info in the map with frame rate id as key and FrameRateInfo struct as value _frameRates.insert({static_cast(i), framerateInfo}); } - } - void dumpFrameRates() { if ( -1 == access("/opt/dsMgrDumpFramerates", F_OK) ) { INT_INFO("Dumping of frame rates is disabled"); return; @@ -220,6 +218,22 @@ namespace device { } void deinitializeFrameRates() { + FrameRate::k24 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k25 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k30 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k60 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k23dot98 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k29dot97 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k50 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k59dot94 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k100 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k119dot88 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k120 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k200 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k239dot76 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k240 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k59 = dsVIDEO_FRAMERATE_UNKNOWN; + FrameRate::k23 = dsVIDEO_FRAMERATE_UNKNOWN; _frameRates.clear(); } diff --git a/ds/include/frameRate.hpp b/ds/include/frameRate.hpp index d231beaf..a82b6d44 100644 --- a/ds/include/frameRate.hpp +++ b/ds/include/frameRate.hpp @@ -41,7 +41,6 @@ namespace device { void initializeFrameRates(); - void dumpFrameRates(); void deinitializeFrameRates(); /** diff --git a/ds/videoOutputPortConfig.cpp b/ds/videoOutputPortConfig.cpp index 6a3d5611..037144cd 100644 --- a/ds/videoOutputPortConfig.cpp +++ b/ds/videoOutputPortConfig.cpp @@ -348,8 +348,6 @@ void VideoOutputPortConfig::load(videoPortConfigs_t* dynamicVideoPortConfigs) // initialize the frame rates map with supported frame rates. This is required to be done before loading the video port configs as some of the frame rate related APIs depend on this map to return the supported frame rates and its values. initializeFrameRates(); - // dump the supported frame rates to the log for debugging purposes, as some of the frame rate related APIs depend on this map to return the supported frame rates and its values. - dumpFrameRates(); /* * Load Constants First. */ From efeb453e8c310b8e40958a104463484525128727 Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Fri, 17 Apr 2026 19:10:03 +0000 Subject: [PATCH 10/11] RDKEMW-16714: Addressed Copilot review comments Signed-off-by: yuvaramachandran_gurusamy --- ds/manager.cpp | 31 ++++++++++++++++++------------- ds/videoOutputPortConfig.cpp | 23 +++++++++-------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/ds/manager.cpp b/ds/manager.cpp index 7c88ed71..eeb14cc4 100644 --- a/ds/manager.cpp +++ b/ds/manager.cpp @@ -292,6 +292,9 @@ void Manager::Initialize() err = initializeFunctionWithRetry("dsVideoDeviceInit", dsVideoDeviceInit); CHECK_RET_VAL(err); + + // initialize the frame rates map with supported frame rates. This is required to be done before loading the video port configs as some of the frame rate related APIs depend on this map to return the supported frame rates and its values. + initializeFrameRates(); loadDeviceCapabilities(device::DEVICE_CAPABILITY_VIDEO_PORT | device::DEVICE_CAPABILITY_AUDIO_PORT | @@ -340,19 +343,21 @@ void Manager::load() void Manager::DeInitialize() { {std::lock_guard lock(gManagerInitMutex); - INT_INFO("Entering ... count %d with thread id %lu",IsInitialized,pthread_self()); - if(IsInitialized>0)IsInitialized--; - if (0 == IsInitialized) { - - VideoDeviceConfig::getInstance().release(); - VideoOutputPortConfig::getInstance().release(); - AudioOutputPortConfig::getInstance().release(); - - dsVideoDeviceTerm(); - dsVideoPortTerm(); - dsAudioPortTerm(); - dsDisplayTerm(); - } + INT_INFO("Entering ... count %d with thread id %lu",IsInitialized,pthread_self()); + if(IsInitialized>0)IsInitialized--; + if (0 == IsInitialized) { + VideoDeviceConfig::getInstance().release(); + VideoOutputPortConfig::getInstance().release(); + AudioOutputPortConfig::getInstance().release(); + + // deinitialize the frame rates map to release the resources allocated for the map and its contents, as some of the frame rate APIs depend on this map to return the supported frame rates and its values. + deinitializeFrameRates(); + + dsVideoDeviceTerm(); + dsVideoPortTerm(); + dsAudioPortTerm(); + dsDisplayTerm(); + } } INT_INFO("Exiting ... with thread %lu",pthread_self()); } diff --git a/ds/videoOutputPortConfig.cpp b/ds/videoOutputPortConfig.cpp index 037144cd..faf80a23 100644 --- a/ds/videoOutputPortConfig.cpp +++ b/ds/videoOutputPortConfig.cpp @@ -345,9 +345,6 @@ void VideoOutputPortConfig::load(videoPortConfigs_t* dynamicVideoPortConfigs) videoPortConfigs_t configuration = {0}; try { - // initialize the frame rates map with supported frame rates. This is required to be done before loading the video port configs as some of the frame rate related APIs depend on this map to return the supported frame rates and its values. - initializeFrameRates(); - /* * Load Constants First. */ @@ -460,17 +457,15 @@ void VideoOutputPortConfig::load(videoPortConfigs_t* dynamicVideoPortConfigs) void VideoOutputPortConfig::release() { try { - _vPixelResolutions.clear(); - _vAspectRatios.clear(); - _vStereoScopieModes.clear(); - _vFrameRates.clear(); - _vPortTypes.clear(); - {std::lock_guard lock(gSupportedResolutionsMutex); - _supportedResolutions.clear(); - } - _vPorts.clear(); - // deinitialize the frame rates map to release the resources allocated for the map and its contents, as some of the frame rate APIs depend on this map to return the supported frame rates and its values. - deinitializeFrameRates(); + _vPixelResolutions.clear(); + _vAspectRatios.clear(); + _vStereoScopieModes.clear(); + _vFrameRates.clear(); + _vPortTypes.clear(); + {std::lock_guard lock(gSupportedResolutionsMutex); + _supportedResolutions.clear(); + } + _vPorts.clear(); } catch (const Exception &e) { throw e; From dca9c2991630beadb374346f466c9c75fb14c354 Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Mon, 20 Apr 2026 16:20:55 +0000 Subject: [PATCH 11/11] RDKEMW-16714: Fix Framerate initialization Signed-off-by: yuvaramachandran_gurusamy --- ds/frameRate.cpp | 8 -------- ds/manager.cpp | 6 +++--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/ds/frameRate.cpp b/ds/frameRate.cpp index 89ab32d9..0ea8b782 100644 --- a/ds/frameRate.cpp +++ b/ds/frameRate.cpp @@ -207,14 +207,6 @@ namespace device { // inserting the frame rate info in the map with frame rate id as key and FrameRateInfo struct as value _frameRates.insert({static_cast(i), framerateInfo}); } - - if ( -1 == access("/opt/dsMgrDumpFramerates", F_OK) ) { - INT_INFO("Dumping of frame rates is disabled"); - return; - } - for (const auto& frameRate : _frameRates) { - INT_INFO("Frame rate id: %d, name: %s, value: %f", frameRate.first, frameRate.second.name.c_str(), frameRate.second.value); - } } void deinitializeFrameRates() { diff --git a/ds/manager.cpp b/ds/manager.cpp index eeb14cc4..c6d7281e 100644 --- a/ds/manager.cpp +++ b/ds/manager.cpp @@ -115,6 +115,9 @@ void loadDeviceCapabilities(unsigned int capabilityType) INT_INFO("DL Instance '%s'", (nullptr == pDLHandle ? "NULL" : "Valid")); + // initialize the frame rates map with supported frame rates. This is required to be done before loading the video port configs as some of the frame rate related APIs depend on this map to return the supported frame rates and its values. + initializeFrameRates(); + // Audio Port Config if (DEVICE_CAPABILITY_AUDIO_PORT & capabilityType) { audioConfigs_t dynamicAudioConfigs = {0 }; @@ -292,9 +295,6 @@ void Manager::Initialize() err = initializeFunctionWithRetry("dsVideoDeviceInit", dsVideoDeviceInit); CHECK_RET_VAL(err); - - // initialize the frame rates map with supported frame rates. This is required to be done before loading the video port configs as some of the frame rate related APIs depend on this map to return the supported frame rates and its values. - initializeFrameRates(); loadDeviceCapabilities(device::DEVICE_CAPABILITY_VIDEO_PORT | device::DEVICE_CAPABILITY_AUDIO_PORT |