Skip to content

Adding debug logs to trace underflow flow#458

Open
Koky2701 wants to merge 1 commit intomasterfrom
feature/RDKEMW-14838
Open

Adding debug logs to trace underflow flow#458
Koky2701 wants to merge 1 commit intomasterfrom
feature/RDKEMW-14838

Conversation

@Koky2701
Copy link
Copy Markdown
Contributor

@Koky2701 Koky2701 commented Mar 6, 2026

[DO NOT MERGE] adding debug logs

Copilot AI review requested due to automatic review settings March 6, 2026 11:24
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 6, 2026

Pull request must be merged with a description containing the required fields,

Summary:
Type: Feature/Fix/Cleanup
Test Plan:
Jira:

If there is no jira releated to this change, please put 'Jira: NO-JIRA'.

Description can be changed by editing the top comment on your pull request and making a new commit.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds additional logging around buffer underflow notifications across gstplayer → server internal → client pipeline to help trace the underflow notification flow.

Changes:

  • Add detailed trace logs in MediaPipelineServerInternal::notifyBufferUnderflow before/after enqueuing and notifying the client.
  • Add additional logs in tasks::generic::Underflow::execute to trace underflow gating, streamInfo state, and client notification.
  • Add logs in client MediaPipeline::notifyBufferUnderflow around forwarding to the application client.

Reviewed changes

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

File Description
media/server/main/source/MediaPipelineServerInternal.cpp Adds trace logging around underflow notification enqueueing and dispatch to the IPC client.
media/server/gstplayer/source/tasks/generic/Underflow.cpp Adds trace logging around underflow detection and notification triggering in the gstplayer task.
media/client/main/source/MediaPipeline.cpp Adds logs when forwarding underflow notifications to the application client.

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

You can also share your feedback on Copilot code review. Take the survey.

