Skip to content

RDKEMW-23040: NTS Resolution switch and PLAY-DRM* failure with Rialto - #597

Merged
Koky2701 merged 2 commits into
masterfrom
feature/RDKEMW-23040
Sep 25, 2026
Merged

Koky2701 merged 2 commits into
masterfrom
feature/RDKEMW-23040

Conversation

@Koky2701

Copy link
Copy Markdown
Contributor

RDKEMW-23040: Property applied before brcmvidfilter NULL→READY

Reason for change: It's a race between two independent processes, and a race has two possible outcomes each run. Property applied before brcmvidfilter NULL→READY → configured in time → PASS and property applied after brcmvidfilter NULL→READY → missed the window → FAIL
Test Procedure: https://ccp.sys.comcast.net/browse/RDKEMW-23040

Copilot AI lite review requested due to automatic review settings August 31, 2026 14:29
@github-actions

Copy link
Copy Markdown

Pull request title must follow the pattern:
< JIRA TICKET >: < one line summary of change less than 65 characters >

Pull request description must follow the Commit message format for RDK-E:
https://etwiki.sys.comcast.net/spaces/RDKAR/pages/1407997180/Commit+Message+Format+For+RDKE

  1. Associated JIRA ticket in format : < JIRA TICKET >: < one line summary of change less than 65 characters >
  2. Detailed reason for change information
  3. Test procedure. Only references links to Jira ticket or sub tickets where test steps and references are captured.

< JIRA TICKET >: < one line summary of change less than 65 characters >
< empty line >
Reason for change:
Test Procedure: < https://ccp.sys.comcast.net/browse/JIRA TICKET/url/to/test_step_section>

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

Addresses a race where playback-related GStreamer element properties can be applied too late (after brcmvidfilter transitions NULL→READY), causing intermittent NTS resolution switch and PLAY-DRM failures, by ensuring queued properties are applied as soon as relevant elements are added.

Changes:

  • Apply queued stream-sync-mode / syncmode-streaming, limit-buffering-ms, and sync-off immediately in GstGenericPlayer::setupElement() when the corresponding decoder/parser appears.
  • Add propertyMutex protection around writes to pending property state in several generic tasks.
  • Update unit/component tests to account for the new factory checks and updated call counts.

Reviewed changes

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

Show a summary per file
File Description
media/server/gstplayer/source/GstGenericPlayer.cpp Applies queued properties during element-setup to avoid missing the configuration window.
media/server/gstplayer/source/Utils.cpp Adds factory-based overload helpers to classify elements without re-querying factories.
media/server/gstplayer/include/Utils.h Exposes new factory-based overloads used by setupElement().
media/server/gstplayer/source/tasks/generic/SetUseBuffering.cpp Guards pending property write with propertyMutex.
media/server/gstplayer/source/tasks/generic/SetSyncOff.cpp Guards pending property write with propertyMutex.
media/server/gstplayer/source/tasks/generic/SetStreamSyncMode.cpp Guards pending property write with propertyMutex.
media/server/gstplayer/source/tasks/generic/SetBufferingLimit.cpp Guards pending property write with propertyMutex.
tests/unittests/media/server/gstplayer/genericPlayer/GstGenericPlayerTest.cpp Adds coverage for immediate application when video parser is added; updates setup expectations.
tests/componenttests/server/tests/mediaPipeline/UnderflowTest.cpp Adjusts expectations for repeated factory type checks.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread media/server/gstplayer/source/tasks/generic/SetStreamSyncMode.cpp Outdated
Comment thread media/server/gstplayer/source/GstGenericPlayer.cpp Outdated
@github-actions

Copy link
Copy Markdown

Coverage statistics of your commit:
WARNING: Lines coverage decreased from: 84.4% to 84.3%
Functions coverage stays unchanged and is: 92.7%

Copilot AI review requested due to automatic review settings August 31, 2026 16:26
@Koky2701
Koky2701 force-pushed the feature/RDKEMW-23040 branch from 8ee4839 to 2ec07d8 Compare August 31, 2026 16:26

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 10 out of 10 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

media/server/gstplayer/source/GstGenericPlayer.cpp:409

  • The new propertyMutex usage in setupElement() protects pending* values from the GStreamer thread, but GstGenericPlayer::setSyncOff() still reads and resets m_context.pendingSyncOff without taking propertyMutex (see GstGenericPlayer.cpp:2273-2292). That creates a potential data race between the worker thread and this callback when both try to consume/update pendingSyncOff. Consider guarding pendingSyncOff access in setSyncOff() with the same mutex (or otherwise ensuring single-threaded access).
        std::unique_lock lock{self->m_context.propertyMutex};

