Feature/hdm ifixwithloop - #510
Open
balasaraswathy-n wants to merge 6 commits into
Open
Conversation
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>
|
Pull request must be merged with a description containing the required fields, Summary: 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. |
Contributor
There was a problem hiding this comment.
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_onceusage and key-status pre/post checks to detect OUTPUT_RESTRICTED. - Add
MediaKeyErrorStatus::OUTPUT_RESTRICTEDand propagate it to varioustoString()helpers. - Add a retry loop in
MediaKeysServerInternal::decrypt, plus adjustCdmService::decrypt/pinglocking 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); |
added 2 commits
May 25, 2026 19:19
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduced loop to retry HDMI failure