StreamInfo &streamInfo = elem->second;
if (streamInfo.underflowOccured)
{
RIALTO_SERVER_LOG_WARN("Underflow OCCURED");
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

The log message contains a spelling error: "OCCURED" should be "OCCURRED".

Suggested change
RIALTO_SERVER_LOG_WARN("Underflow OCCURED");
RIALTO_SERVER_LOG_WARN("Underflow OCCURRED");

Copilot uses AI. Check for mistakes.
Comment on lines 41 to +72
@@ -50,15 +51,29 @@ void Underflow::execute() const
StreamInfo &streamInfo = elem->second;
if (streamInfo.underflowOccured)
{
RIALTO_SERVER_LOG_WARN("Underflow OCCURED");
return;
}
else
{
RIALTO_SERVER_LOG_WARN("Underflow did not occur, should set to true");
}

streamInfo.underflowOccured = true;

if (m_gstPlayerClient)
{
RIALTO_SERVER_LOG_WARN("Underflow: Client exists and it is notified");
m_gstPlayerClient->notifyBufferUnderflow(m_sourceType);
}
else
{
RIALTO_SERVER_LOG_WARN("Underflow: Client is not valid");
}
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

Most of the new logs in Underflow::execute are WARN-level but describe normal control flow (task executing, underflow not enabled, client exists, etc.). Since the underflow task may run repeatedly, this can generate large volumes of WARN logs in normal operation. Consider using DEBUG for flow tracing and reserving WARN for genuine issues (e.g., streamInfo not found, client missing when underflow is enabled).

Copilot uses AI. Check for mistakes.
}
else
{
RIALTO_SERVER_LOG_WARN("Underflow did not occur, should set to true");
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

This message is misleading: the branch is entered when underflowOccured is false, but it logs "Underflow did not occur" right before setting underflowOccured = true. Consider rewording to reflect the actual state (e.g., first underflow for this source / marking underflow occurred), otherwise the logs are hard to interpret during debugging.

Suggested change
RIALTO_SERVER_LOG_WARN("Underflow did not occur, should set to true");
RIALTO_SERVER_LOG_WARN("Underflow not previously recorded, marking as occurred");

Copilot uses AI. Check for mistakes.
Comment on lines +1580 to +1582
RIALTO_SERVER_LOG_WARN("notifyBufferUnderflow called for source %s",
common::convertMediaSourceType(mediaSourceType));

Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

PR title/description mention adding debug logs, but most newly added trace messages are logged at WARN level. If the intent is temporary debugging, consider using DEBUG (or gating behind a runtime flag) so these don’t ship as high-severity warnings.

Copilot uses AI. Check for mistakes.
Comment on lines +879 to +884
RIALTO_SERVER_LOG_WARN("MediaPipeline::notifyBufferUnderflow: sending notify underflow");
client->notifyBufferUnderflow(sourceId);
}
else
{
RIALTO_SERVER_LOG_WARN("MediaPipeline::notifyBufferUnderflow: client is invalid");
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

These new log lines use RIALTO_SERVER_LOG_WARN, but this is client-side code (includes RialtoClientLogging.h) and the rest of this file uses RIALTO_CLIENT_LOG_*. This is likely to misroute logs and may not compile if server logging macros are not available here. Use the client logging macro (RIALTO_CLIENT_LOG_WARN/DEBUG) instead.

Suggested change
RIALTO_SERVER_LOG_WARN("MediaPipeline::notifyBufferUnderflow: sending notify underflow");
client->notifyBufferUnderflow(sourceId);
}
else
{
RIALTO_SERVER_LOG_WARN("MediaPipeline::notifyBufferUnderflow: client is invalid");
RIALTO_CLIENT_LOG_WARN("MediaPipeline::notifyBufferUnderflow: sending notify underflow");
client->notifyBufferUnderflow(sourceId);
}
else
{
RIALTO_CLIENT_LOG_WARN("MediaPipeline::notifyBufferUnderflow: client is invalid");

Copilot uses AI. Check for mistakes.
Comment on lines +1583 to 1591
if (!m_mediaPipelineClient)
{
RIALTO_SERVER_LOG_WARN("notifyBufferUnderflow: m_mediaPipelineClient is NULL");
}
else
{
RIALTO_SERVER_LOG_DEBUG("notifyBufferUnderflow: m_mediaPipelineClient is valid");
}

Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

notifyBufferUnderflow is invoked from the gstplayer worker thread (via the Underflow task) and is expected to just enqueue work onto m_mainThread. The new pre-enqueue m_mediaPipelineClient checks/logs access shared state on the worker thread, which can break the existing thread-confinement pattern used by other notify* methods in this file. Move these client validity logs inside the enqueued task (main thread), or otherwise synchronize access if it must be read on the calling thread.

Suggested change
if (!m_mediaPipelineClient)
{
RIALTO_SERVER_LOG_WARN("notifyBufferUnderflow: m_mediaPipelineClient is NULL");
}
else
{
RIALTO_SERVER_LOG_DEBUG("notifyBufferUnderflow: m_mediaPipelineClient is valid");
}

Copilot uses AI. Check for mistakes.
Comment on lines 1580 to +1614
@@ -1590,10 +1603,24 @@ void MediaPipelineServerInternal::notifyBufferUnderflow(MediaSourceType mediaSou
common::convertMediaSourceType(mediaSourceType));
return;
}

RIALTO_SERVER_LOG_WARN("Buffer underflow sending to client, sourceId=%d (%s)",
kSourceIter->second,
common::convertMediaSourceType(mediaSourceType));

m_mediaPipelineClient->notifyBufferUnderflow(kSourceIter->second);

RIALTO_SERVER_LOG_WARN("Buffer underflow notification SENT to client");
}
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

Several of these newly added messages are emitted at WARN level even though they are trace-style flow logs (e.g., "called", "task executing", "notification SENT"). Buffer underflow can happen frequently, so WARN-level tracing here is likely to flood production logs and trigger alerting. Consider downgrading these to DEBUG (and keep WARN for actual abnormal/error cases like missing sourceId or null client).

Copilot uses AI. Check for mistakes.
@Koky2701 Koky2701 force-pushed the feature/RDKEMW-14838 branch from 07570f7 to f0df10f Compare March 6, 2026 11:30
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 6, 2026

Coverage statistics of your commit:
WARNING: Lines coverage decreased from: 85.2% to 85.1%
Functions coverage stays unchanged and is: 92.5%

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