-
Notifications
You must be signed in to change notification settings - Fork 4
RDKEMW-10107: Speaker volume level do not persist after reboot #169
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
Conversation
4e44852 to
68c03a9
Compare
rpc/srv/dsAudio.c
Outdated
|
|
||
| IARM_BUS_Lock(lock); | ||
| int volume = 0; | ||
| float m_volumeLevel = 0; |
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.
As this is local variable u can remove m_ prefix to avoid confusion
68c03a9 to
2b59b8e
Compare
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.
Pull Request Overview
This PR fixes an issue where the speaker volume level does not persist after a device reboot. The solution removes the static cached variable m_volumeLevel and replaces it with runtime calls to dsGetAudioLevel() to retrieve the current audio level from the underlying system.
- Removed static variable
m_volumeLevelthat was caching volume level - Modified
_dsSetAudioDucking()to calldsGetAudioLevel()to get current volume instead of using cached value - Updated
setAudioDuckingAudioLevel()to retrieve volume dynamically when ducking is not in progress
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ret = dsGetAudioLevel (param->handle, &volumeLevel); | ||
| if (ret != dsERR_NONE) { | ||
| INT_ERROR("%s failed dsGetAudioLevel\n",__FUNCTION__); |
Copilot
AI
Nov 12, 2025
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 dsGetAudioLevel() fails, volumeLevel remains 0 and the function continues execution. This could result in incorrect volume calculations (e.g., setting volume to 0 during ducking). Consider either returning early on failure or using a fallback value to prevent potential volume loss.
Suggestion:
ret = dsGetAudioLevel (param->handle, &volumeLevel);
if (ret != dsERR_NONE) {
INT_ERROR("%s failed dsGetAudioLevel\n",__FUNCTION__);
IARM_BUS_Unlock(lock);
return IARM_RESULT_INVALID_STATE;
}| INT_ERROR("%s failed dsGetAudioLevel\n",__FUNCTION__); | |
| INT_ERROR("%s failed dsGetAudioLevel\n",__FUNCTION__); | |
| IARM_BUS_Unlock(lock); | |
| return IARM_RESULT_INVALID_STATE; |
| INT_ERROR("%s dsGetAudioLevel\n",__FUNCTION__); | ||
| } | ||
| INT_DEBUG("%s: audio level %f\n", __FUNCTION__, volume); | ||
| } | ||
| if (dsSetAudioLevelFunc == 0) | ||
| { |
Copilot
AI
Nov 12, 2025
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 dsGetAudioLevel() fails, volume remains 0 but the function continues to set this value via dsSetAudioLevelFunc() at line 3220. This could incorrectly set the audio level to 0. Consider returning an error when dsGetAudioLevel() fails to prevent incorrect volume settings.
Suggestion:
dsError_t ret = dsGetAudioLevel (handle, &volume);
if (ret != dsERR_NONE) {
INT_ERROR("%s failed dsGetAudioLevel\n",__FUNCTION__);
return IARM_RESULT_INVALID_STATE;
}| INT_ERROR("%s dsGetAudioLevel\n",__FUNCTION__); | |
| } | |
| INT_DEBUG("%s: audio level %f\n", __FUNCTION__, volume); | |
| } | |
| if (dsSetAudioLevelFunc == 0) | |
| { | |
| INT_ERROR("%s failed dsGetAudioLevel\n",__FUNCTION__); | |
| return IARM_RESULT_INVALID_STATE; | |
| } | |
| INT_DEBUG("%s: audio level %f\n", __FUNCTION__, volume); | |
| } | |
| if (dsSetAudioLevelFunc == 0) |
2b59b8e to
a947093
Compare
https://ccp.sys.comcast.net/browse/RDKEMW-10107