Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Source/WebCore/platform/GStreamer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ if (ENABLE_ENCRYPTED_MEDIA AND ENABLE_THUNDER)
# Globally add thunder libraries, required for the check_cxx_symbol_exists call.
set(CMAKE_REQUIRED_LIBRARIES ${THUNDER_LIBRARIES})

check_cxx_symbol_exists(opencdm_system_supported_robustness ${THUNDER_INCLUDE_DIR}/open_cdm.h HAS_OCDM_SUPPORTED_ROBUSTNESS)
if (HAS_OCDM_SUPPORTED_ROBUSTNESS)
list(APPEND WebCore_PRIVATE_DEFINITIONS THUNDER_HAS_OCDM_SUPPORTED_ROBUSTNESS=1)
else ()
list(APPEND WebCore_PRIVATE_DEFINITIONS THUNDER_HAS_OCDM_SUPPORTED_ROBUSTNESS=0)
endif ()

check_cxx_symbol_exists(opencdm_gstreamer_session_decrypt_buffer ${THUNDER_INCLUDE_DIR}/open_cdm_adapter.h HAS_OCDM_DECRYPT_BUFFER)
if (HAS_OCDM_DECRYPT_BUFFER)
list(APPEND WebCore_PRIVATE_DEFINITIONS THUNDER_HAS_OCDM_DECRYPT_BUFFER=1)
Expand Down
34 changes: 33 additions & 1 deletion Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,39 @@ bool CDMPrivateThunder::supportsConfiguration(const CDMKeySystemConfiguration& c

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.


#if THUNDER_HAS_OCDM_SUPPORTED_ROBUSTNESS
if (!m_thunderSystem) {
GST_WARNING("CDMPrivateThunder: No active OpenCDM system. Falling back to default WebKit robustness levels.");
return defaultRobustnesses;
}

Vector<AtomString> robustnesses = { emptyAtom() };
char** buffer = nullptr;
uint16_t count = 0;

OpenCDMError error = opencdm_system_supported_robustness(m_thunderSystem.get(), &buffer, &count);
Comment thread
kkanag314 marked this conversation as resolved.
if (buffer) {
if (error == ERROR_NONE && count > 0)
robustnesses.reserveCapacity(robustnesses.size() + count);

for (uint16_t i = 0; i < count; ++i) {
if (error == ERROR_NONE && buffer[i])
robustnesses.append(AtomString::fromLatin1(buffer[i]));

free(buffer[i]);
}
free(buffer);
}

if (error == ERROR_NONE && robustnesses.size() > 1)
return robustnesses;

GST_WARNING("Failed to get robustness levels from OCDM.Falling back to default WebKit robustness levels.");
#endif

return defaultRobustnesses;
}

CDMRequirement CDMPrivateThunder::distinctiveIdentifiersRequirement(const CDMKeySystemConfiguration&, const CDMRestrictions&) const
Expand Down