media/server/gstplayer/source/GstGenericPlayer.cpp:475

  • For the video parser branch, static_cast(int32_t) can produce values other than 0/1 (any non-zero becomes “true”), and the same operator[] pattern does an extra lookup. Coercing to TRUE/FALSE from a non-zero check and using the find() iterator keeps the stored/logged value deterministic.
        if (self->m_context.pendingStreamSyncMode.find(MediaSourceType::VIDEO) !=
            self->m_context.pendingStreamSyncMode.end())
        {
            gboolean streamSyncModeBoolean{
                static_cast<gboolean>(self->m_context.pendingStreamSyncMode[MediaSourceType::VIDEO])};
            self->m_context.pendingStreamSyncMode.erase(MediaSourceType::VIDEO);
            lock.unlock();

Comment thread media/server/gstplayer/source/GstGenericPlayer.cpp Outdated
@Koky2701
Koky2701 force-pushed the feature/RDKEMW-23040 branch from 2ec07d8 to cb8609e Compare August 31, 2026 16:41
Copilot AI review requested due to automatic review settings August 31, 2026 16: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 10 out of 10 changed files in this pull request and generated no new comments.

Suppressed comments (2)

media/server/gstplayer/source/GstGenericPlayer.cpp:2302

  • In setSyncOff(), pendingSyncOff is cleared unconditionally after applying the value. If another thread updates pendingSyncOff while the property is being applied, the later update can be lost when this code resets the pending value. Clearing should be conditional on the pending value still matching the value that was applied (or move/reset the pending value before applying while ensuring decoder != NULL).
        m_gstWrapper->gstObjectUnref(decoder);

        std::unique_lock lock{m_context.propertyMutex};
        m_context.pendingSyncOff.reset();
    }

media/server/gstplayer/source/tasks/generic/SetStreamSyncMode.cpp:44

  • SetStreamSyncMode::execute() uses emplace() when updating pendingStreamSyncMode. If setStreamSyncMode() is called multiple times for the same MediaSourceType before the pending value is consumed, emplace() will keep the first value and ignore later updates, which is surprising for a setter. Prefer overwrite semantics (operator[]/insert_or_assign).
    {
        std::unique_lock lock{m_context.propertyMutex};
        m_context.pendingStreamSyncMode.emplace(m_type, m_streamSyncMode);
    }

Copilot AI review requested due to automatic review settings August 31, 2026 16:48
@Koky2701
Koky2701 force-pushed the feature/RDKEMW-23040 branch from cb8609e to ad87533 Compare August 31, 2026 16:48

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

Suppressed comments (1)

media/server/gstplayer/source/tasks/generic/SetStreamSyncMode.cpp:44

  • pendingStreamSyncMode.emplace(m_type, m_streamSyncMode) will not overwrite an existing queued value for the same MediaSourceType. If setStreamSyncMode() is called multiple times while the element is not yet available (so the pending entry is not erased), the newer value will be dropped and the old value applied when the element appears.
    {
        std::unique_lock lock{m_context.propertyMutex};
        m_context.pendingStreamSyncMode.emplace(m_type, m_streamSyncMode);
    }

@Koky2701
Koky2701 force-pushed the feature/RDKEMW-23040 branch from ad87533 to 3f72fc1 Compare September 1, 2026 08:28
Copilot AI review requested due to automatic review settings September 1, 2026 08:28

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

Comment thread tests/unittests/media/server/gstplayer/genericPlayer/GstGenericPlayerTest.cpp Outdated
Copilot AI review requested due to automatic review settings September 1, 2026 08:34
@Koky2701
Koky2701 force-pushed the feature/RDKEMW-23040 branch from 3f72fc1 to 8517655 Compare September 1, 2026 08: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

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

tests/unittests/media/server/gstplayer/genericPlayer/common/GenericTasksTestsBase.cpp:844

  • GenericTasksTestsBase::shouldSetupAudioDecoderElementWithPendingBufferingLimit() is still declared (and used by SetupElementTest), but its definition was removed here. This will fail to link; also the previous expectation that SetupElement triggers setBufferingLimit() is no longer valid now that buffering-limit application moved to GstGenericPlayer::setupElement().

Reintroduce the helper with updated expectations (no setBufferingLimit() call expected from the SetupElement task).

