-
Notifications
You must be signed in to change notification settings - Fork 4
sync to develop #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/RDKEMW-8587-dlsym
Are you sure you want to change the base?
sync to develop #215
Changes from all commits
898b0bb
a5b7a9f
62858d9
5dd27d7
6594764
3a73464
56fabff
8f0dd0f
f90a986
f11f7de
5b50634
05c2d95
2540d79
9e5074b
edc8c70
ab7a2df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -55,7 +55,6 @@ static void parse_std_timing(unsigned char* bytes, edid_data_t* data_ptr) { | |||||||||||||
| case 1: v = (h * 3) / 4; break; | ||||||||||||||
| case 2: v = (h * 4) / 5; break; | ||||||||||||||
| case 3: v = (h * 9) / 16; break; | ||||||||||||||
| default: return; | ||||||||||||||
| } | ||||||||||||||
| int r = (bytes[idx + 1] & 0x3F) + 60; | ||||||||||||||
| INT_DEBUG("STD %dx%d@%d\n", h, v, r); | ||||||||||||||
|
|
@@ -381,8 +380,6 @@ static void parse_ext_timing(unsigned char* bytes, edid_data_t* data_ptr) { | |||||||||||||
| case 6: break; | ||||||||||||||
| // 'Use Extended Tag' | ||||||||||||||
| case 7: parse_extended_db(&bytes[idx], data_ptr); break; | ||||||||||||||
|
||||||||||||||
| case 7: parse_extended_db(&bytes[idx], data_ptr); break; | |
| case 7: parse_extended_db(&bytes[idx], data_ptr); break; | |
| // unsupported / unknown extension tag | |
| default: | |
| INT_DEBUG("parse_ext_timing: unsupported extension tag=%d len=%d\n", tag, len); | |
| break; |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -385,6 +385,53 @@ Host::~Host() | |||||||
| return std::string(socID); | ||||||||
| } | ||||||||
|
|
||||||||
| intptr_t Host::getAudioPortHandle() | ||||||||
| { | ||||||||
| try | ||||||||
| { | ||||||||
| if (isHDMIOutPortPresent()) | ||||||||
| { | ||||||||
| //STB profile with single audio output port | ||||||||
| AudioOutputPort aPort = getAudioOutputPort("HDMI0"); | ||||||||
| return aPort.getOutputPortHandle(); | ||||||||
| } | ||||||||
| else | ||||||||
| { | ||||||||
| //TV profile with multiple audio output ports | ||||||||
| // First check the ports which are dynamically conected and finally fallback to SPEAKER0 which is always connected. | ||||||||
|
||||||||
| // First check the ports which are dynamically conected and finally fallback to SPEAKER0 which is always connected. | |
| // First check the ports which are dynamically connected and finally fallback to SPEAKER0 which is always connected. |
Copilot
AI
Feb 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If all audio ports in the priority list fail the enabled/connected check or throw exceptions, the function returns NULL without logging any information about why no valid port was found. This could make it difficult to diagnose issues where audio format queries fail. Consider adding a log statement before the final return to indicate that no valid audio port was found, especially since this is used by getCurrentAudioFormat which may fail silently if passed a NULL handle.
| cout << "getAudioPortHandle(): No valid audio port found; returning NULL handle.\n"; |
Copilot
AI
Feb 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning NULL for an intptr_t type is potentially problematic. While NULL typically evaluates to 0, it's defined as a null pointer constant and may not be the most semantically appropriate choice for an integer type. Consider returning 0 explicitly instead of NULL to make the intent clearer that this represents an invalid/error handle value rather than a null pointer.
| return NULL; | |
| return 0; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,7 @@ | |
| #include "exception.hpp" | ||
| #include <pthread.h> | ||
| #include <unistd.h> | ||
| #include <functional> | ||
|
|
||
| /** | ||
| * @file manager.cpp | ||
|
|
@@ -62,6 +63,7 @@ namespace device { | |
|
|
||
| int Manager::IsInitialized = 0; //!< Indicates the application has initialized with devicettings modules. | ||
| static std::mutex gManagerInitMutex; | ||
| static dsError_t initializeFunctionWithRetry(const char* functionName, std::function<dsError_t()> initFunc); | ||
|
|
||
| Manager::Manager() { | ||
| // TODO Auto-generated constructor stub | ||
|
|
@@ -79,6 +81,41 @@ Manager::~Manager() { | |
| }\ | ||
| } | ||
|
|
||
| /** | ||
| * @brief Retry initialization function with configurable retry logic. | ||
| * | ||
| * This helper function attempts to initialize a device settings component by calling | ||
| * the provided initialization function. It retries the operation with a delay between | ||
| * attempts until either the operation succeeds, the maximum retry count is reached, | ||
| * or (optionally) a specific error state is encountered. | ||
| * | ||
| * @param[in] functionName Name of the initialization function being called. Used for logging | ||
| * purposes to identify which component is being initialized. | ||
| * @param[in] initFunc Lambda or function object that performs the actual initialization. | ||
| * Should return dsError_t indicating success (dsERR_NONE) or an error code. | ||
| * | ||
| * @return dsERR_NONE on successful initialization, or the last error code encountered after | ||
| * all retry attempts are exhausted. When checkInvalidState is true, also returns | ||
| * immediately with the error code if a non-dsERR_INVALID_STATE error occurs. | ||
| */ | ||
| dsError_t initializeFunctionWithRetry(const char* functionName, | ||
| std::function<dsError_t()> initFunc) | ||
| { | ||
| dsError_t err = dsERR_GENERAL; | ||
| unsigned int retryCount = 0; | ||
| unsigned int maxRetries = 25; | ||
|
|
||
| do { | ||
| err = initFunc(); | ||
| printf("Manager::Initialize:%s result :%d retryCount :%d\n", | ||
| functionName, err, retryCount); | ||
| if (dsERR_NONE == err) break; | ||
| usleep(100000); | ||
| } while (retryCount++ < maxRetries); | ||
|
|
||
| return err; | ||
| } | ||
|
Comment on lines
+101
to
+117
|
||
|
|
||
| /** | ||
| * @addtogroup dssettingsmanagerapi | ||
| * @{ | ||
|
|
@@ -105,44 +142,45 @@ Manager::~Manager() { | |
| */ | ||
| void Manager::Initialize() | ||
| { | ||
| {std::lock_guard<std::mutex> lock(gManagerInitMutex); | ||
| printf("Entering %s count %d with thread id %lu\n",__FUNCTION__,IsInitialized,pthread_self()); | ||
| bool needInit = false; | ||
|
|
||
| {std::lock_guard<std::mutex> lock(gManagerInitMutex); | ||
| printf("Entering %s count %d with thread id %lu\n",__FUNCTION__,IsInitialized,pthread_self()); | ||
| if (IsInitialized == 0) { | ||
| needInit = true; | ||
| } | ||
| IsInitialized++; | ||
| } | ||
|
Comment on lines
+145
to
+153
|
||
|
|
||
| try { | ||
| if (0 == IsInitialized) { | ||
|
|
||
| dsError_t err = dsERR_GENERAL; | ||
| unsigned int retryCount = 0; | ||
| // This retry logic will wait for the device manager initialization from the client side | ||
| // until the device manager service initialization is completed. The retry mechanism checks | ||
| // only for dsERR_INVALID_STATE, which is reported if the underlying service is not ready. | ||
| // Once the service is ready, other port initializations can be called directly without any delay. | ||
| // That's why the retry logic is applied only for dsDisplayInit. | ||
| do { | ||
| err = dsDisplayInit(); | ||
| printf ("Manager::Initialize: result :%d retryCount :%d\n", err, retryCount); | ||
| if (dsERR_NONE == err) break; | ||
| usleep(100000); | ||
| } while(( dsERR_INVALID_STATE == err) && (retryCount++ < 25)); | ||
| try { | ||
| if (needInit) { | ||
|
Comment on lines
+147
to
+156
|
||
| dsError_t err = dsERR_GENERAL; | ||
|
|
||
| err = initializeFunctionWithRetry("dsDisplayInit", dsDisplayInit); | ||
| CHECK_RET_VAL(err); | ||
| err = dsAudioPortInit(); | ||
|
|
||
| err = initializeFunctionWithRetry("dsAudioPortInit", dsAudioPortInit); | ||
| CHECK_RET_VAL(err); | ||
| err = dsVideoPortInit(); | ||
|
|
||
| err = initializeFunctionWithRetry("dsVideoPortInit", dsVideoPortInit); | ||
| CHECK_RET_VAL(err); | ||
| err = dsVideoDeviceInit(); | ||
| CHECK_RET_VAL(err); | ||
| AudioOutputPortConfig::getInstance().load(); | ||
| VideoOutputPortConfig::getInstance().load(); | ||
| VideoDeviceConfig::getInstance().load(); | ||
| } | ||
| IsInitialized++; | ||
|
|
||
| err = initializeFunctionWithRetry("dsVideoDeviceInit", dsVideoDeviceInit); | ||
| CHECK_RET_VAL(err); | ||
|
|
||
| AudioOutputPortConfig::getInstance().load(); | ||
| VideoOutputPortConfig::getInstance().load(); | ||
| VideoDeviceConfig::getInstance().load(); | ||
| } | ||
| } | ||
| catch(const Exception &e) { | ||
| cout << "Caught exception during Initialization" << e.what() << endl; | ||
| throw e; | ||
| } | ||
| } | ||
| printf("Exiting %s with thread %lu\n",__FUNCTION__,pthread_self()); | ||
| cout << "Caught exception during Initialization" << e.what() << endl; | ||
| std::lock_guard<std::mutex> lock(gManagerInitMutex); | ||
| IsInitialized--; | ||
| throw e; | ||
| } | ||
|
|
||
| printf("Exiting %s with thread %lu\n",__FUNCTION__,pthread_self()); | ||
| } | ||
|
|
||
| void Manager::load() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of the default case in this switch statement means that if an unexpected value appears in the 2-bit field (which can only be 0-3), the variable 'v' will remain at 0. While this switch covers all possible values for a 2-bit field, consider whether v=0 is the appropriate behavior if future EDID specifications extend this field or if corrupted EDID data is encountered. The original default case with early return provided explicit handling for invalid data.