Skip to content

Querying robustnesslevel from CDM instead of hardcoding the levels. - #1715

Closed
kkanag314 wants to merge 2 commits into
WebPlatformForEmbedded:wpe-2.46from
kkanag314:ocdm-robustness
Closed

Querying robustnesslevel from CDM instead of hardcoding the levels.#1715
kkanag314 wants to merge 2 commits into
WebPlatformForEmbedded:wpe-2.46from
kkanag314:ocdm-robustness

Conversation

@kkanag314

@kkanag314 kkanag314 commented Aug 17, 2026

Copy link
Copy Markdown

Query robustnesslevel from CDM instead of hardcoding the levels.
bd41d2f

Build-Tests Layout-Tests
✅ 🛠 wpe-246-amd64-build ✅ 🧪 wpe-246-amd64-layout
✅ 🛠 wpe-246-arm32-build ✅ 🧪 wpe-246-arm32-layout

@kkanag314
kkanag314 force-pushed the ocdm-robustness branch 4 times, most recently from a59219e to 9d4da06 Compare August 18, 2026 15:08
@emutavchi
emutavchi requested a review from modeveci August 18, 2026 15:34
@modeveci
modeveci requested review from calvaris and eocanha August 18, 2026 15:37
@eocanha eocanha self-assigned this Aug 18, 2026

@eocanha eocanha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contribution, Krishna.

It would be nice to explain briefly the purpose of the patch in the PR description. That would help me to understand its rationale and review it in a more efficient way.
Also, please join both commits in a single one and write a commit message that explains a bit what the purpose of the commit is and what it does. You can use git rebase -i b5686e7^ (that's the previous commit to the first one in the branch) and mark the second commit of the branch as "f" (fix) of the first one.

Thank you so much.

Comment thread Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp Outdated
Comment thread Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp Outdated

@eocanha eocanha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The PR looks good. I'm going to submit it upstream and then backport it when it's approved.
I'm also going to add a modification that I'm explaining inline below. It's not required that you resubmit any changes. I'm taking care of that.

Comment thread Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp
}
}
}
if (buffer != nullptr)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll do the same change here and write it as if (buffer).

uint16_t count = 0;

OpenCDMError error = opencdm_system_supported_robustness(m_thunderSystem.get(), &buffer, &count);
if (error == ERROR_NONE && buffer != nullptr && count > 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm going to adapt the buffer != nullptr condition to the WebKit Code Style Guidelines and rewrite it as buffer (which evaluates to true when the pointer is not null) when I submit the patch upstream.

Vector<AtomString> CDMPrivateThunder::supportedRobustnesses() const
{
return { emptyAtom(), "SW_SECURE_DECODE"_s, "SW_SECURE_CRYPTO"_s };
static const Vector<AtomString> defaultRobustnesses = { emptyAtom(), "SW_SECURE_DECODE"_s, "SW_SECURE_CRYPTO"_s };

@eocanha eocanha Aug 19, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs to be a Vector<String> because the AtomString one can't be automatically converted to a String vector. I'll do the change here, don't worry.

Sorry, it's fine. I was looking at the upstream type, which is String.

@kkanag314

Copy link
Copy Markdown
Author

This PR is a follow-up to PR #1715 , which introduced an OpenCDM API and corresponding WPEWebKit integration to query supported robustness levels directly from the CDM, addressing the concern raised in issue #1465 regarding hardcoded robustness values. This change adds fallback handling to preserve the existing WebKit behavior when the OpenCDM robustness query is unavailable or fails, ensuring backward compatibility while continuing to expose actual CDM capabilities whenever available.

@kkanag314
kkanag314 requested a review from eocanha August 19, 2026 15:51
@eocanha

eocanha commented Aug 20, 2026

Copy link
Copy Markdown
Member

Bug submitted for upstream review as https://bugs.webkit.org/show_bug.cgi?id=322180 / WebKit/WebKit#72029.

I had to do some extra changes and refactorings to take care of an unsafe buffer usage warning reported by clang, which doesn't like the pointer arithmetics required by opencdm_system_supported_robustness() to make use of its returned array and count.

@eocanha

eocanha commented Aug 20, 2026

Copy link
Copy Markdown
Member

Commit landed upstream as WebKit/WebKit@616b4d8 and was backported to wpe-2.46 as 54382f2. Closing PR.

@eocanha eocanha closed this Aug 20, 2026
@eocanha eocanha added the upstream Related to an upstream bug (or should be at some point) label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream Related to an upstream bug (or should be at some point) wpe-2.46

Development

Successfully merging this pull request may close these issues.

3 participants