void GenericTasksTestsBase::shouldSetupAudioDecoderElementWithIsLiveParameter()
{
    testContext->m_context.isLive = true;
    EXPECT_CALL(*testContext->m_glibWrapper, gTypeName(G_OBJECT_TYPE(testContext->m_element)))
        .WillOnce(Return(kElementTypeName.c_str()));

Comment thread media/server/gstplayer/source/GstGenericPlayer.cpp Outdated
@Koky2701
Koky2701 force-pushed the feature/RDKEMW-23040 branch from 8517655 to 4666108 Compare September 1, 2026 08:48
Copilot AI review requested due to automatic review settings September 1, 2026 08:48

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 13 out of 13 changed files in this pull request and generated 1 comment.

Comment thread tests/unittests/media/server/gstplayer/genericPlayer/GstGenericPlayerTest.cpp Outdated
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Coverage statistics of your commit:
Lines coverage stays unchanged and is: 84.4%
Functions coverage stays unchanged and is: 92.7%

Copilot AI review requested due to automatic review settings September 24, 2026 10:01
@Koky2701
Koky2701 force-pushed the feature/RDKEMW-23040 branch from b7a7101 to c3d44f0 Compare September 24, 2026 10:01

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.

Comment thread media/server/gstplayer/source/tasks/generic/SetupElement.cpp Outdated
Comment thread tests/componenttests/server/tests/mediaPipeline/UnderflowTest.cpp
Copilot AI review requested due to automatic review settings September 24, 2026 11:00
@Koky2701
Koky2701 force-pushed the feature/RDKEMW-23040 branch from c3d44f0 to 79405c5 Compare September 24, 2026 11:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Comment on lines 671 to +674
EXPECT_CALL(*testContext->m_gstWrapper,
gstElementFactoryListIsType(testContext->m_elementFactory,
GST_ELEMENT_FACTORY_TYPE_PARSER | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO))
.WillOnce(Return(TRUE));
.Times(2);
Copilot AI review requested due to automatic review settings September 24, 2026 12:48
@Koky2701
Koky2701 force-pushed the feature/RDKEMW-23040 branch from 79405c5 to 16fee68 Compare September 24, 2026 12:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Comment thread tests/componenttests/server/tests/mediaPipeline/UnderflowTest.cpp
gstElementFactoryListIsType(testContext->m_elementFactory,
GST_ELEMENT_FACTORY_TYPE_DECODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO))
.WillOnce(Return(FALSE));
.Times(2);
@github-actions

Copy link
Copy Markdown

Coverage statistics of your commit:
Lines coverage stays unchanged and is: 85.0%
Functions coverage stays unchanged and is: 93.4%

@Koky2701
Koky2701 force-pushed the feature/RDKEMW-23040 branch from 16fee68 to e4389c8 Compare September 24, 2026 13:23
Copilot AI review requested due to automatic review settings September 24, 2026 13:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown

Coverage statistics of your commit:
Lines coverage stays unchanged and is: 85.0%
Functions coverage stays unchanged and is: 93.4%

Copilot AI review requested due to automatic review settings September 24, 2026 14:05
@Koky2701
Koky2701 force-pushed the feature/RDKEMW-23040 branch from e4389c8 to af57548 Compare September 24, 2026 14:05

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.


// This is the extra EXPECT caused by setting pendingStreamSyncMode...
EXPECT_CALL(testContext->m_gstPlayer, setStreamSyncMode(MediaSourceType::VIDEO));
expectSetupVideoParserElement();
@github-actions

Copy link
Copy Markdown

Coverage statistics of your commit:
Congratulations, your commit improved lines coverage from: 84.4% to 85.0%
Congratulations, your commit improved functions coverage from: 92.7% to 93.4%

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown

Coverage statistics of your commit:
Lines coverage stays unchanged and is: 85.0%
Functions coverage stays unchanged and is: 93.4%

RIALTO_SERVER_LOG_INFO("Setting syncmode-streaming to 1 on video parser (immediate)");
bool streamSyncModePending{false};
{
std::unique_lock lock{m_context.propertyMutex};

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.

lock not needed

bool streamSyncModePending{false};
bool bufferingLimitPending{false};
{
std::unique_lock lock{m_context.propertyMutex};

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.

lock not needed

bool streamSyncModePending{false};
bool bufferingLimitPending{false};
{
std::unique_lock lock{m_context.propertyMutex};

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.

lock not needed

if (m_context.pendingStreamSyncMode.find(MediaSourceType::VIDEO) != m_context.pendingStreamSyncMode.end())
bool streamSyncModePending{false};
{
std::unique_lock lock{m_context.propertyMutex};

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.

lock not needed

        Summary: Fixing failed UT/valgrind tests
        Type: Fix
        Test Plan: UT/CT, Fullstack
        Jira: RDKEMW-23040

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.

@github-actions

Copy link
Copy Markdown

Coverage statistics of your commit:
Lines coverage stays unchanged and is: 85.0%
Functions coverage stays unchanged and is: 93.4%

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants