Skip to content

RDKEMW-22891,RDKEMW-22808,RDKEMW-22129: Audio muted FFV - #279

Open
santoshcomcast wants to merge 6 commits into
developfrom
topic/RDKEMW-22891-Audio-muted-FFV2
Open

RDKEMW-22891,RDKEMW-22808,RDKEMW-22129: Audio muted FFV#279
santoshcomcast wants to merge 6 commits into
developfrom
topic/RDKEMW-22891-Audio-muted-FFV2

Conversation

@santoshcomcast

Copy link
Copy Markdown
Contributor

Reason for change: Audio muted FFV.
Test Procedure: refer RDKEMW-22891
Risks: High
Signed-off-by:gsanto722 grandhi_santoshkumar@comcast.com

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>
Copilot AI lite review requested due to automatic review settings August 10, 2026 12:34
@santoshcomcast
santoshcomcast requested a review from a team as a code owner August 10, 2026 12:34

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

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_LastVolumeLevel initialization to prefer persisted SPEAKER/HDMI cached levels rather than the last-processed port’s m_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.

Comment thread rpc/srv/dsAudio.c Outdated
Comment on lines +422 to +433
// 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));
}
Copilot AI review requested due to automatic review settings August 10, 2026 15:04

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 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 of 0.0 (muted/min volume) as "not available" and will fall back to HDMI or the default. Since the caches are initialized to 0.0 as 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/NaN and 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();

Copilot AI review requested due to automatic review settings August 11, 2026 10:41

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 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.0 as 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();

Comment thread rpc/srv/dsAudio.c Outdated
Comment on lines +55 to +56
#include "safec_lib.h"
#include "UtilsSearchRDKProfile.h"
Copilot AI review requested due to automatic review settings August 11, 2026 11:29

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 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.properties and stores the result in profileType. Calling searchRdkProfile() here duplicates that file I/O and can lead to inconsistent behavior/log spam if the file is temporarily unavailable; use profileType instead.
		profile_t rdkProfile = searchRdkProfile();

rpc/srv/dsAudio.c:442

  • In the "unknown profile" fallback, audioLevel_cache_* > 0.0 treats a valid persisted volume of 0.0 (muted) as "not available" and can incorrectly jump to HDMI or the 40.0 default, unexpectedly unmuting on systems where RDK_PROFILE is 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));
		    }

Copilot AI review requested due to automatic review settings August 11, 2026 16:02

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 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

rpc/srv/dsAudio.c:56

  • dsInternal.h is 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 or dsAudioOutIsConnected returns an error, isHeadphoneConnected stays false and the HEADPHONE0 level init is skipped. This differs from the server-side _dsAudioOutIsConnected behavior (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

Copilot AI review requested due to automatic review settings August 12, 2026 09:29

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 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

rpc/srv/dsAudio.c:56

  • dsInternal.h is included here but none of its symbols are referenced in this translation unit. Since that header also contains file-scope static data, 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 isHeadphoneConnected to false and ignores the dsAudioOutIsConnected() 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()s RDK_DSHAL_NAME even though dllib is 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) {

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.

2 participants