Skip to content

Feature/hdm ifixwithloop - #510

Open
balasaraswathy-n wants to merge 6 commits into
masterfrom
feature/HDMIfixwithloop
Open

Feature/hdm ifixwithloop#510
balasaraswathy-n wants to merge 6 commits into
masterfrom
feature/HDMIfixwithloop

Conversation

@balasaraswathy-n

Copy link
Copy Markdown
Contributor

Introduced loop to retry HDMI failure

Adler, Douglas and others added 4 commits May 18, 2026 09:44
Reason for change: HCDP reauth retry logic needed
Test Procedure: Hot pug hdmi and observe retry log messages
Risks: Low
Priority: High

Signed-off-by: Adler, Douglas <Douglas_Adler2+comcast@comcast.com>
Copilot AI review requested due to automatic review settings May 25, 2026 08:54
@github-actions

Copy link
Copy Markdown

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.

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

Introduced an OUTPUT_RESTRICTED error path to support retrying decrypt during HDCP/HDMI re-auth scenarios, using a new OpenCDM “decrypt once” entrypoint and a server-side retry loop.

Changes:

  • Add optional opencdm_gstreamer_session_decrypt_buffer_once usage and key-status pre/post checks to detect OUTPUT_RESTRICTED.
  • Add MediaKeyErrorStatus::OUTPUT_RESTRICTED and propagate it to various toString() helpers.
  • Add a retry loop in MediaKeysServerInternal::decrypt, plus adjust CdmService::decrypt/ping locking behavior.

Reviewed changes

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

Show a summary per file
File Description
wrappers/source/OcdmSession.cpp Uses new OpenCDM “decrypt once” function and key-status checks to signal OUTPUT_RESTRICTED.
wrappers/include/OcdmSession.h Declares the new OpenCDM decrypt-once function pointer type/static.
media/server/service/source/CdmService.cpp Changes decrypt locking/lifetime handling and makes ping() non-blocking via try_lock.
media/server/main/source/MediaKeysServerInternal.cpp Adds OUTPUT_RESTRICTED retry loop with sleep/timeout and shutdown abort.
media/server/main/source/MediaKeysCapabilities.cpp Adds stringification for OUTPUT_RESTRICTED.
media/server/main/include/MediaKeysServerInternal.h Adds shutdown atomic; adds (currently unused) includes.
media/server/ipc/source/MediaKeysModuleService.cpp Adds an OUTPUT_RESTRICTED switch case but leaves it TODO.
media/public/include/MediaCommon.h Adds MediaKeyErrorStatus::OUTPUT_RESTRICTED to the public API enum.
media/client/ipc/source/MediaKeysIpc.cpp Adds stringification for OUTPUT_RESTRICTED.

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

Comment on lines +501 to +511
IMediaKeysServerInternal *mediaKeys{nullptr};
{
RIALTO_SERVER_LOG_ERROR("Media keys handle for mksId: %d does not exists", keySessionId);
return MediaKeyErrorStatus::FAIL;
}
return m_mediaKeys[mediaKeysHandleIter->second.mediaKeysHandle]->decrypt(keySessionId, encrypted, caps);
std::lock_guard<std::mutex> lock{m_mediaKeysMutex};
auto iter = m_sessionInfo.find(keySessionId);
if (iter == m_sessionInfo.end()) return MediaKeyErrorStatus::FAIL;
mediaKeys = m_mediaKeys[iter->second.mediaKeysHandle].get();
// Increment ref counter to prevent destruction while in use
++iter->second.refCounter;
}
auto status = mediaKeys->decrypt(keySessionId, encrypted, caps);
decrementSessionIdUsageCounter(keySessionId); // May trigger deferred release
Comment on lines +69 to +72
case firebolt::rialto::MediaKeyErrorStatus::OUTPUT_RESTRICTED:
{
// TODO
}
Comment on lines +295 to +296
BUFFER_TOO_SMALL, /**< The size of the buffer is too small. */
OUTPUT_RESTRICTED
Comment on lines +31 to +33
#include <atomic>
#include <mutex>
#include <condition_variable>
Comment on lines +591 to +592
if (m_isShuttingDown.load())
{
Comment on lines +582 to +586
const auto deadline = std::chrono::steady_clock::now() + kOutputRestrictedRetryTimeout;
do
{
auto task = [&]() { status = decryptInternal(keySessionId, encrypted, caps); };
m_mainThread->enqueueTaskAndWait(m_mainThreadClientId, task);
Copilot AI review requested due to automatic review settings May 25, 2026 13:57

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

Comment on lines +69 to +72
case firebolt::rialto::MediaKeyErrorStatus::OUTPUT_RESTRICTED:
{
// TODO
}
Comment on lines +503 to +507
std::lock_guard<std::mutex> lock{m_mediaKeysMutex};
auto iter = m_sessionInfo.find(keySessionId);
if (iter == m_sessionInfo.end()) return MediaKeyErrorStatus::FAIL;
mediaKeys = m_mediaKeys[iter->second.mediaKeysHandle].get();
// Increment ref counter to prevent destruction while in use
Comment on lines +609 to +613
std::unique_lock<std::mutex> lock{m_mediaKeysMutex, std::try_to_lock};

if (!lock.owns_lock())
{
// Server is alive but busy in decrypt retry — acknowledge ping
Comment on lines 293 to 297
INVALID_STATE, /**< The object is in an invalid state for the operation. */
INTERFACE_NOT_IMPLEMENTED, /**< The interface is not implemented. */
BUFFER_TOO_SMALL /**< The size of the buffer is too small. */
BUFFER_TOO_SMALL, /**< The size of the buffer is too small. */
OUTPUT_RESTRICTED
};
Comment on lines +459 to +463
needData(kSecondSourceId, m_frameCount, kSecondRequestId, m_shmInfo);

std::vector<uint8_t> data{'T', 'E', 'S', 'T'};
std::unique_ptr<IMediaPipeline::MediaSegment> frame = createFrame(MediaSourceType::AUDIO, data.size(), data.data());

Comment on lines +581 to +585
const uint64_t kDecryptGeneration = m_decryptGeneration.load();
bool didRetryAfterOutputRestricted{false};
MediaKeyErrorStatus status{MediaKeyErrorStatus::FAIL};
const auto deadline = std::chrono::steady_clock::now() + kOutputRestrictedRetryTimeout;
do
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.

3 participants