RDKEMW-22891,RDKEMW-22808,RDKEMW-22129: Audio muted FFV - #279
RDKEMW-22891,RDKEMW-22808,RDKEMW-22129: Audio muted FFV#279santoshcomcast wants to merge 6 commits into
Conversation
Reason for change: Audio muted FFV. Test Procedure: refer RDKEMW-22891 Risks: High Signed-off-by:gsanto722 <grandhi_santoshkumar@comcast.com> Co-authored-by: apatel859 <Amit_Patel5@comcast.com>
There was a problem hiding this comment.
Pull request overview
Adjusts audio initialization in dsAudio.c to better derive the “last known volume level” during startup, aiming to address cases where audio ends up muted/incorrect after fast-forward/rewind scenarios.
Changes:
- Switches
m_LastVolumeLevelinitialization to prefer persisted SPEAKER/HDMI cached levels rather than the last-processed port’sm_audioLevel. - Adds explicit fallback selection between SPEAKER cache, HDMI cache, and a default (40.0).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // Use SPEAKER cache for TV (primary), HDMI cache for STB (primary) | ||
| // Avoids using fallback "40" from last-processed port if that port failed persistence | ||
| if (audioLevel_cache_speaker > 0.0) { | ||
| m_LastVolumeLevel = audioLevel_cache_speaker; | ||
| INT_INFO("%s: audio level during init config m_LastVolumeLevel : %f (from SPEAKER cache)\n", __FUNCTION__, float(m_LastVolumeLevel)); | ||
| } else if (audioLevel_cache_hdmi > 0.0) { | ||
| m_LastVolumeLevel = audioLevel_cache_hdmi; | ||
| INT_INFO("%s: audio level during init config m_LastVolumeLevel : %f (from HDMI cache)\n", __FUNCTION__, float(m_LastVolumeLevel)); | ||
| } else { | ||
| m_LastVolumeLevel = 40.0; // Final fallback if both primary ports failed | ||
| INT_INFO("%s: audio level during init config m_LastVolumeLevel : %f (fallback default)\n", __FUNCTION__, float(m_LastVolumeLevel)); | ||
| } |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (2)
rpc/srv/dsAudio.c:428
audioLevel_cache_speaker.load()/audioLevel_cache_hdmi.load()are called both in the condition and again for the assignment. Loading once into locals avoids redundant atomic loads and guarantees the value used in the condition matches the value assigned/logged.
if (audioLevel_cache_speaker.load() > 0.0) {
m_LastVolumeLevel = audioLevel_cache_speaker.load();
INT_INFO("%s: audio level during init config m_LastVolumeLevel : %f (from SPEAKER cache)\n", __FUNCTION__, float(m_LastVolumeLevel));
} else if (audioLevel_cache_hdmi.load() > 0.0) {
m_LastVolumeLevel = audioLevel_cache_hdmi.load();
rpc/srv/dsAudio.c:428
- The cache validity check uses
> 0.0, which treats a legitimate persisted volume of0.0(muted/min volume) as "not available" and will fall back to HDMI or the default. Since the caches are initialized to0.0as well, this logic can’t distinguish "port not present/uninitialized" from a real 0 volume; use an explicit validity flag (set when the port init runs) or initialize caches to a sentinel like-1.0f/NaNand test that instead.
This issue also appears on line 424 of the same file.
if (audioLevel_cache_speaker.load() > 0.0) {
m_LastVolumeLevel = audioLevel_cache_speaker.load();
INT_INFO("%s: audio level during init config m_LastVolumeLevel : %f (from SPEAKER cache)\n", __FUNCTION__, float(m_LastVolumeLevel));
} else if (audioLevel_cache_hdmi.load() > 0.0) {
m_LastVolumeLevel = audioLevel_cache_hdmi.load();
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
rpc/srv/dsAudio.c:443
- In the unknown-profile branch, using
> 0.0as an "available cache" check treats a persisted volume of 0 as missing and falls back to 40.0, changing behavior (and potentially unmuting). Consider preserving the previous behavior by using the last initialized port level (m_audioLevel) for unknown profiles.
if (audioLevel_cache_speaker.load() > 0.0) {
m_LastVolumeLevel = audioLevel_cache_speaker.load();
INT_INFO("%s: audio level during init config m_LastVolumeLevel : %f (unknown profile: SPEAKER cache)\n", __FUNCTION__, float(m_LastVolumeLevel));
} else if (audioLevel_cache_hdmi.load() > 0.0) {
m_LastVolumeLevel = audioLevel_cache_hdmi.load();
| #include "safec_lib.h" | ||
| #include "UtilsSearchRDKProfile.h" |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (2)
rpc/srv/dsAudio.c:424
dsMgr_init()already reads/etc/device.propertiesand stores the result inprofileType. CallingsearchRdkProfile()here duplicates that file I/O and can lead to inconsistent behavior/log spam if the file is temporarily unavailable; useprofileTypeinstead.
profile_t rdkProfile = searchRdkProfile();
rpc/srv/dsAudio.c:442
- In the "unknown profile" fallback,
audioLevel_cache_* > 0.0treats a valid persisted volume of0.0(muted) as "not available" and can incorrectly jump to HDMI or the40.0default, unexpectedly unmuting on systems whereRDK_PROFILEis missing/invalid.
} else {
// Profile unknown: prefer SPEAKER if available, else HDMI, else default
if (audioLevel_cache_speaker.load() > 0.0) {
m_LastVolumeLevel = audioLevel_cache_speaker.load();
INT_INFO("%s: audio level during init config m_LastVolumeLevel : %f (unknown profile: SPEAKER cache)\n", __FUNCTION__, float(m_LastVolumeLevel));
} else if (audioLevel_cache_hdmi.load() > 0.0) {
m_LastVolumeLevel = audioLevel_cache_hdmi.load();
INT_INFO("%s: audio level during init config m_LastVolumeLevel : %f (unknown profile: HDMI cache)\n", __FUNCTION__, float(m_LastVolumeLevel));
} else {
m_LastVolumeLevel = 40.0;
INT_INFO("%s: audio level during init config m_LastVolumeLevel : %f (unknown profile: fallback default)\n", __FUNCTION__, float(m_LastVolumeLevel));
}
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (2)
rpc/srv/dsAudio.c:56
dsInternal.his included here but nothing from it is referenced in this file, which adds an unnecessary dependency and compile-time coupling.
#include "safec_lib.h"
#include "dsInternal.h"
rpc/srv/dsAudio.c:393
- If
dlopen(RDK_DSHAL_NAME, ...)fails ordsAudioOutIsConnectedreturns an error,isHeadphoneConnectedstaysfalseand the HEADPHONE0 level init is skipped. This differs from the server-side_dsAudioOutIsConnectedbehavior (defaults to connected on failure) and can cause unintended volume init regressions.
void *hplib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
if (hplib) {
dsAudioOutIsConnected_t isConFunc = (dsAudioOutIsConnected_t)dlsym(hplib, "dsAudioOutIsConnected");
if (isConFunc) isConFunc(handle, &isHeadphoneConnected);
else isHeadphoneConnected = true; // assume connected if HAL symbol absent
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (2)
rpc/srv/dsAudio.c:56
dsInternal.his included here but none of its symbols are referenced in this translation unit. Since that header also contains file-scopestaticdata, including it unnecessarily increases compilation unit size and can introduce unused-symbol warnings.
#include "safec_lib.h"
#include "dsInternal.h"
rpc/srv/dsAudio.c:387
- The new headphone init defaults
isHeadphoneConnectedtofalseand ignores thedsAudioOutIsConnected()return value. If the HAL call fails (non-dsERR_NONE) the code will treat the port as disconnected and skip setting the persisted level, which is inconsistent with the existing "assume connected" behavior used elsewhere in this repo. Also, the code re-dlopen()sRDK_DSHAL_NAMEeven thoughdllibis already open in this scope.
bool isHeadphoneConnected = false;
if (dsGetAudioPort(dsAUDIOPORT_TYPE_HEADPHONE, 0, &handle) == dsERR_NONE) {
typedef dsError_t (*dsAudioOutIsConnected_t)(intptr_t handle, bool *isCon);
void *hplib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
if (hplib) {
Reason for change: Audio muted FFV.
Test Procedure: refer RDKEMW-22891
Risks: High
Signed-off-by:gsanto722 grandhi_santoshkumar@comcast.com