Skip to content

RDKEMW-17086: Enable or Disable MS12 cont audio output mode. - #262

Open
shashank4388 wants to merge 1 commit into
developfrom
feature/RDKEMW-17086-app-audio-config
Open

RDKEMW-17086: Enable or Disable MS12 cont audio output mode.#262
shashank4388 wants to merge 1 commit into
developfrom
feature/RDKEMW-17086-app-audio-config

Conversation

@shashank4388

Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings July 20, 2026 10:56
@shashank4388
shashank4388 requested a review from a team as a code owner July 20, 2026 10:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new “application audio configuration” control path (intended for MS12 continuous audio output mode and similar per-application behaviors) by introducing new IARM RPC calls (client/server), RPC parameter structs, and new Host APIs to set/get/list supported configurations.

Changes:

  • Added IARM bus API identifiers and RPC parameter structs for application audio configuration set/get/list.
  • Implemented RPC server handlers in rpc/srv/dsAudio.c that dynamically resolve HAL entry points and service the new RPC calls.
  • Added RPC client wrappers in rpc/cli/dsAudio.c and exposed higher-level Host methods in ds/host.cpp / ds/include/host.hpp.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
rpc/srv/dsAudio.c Registers new IARM calls and adds server-side handlers for set/get/list; current implementation has critical NULL-deref/stack-overwrite issues and a misleading error message.
rpc/include/dsRpc.h Adds new IARM API string constants and RPC parameter structs for application audio configuration APIs.
rpc/cli/dsAudio.c Adds client-side wrappers for set/get/list; current implementation has format-string bugs, missing validation, and doesn’t propagate server error codes.
ds/include/host.hpp Exposes new Host APIs; currently declares an unimplemented const char* overload.
ds/host.cpp Implements Host wrappers and adds documentation; contains incorrect @see reference and misleading/unprofessional log messages.
ds/audioOutputPort.cpp Removes an extraneous blank line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rpc/srv/dsAudio.c
Comment on lines +3726 to +3731
dsApplicationAudioConfigListParam_t *param = (dsApplicationAudioConfigListParam_t *)arg;
dsApplicationAudioConfigList_t configList;
memset(&configList, 0, sizeof(dsApplicationAudioConfigListParam_t));
configList.size = param->appAudioConfigList.size;
if (func != 0 && param != NULL)
{
Comment thread rpc/srv/dsAudio.c Outdated
if (ret != dsERR_NONE)
{
param->result = ret;
INT_ERROR("%s: (SERVER) Unable to set Application audio configuration\n", __FUNCTION__);
Comment thread rpc/srv/dsAudio.c
Comment on lines +3785 to +3790
dsApplicationAudioConfigParam_t *param = (dsApplicationAudioConfigParam_t *)arg;
dsApplicationAudioConfig_t config;
memset(config.configName, 0, sizeof(dsApplicationAudioConfig_t));
strncpy(config.configName, param->audioConfig.configName, sizeof(dsApplicationAudioConfig_t));
if (func != 0 && param != NULL)
{
Comment thread rpc/srv/dsAudio.c
Comment on lines +3837 to +3841
dsApplicationAudioConfigParam_t *param = (dsApplicationAudioConfigParam_t *)arg;
memset(config.configName, 0, sizeof(dsApplicationAudioConfig_t));
strncpy(config.configName, param->audioConfig.configName, sizeof(dsApplicationAudioConfig_t));
if (func != 0 && param != NULL)
{
Comment thread rpc/cli/dsAudio.c Outdated
Comment on lines +399 to +421
dsError_t dsSetApplicationAudioConfig(intptr_t handle, dsApplicationAudioConfig_t* audioConfig, bool enable)
{
_DEBUG_ENTER();
INT_ERROR("Shashank...... dscli dsSetApplicationAudioConfig %s\n", audioConfig);
dsApplicationAudioConfigParam_t param;
param.handle = handle;
param.enable = enable;
IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
memset(param.audioConfig.configName, '\0', sizeof(param.audioConfig));
strncpy(param.audioConfig.configName, audioConfig->configName, (DS_MAX_APPLICATION_AUDIO_CONFIG_NAME_LEN -1));
rpcRet = IARM_Bus_Call(IARM_BUS_DSMGR_NAME,
(char *)IARM_BUS_DSMGR_API_dsSetApplicationAudioConfig,
(void *)&param,
sizeof(param));

if (IARM_RESULT_SUCCESS == rpcRet)
{
INT_ERROR("Shashank... Exiting dsSetApplicationAudioConfig Error None");
return dsERR_NONE;
}
INT_ERROR("Shashank2... Exiting dsSetApplicationAudioConfig");
return dsERR_GENERAL ;
}
Comment thread ds/host.cpp Outdated
std::cout << "Failed to set AudioOutputPort::setApplicationAudioConfig\n";
throw Exception(ret);
}
INT_INFO("Exiting AudioOutputPort::setApplicationAudioConfig\n");
Comment thread ds/host.cpp Outdated
std::cout << "Failed to set AudioOutputPort::getApplicationAudioConfig\n";
throw Exception(ret);
}
INT_INFO("Exiting AudioOutputPort::getApplicationAudioConfig\n");
Comment thread ds/host.cpp Outdated
for (int count =0; count < appAudioConfigList.returnedCount; count++) {
configList.push_back(appAudioConfigList.config[count].configName);
}
INT_INFO("Exiting AudioOutputPort::getApplicationAudioConfigList\n");
Comment thread rpc/cli/dsAudio.c
Comment on lines +423 to +431
dsError_t dsGetApplicationAudioConfigList(intptr_t handle, dsApplicationAudioConfigList_t* appAudioConfigList)
{
IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
dsApplicationAudioConfigListParam_t param;

param.handle = handle;
memset(&param.appAudioConfigList, 0, sizeof(dsApplicationAudioConfigList_t));
param.appAudioConfigList.size = sizeof(dsApplicationAudioConfigList_t);

Comment thread rpc/cli/dsAudio.c Outdated
Comment on lines +437 to +450
if (IARM_RESULT_SUCCESS != rpcRet)
{
printf("%s: (GET) GENERAL ERROR\n", __FUNCTION__);
return dsERR_GENERAL;
}

appAudioConfigList->size = param.appAudioConfigList.size;
appAudioConfigList->returnedCount = param.appAudioConfigList.returnedCount;
appAudioConfigList->totalCount = param.appAudioConfigList.totalCount;
for (int count=0; count < param.appAudioConfigList.returnedCount; count++) {
strncpy(appAudioConfigList->config[count].configName, param.appAudioConfigList.config[count].configName,
(DS_MAX_APPLICATION_AUDIO_CONFIG_NAME_LEN -1) );
}
return dsERR_NONE;
Copilot AI review requested due to automatic review settings July 21, 2026 14:43
@shashank4388
shashank4388 force-pushed the feature/RDKEMW-17086-app-audio-config branch from d741ec3 to eb778ec Compare July 21, 2026 14:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (2)

rpc/cli/dsAudio.c:468

  • enable is dereferenced without a NULL check ("*enable = param.enable"). This can crash callers passing a null enable pointer.
    if (audioConfig == NULL) {
	INT_ERROR("%s:Invalid parameter", __func__);
	return dsERR_GENERAL;
    }

ds/include/host.hpp:426

  • Host declares setApplicationAudioConfig(const char*, bool) but there is no definition in this PR. Because it is a better match than the std::string overload for string literals, this can easily lead to link errors. Either remove it or provide an inline forwarding wrapper.
    void setAudioAtmosOutputMode(bool enable);
    void setApplicationAudioConfig(const char* audioConfig, bool enable);
    void setAssociatedAudioMixing(const bool mixing);

Comment thread rpc/srv/dsAudio.c
Comment on lines +3788 to +3791
if (func != 0 && param != NULL)
{
strncpy(config.configName, param->audioConfig.configName, sizeof(dsApplicationAudioConfig_t));
ret = func(param->handle, &config, param->enable);
Comment thread rpc/srv/dsAudio.c
Comment on lines +3839 to +3843
if (func != 0 && param != NULL)
{
strncpy(config.configName, param->audioConfig.configName, sizeof(dsApplicationAudioConfig_t));
ret = func(param->handle, &config, &enable);
if (ret != dsERR_NONE)
Comment thread rpc/cli/dsAudio.c
Comment on lines +411 to +413
IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
memset(param.audioConfig.configName, '\0', sizeof(param.audioConfig));
strncpy(param.audioConfig.configName, audioConfig->configName, (DS_MAX_APPLICATION_AUDIO_CONFIG_NAME_LEN -1));
Comment thread rpc/cli/dsAudio.c
Comment on lines +475 to +477
IARM_Result_t rpcRet = IARM_RESULT_SUCCESS;
memset(param.audioConfig.configName, '\0', sizeof(param.audioConfig));
strncpy(param.audioConfig.configName, audioConfig->configName, (DS_MAX_APPLICATION_AUDIO_CONFIG_NAME_LEN -1));
Comment thread rpc/srv/dsAudio.c
Comment on lines +3707 to +3710
typedef dsError_t (*dsGetApplicationAudioConfigList_t)(intptr_t handle, dsApplicationAudioConfigList_t* audioConfigList);
static dsGetApplicationAudioConfigList_t func = 0;
INT_ERROR("Inside _dsGetApplicationAudioConfigList_t srv\n");
if (func == 0) {
Copilot AI review requested due to automatic review settings July 21, 2026 14:54
@shashank4388
shashank4388 force-pushed the feature/RDKEMW-17086-app-audio-config branch from eb778ec to 82e8a5d Compare July 21, 2026 14:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (5)

rpc/cli/dsAudio.c:412

  • memset(param.audioConfig, ...) passes a struct value where a pointer is required, which will not compile (and is redundant since param is already zeroed). Use &param.audioConfig (or remove the line entirely).
    memset(param.audioConfig, '\0', sizeof(param.audioConfig));

rpc/cli/dsAudio.c:476

  • memset(param.audioConfig, ...) passes a struct value where a pointer is required, which will not compile (and is redundant since param is already zeroed). Use &param.audioConfig (or remove the line entirely).
    memset(param.audioConfig, 0, sizeof(param.audioConfig));

rpc/cli/dsAudio.c:434

  • On invalid input, this should return dsERR_INVALID_PARAM (consistent with other APIs in this file) rather than dsERR_GENERAL. Also add a newline so the log doesn’t run into subsequent output.
        if (appAudioConfigList == NULL) {
	    INT_ERROR("%s:Invalid parameter", __func__);
	    return dsERR_GENERAL;
        }

rpc/cli/dsAudio.c:468

  • enable is dereferenced on success but is never validated. This can segfault if the caller passes NULL. Also return dsERR_INVALID_PARAM for invalid input to match other APIs in this file.
    if (audioConfig == NULL) {
	INT_ERROR("%s:Invalid parameter", __func__);
	return dsERR_GENERAL;
    }

ds/include/host.hpp:425

  • setApplicationAudioConfig(const char*, ...) is declared but has no definition in this PR, which can lead to undefined-symbol link errors if used. Consider making it an inline forwarder to the std::string overload (or remove the duplicate overload).
    void setApplicationAudioConfig(const char* audioConfig, bool enable);

Comment thread rpc/cli/dsAudio.c
Comment on lines +402 to +405
if (audioConfig == NULL) {
INT_ERROR("%s:Invalid parameter", __func__);
return dsERR_GENERAL;
}
Comment thread ds/host.cpp Outdated
strncpy(config.configName, audioConfig.c_str(), (DS_MAX_APPLICATION_AUDIO_CONFIG_NAME_LEN - 1));
dsError_t ret = dsSetApplicationAudioConfig (NULL, &config, enable);
if (ret != dsERR_NONE) {
std::cout << "Failed to set Host::setApplicationAudioConfig\n";
Comment thread ds/host.cpp
Comment on lines +571 to +573
{
INT_INFO("Shashank............Calling getApplicationAudioConfig\n");
dsApplicationAudioConfig_t config;
Comment thread ds/host.cpp Outdated
strncpy(config.configName, audioConfig.c_str(), (DS_MAX_APPLICATION_AUDIO_CONFIG_NAME_LEN -1 ));
dsError_t ret = dsGetApplicationAudioConfig (NULL, &config, enable);
if (ret != dsERR_NONE) {
std::cout << "Failed to set Host::getApplicationAudioConfig\n";
Comment thread ds/host.cpp
Comment on lines +594 to +596
{
INT_INFO("Shashank............Calling getApplicationAudioConfigList\n");
dsApplicationAudioConfigList_t appAudioConfigList;
Comment thread ds/host.cpp Outdated
memset(&appAudioConfigList, 0, sizeof(dsApplicationAudioConfigList_t));
dsError_t ret = dsGetApplicationAudioConfigList(NULL, &appAudioConfigList);
if (ret != dsERR_NONE) {
std::cout << "Failed to set Host::getApplicationAudioConfigList\n";
Copilot AI review requested due to automatic review settings July 21, 2026 16:03
@shashank4388
shashank4388 force-pushed the feature/RDKEMW-17086-app-audio-config branch from 82e8a5d to bf88a7d Compare July 21, 2026 16:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (7)

ds/include/host.hpp:425

  • Host declares setApplicationAudioConfig(const char*) but there is no implementation in this PR (only the std::string overload is implemented). This leaves a public API with an unresolved symbol if called; either remove it or provide a small forwarding wrapper.
    void setApplicationAudioConfig(const char* audioConfig, bool enable);

ds/host.cpp:606

  • This error log says "Failed to set" but the method is a getter, which makes troubleshooting confusing.
        INT_ERROR("Failed to set Host::getApplicationAudioConfigList\n");

rpc/cli/dsAudio.c:410

  • This client API currently drops the server-side dsError_t and always returns dsERR_GENERAL on failure, and it includes personal-name debug logs. Returning the actual param.result aligns with existing dsAudio RPC client patterns and preserves error details.
    INT_ERROR("Shashank...... dscli dsSetApplicationAudioConfig %s\n", audioConfig->configName);
    dsApplicationAudioConfigParam_t param;
    memset(&param, 0, sizeof(param));
    param.handle = handle;
    param.enable = enable;

rpc/cli/dsAudio.c:473

  • This client API currently drops the server-side dsError_t and always returns dsERR_GENERAL on failure, and it includes personal-name debug logs. Return param.result (after a successful IARM call) to preserve the actual error and match other client functions in this file.
    INT_ERROR("Shashank...... dscli dsGetApplicationAudioConfig %s\n", audioConfig->configName);
    dsApplicationAudioConfigParam_t param;
    memset(&param, 0, sizeof(param));
    param.handle = handle;
    // By default enable will be false.

rpc/cli/dsAudio.c:450

  • Error handling and copying in dsGetApplicationAudioConfigList should avoid printf, preserve the server-side dsError_t (param.result), and ensure copied configName strings are NUL-terminated.
        if (IARM_RESULT_SUCCESS != rpcRet || param.result != dsERR_NONE)
        {
                printf("%s: (GET) GENERAL ERROR\n", __FUNCTION__);
                return dsERR_GENERAL;
        }

rpc/srv/dsAudio.c:3713

  • These are normal control-flow logs (function entry / symbol resolved) but are emitted as INT_ERROR, which is misleading and noisy. Nearby RPC wrappers use INT_DEBUG/INT_INFO for the same cases (e.g., rpc/srv/dsAudio.c:4368-4372).
    INT_ERROR("Inside _dsGetApplicationAudioConfigList_t srv\n");
    if (func == 0) {
        void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
        if (dllib) {
            func = (dsGetApplicationAudioConfigList_t) dlsym(dllib, "dsGetApplicationAudioConfigList");

rpc/srv/dsAudio.c:3753

  • This is a normal control-flow log but is emitted as INT_ERROR, which is misleading and noisy. Prefer INT_DEBUG (or remove) for function-exit tracing.
    INT_ERROR("Inside _dsGetApplicationAudioConfigList srv\n");

Comment thread rpc/srv/dsAudio.c
Comment on lines +3768 to +3778
INT_ERROR("Inside _dsSetApplicationAudioConfig srv\n");
if (func == 0) {
void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
if (dllib) {
func = (dsSetApplicationAudioConfig_t) dlsym(dllib, "dsSetApplicationAudioConfig");
if (func) {
INT_ERROR("dsSetApplicationAudioConfig_t(int, bool) is defined and loaded\r\n");
}
else {
INT_ERROR("dsSetApplicationAudioConfig_t(int, bool) is not defined\r\n");
}
Comment thread rpc/srv/dsAudio.c
result = IARM_RESULT_SUCCESS;
}
}
INT_ERROR("Inside _dsSetApplicationAudioConfig srv\n");
Comment thread rpc/srv/dsAudio.c
Comment on lines +3820 to +3830
INT_ERROR("Inside _dsGetApplicationAudioConfig srv\n");
if (func == 0) {
void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
if (dllib) {
func = (dsGetApplicationAudioConfig_t) dlsym(dllib, "dsGetApplicationAudioConfig");
if (func) {
INT_ERROR("dsGetApplicationAudioConfig_t(int, bool) is defined and loaded\r\n");
}
else {
INT_ERROR("dsGetApplicationAudioConfig_t(int, bool) is not defined\r\n");
}
Comment thread rpc/srv/dsAudio.c
result = IARM_RESULT_SUCCESS;
}
}
INT_ERROR("Inside _dsGetApplicationAudioConfig srv\n");
@shashank4388
shashank4388 force-pushed the feature/RDKEMW-17086-app-audio-config branch from bf88a7d to d1ed81f Compare July 21, 2026 22:18
Copilot AI review requested due to automatic review settings July 21, 2026 22:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (5)

rpc/cli/dsAudio.c:410

  • The new client RPC wrapper logs personal/debug strings at error level and drops the underlying dsError_t on failure (it always returns dsERR_GENERAL unless fully successful). This makes troubleshooting harder and can spam error logs on normal paths; prefer neutral logs and return param.result when the bus call succeeded.
    INT_ERROR("Shashank...... dscli dsSetApplicationAudioConfig %s\n", audioConfig->configName);
    dsApplicationAudioConfigParam_t param;
    memset(&param, 0, sizeof(param));
    param.handle = handle;
    param.enable = enable;

rpc/cli/dsAudio.c:450

  • On error, this wrapper always returns dsERR_GENERAL and logs a generic message. If the RPC call itself succeeded but the server/HAL returned a specific dsError_t, that information should be propagated back to the caller.
        if (IARM_RESULT_SUCCESS != rpcRet || param.result != dsERR_NONE)
        {
                printf("%s: (GET) GENERAL ERROR\n", __FUNCTION__);
                return dsERR_GENERAL;
        }

rpc/cli/dsAudio.c:458

  • strncpy here does not guarantee NUL-termination, and the destination buffer is not cleared first. If the source name is exactly DS_MAX_APPLICATION_AUDIO_CONFIG_NAME_LEN-1 bytes, configName may become unterminated and later string operations can read past the buffer.
	for (int count=0; count <  param.appAudioConfigList.returnedCount; count++) {
	    strncpy(appAudioConfigList->config[count].configName, param.appAudioConfigList.config[count].configName, 
			    (DS_MAX_APPLICATION_AUDIO_CONFIG_NAME_LEN -1) );
	}

rpc/cli/dsAudio.c:473

  • This new client RPC wrapper logs personal/debug strings at error level and drops the underlying dsError_t on failure (it always returns dsERR_GENERAL unless fully successful). Prefer neutral logs and return param.result when the RPC call succeeded so callers can react appropriately.
    INT_ERROR("Shashank...... dscli dsGetApplicationAudioConfig %s\n", audioConfig->configName);
    dsApplicationAudioConfigParam_t param;
    memset(&param, 0, sizeof(param));
    param.handle = handle;
    // By default enable will be false.

ds/host.cpp:611

  • This method appends to the caller-provided vector without clearing it first. Repeated calls will accumulate duplicates, which is inconsistent with existing list-style APIs in this file (e.g., Host::getHostEDID clears its output vector before filling).
    for (int count =0; count < appAudioConfigList.returnedCount; count++) {
        configList.push_back(appAudioConfigList.config[count].configName);
    }

Comment thread rpc/srv/dsAudio.c
Comment on lines +3713 to +3720
func = (dsGetApplicationAudioConfigList_t) dlsym(dllib, "dsGetApplicationAudioConfigList");
if (func) {
INT_ERROR("dsGetApplicationAudioConfigList_t is defined and loaded\r\n");
}
else {
INT_ERROR("dsGetApplicationAudioConfigList is not defined\r\n");
}
dlclose(dllib);
Comment thread rpc/srv/dsAudio.c
Comment on lines +3772 to +3779
func = (dsSetApplicationAudioConfig_t) dlsym(dllib, "dsSetApplicationAudioConfig");
if (func) {
INT_ERROR("dsSetApplicationAudioConfig_t(int, bool) is defined and loaded\r\n");
}
else {
INT_ERROR("dsSetApplicationAudioConfig_t(int, bool) is not defined\r\n");
}
dlclose(dllib);
Comment thread rpc/srv/dsAudio.c
Comment on lines +3824 to +3831
func = (dsGetApplicationAudioConfig_t) dlsym(dllib, "dsGetApplicationAudioConfig");
if (func) {
INT_ERROR("dsGetApplicationAudioConfig_t(int, bool) is defined and loaded\r\n");
}
else {
INT_ERROR("dsGetApplicationAudioConfig_t(int, bool) is not defined\r\n");
}
dlclose(dllib);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants