Skip to content

Commit 0cbf052

Browse files
committed
REGRESSION(295500@main): [GStreamer] Assert when running http/tests/media/video-cross-site.html https://bugs.webkit.org/show_bug.cgi?id=294251
Reviewed by Xabier Rodriguez-Calvar. Initialize Thunder key systems within the CDMFactory constructor, which is first called from GStreamerCommon's initialization and make the supportedKeySystems() callable from non-main thread. * Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp: (WebCore::CDMFactoryThunder::CDMFactoryThunder): (WebCore::CDMFactoryThunder::supportedKeySystems const): * Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.h: Canonical link: https://commits.webkit.org/296122@main
1 parent 0b254ee commit 0cbf052

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -114,24 +114,25 @@ RefPtr<CDMProxy> CDMFactoryThunder::createCDMProxy(const String& keySystem)
114114
return adoptRef(new CDMProxyThunder(keySystem));
115115
}
116116

117-
const Vector<String>& CDMFactoryThunder::supportedKeySystems() const
117+
CDMFactoryThunder::CDMFactoryThunder()
118118
{
119119
ASSERT(isMainThread());
120120

121-
static Vector<String> supportedKeySystems;
122-
if (supportedKeySystems.isEmpty()) {
123-
std::string emptyString;
124-
if (opencdm_is_type_supported(GStreamerEMEUtilities::s_WidevineKeySystem, emptyString.c_str()) == ERROR_NONE)
125-
supportedKeySystems.append(String::fromLatin1(GStreamerEMEUtilities::s_WidevineKeySystem));
126-
if (opencdm_is_type_supported(GStreamerEMEUtilities::s_ClearKeyKeySystem, emptyString.c_str()) == ERROR_NONE)
127-
supportedKeySystems.append(String::fromLatin1(GStreamerEMEUtilities::s_ClearKeyKeySystem));
128-
if (opencdm_is_type_supported(GStreamerEMEUtilities::s_PlayReadyKeySystems[0], emptyString.c_str()) == ERROR_NONE) {
129-
supportedKeySystems.append(String::fromLatin1(GStreamerEMEUtilities::s_PlayReadyKeySystems[0]));
130-
supportedKeySystems.append(String::fromLatin1(GStreamerEMEUtilities::s_PlayReadyKeySystems[1]));
131-
}
132-
GST_DEBUG("%zu supported key systems", supportedKeySystems.size());
121+
std::string emptyString;
122+
if (opencdm_is_type_supported(GStreamerEMEUtilities::s_WidevineKeySystem, emptyString.c_str()) == ERROR_NONE)
123+
m_supportedKeySystems.append(String::fromLatin1(GStreamerEMEUtilities::s_WidevineKeySystem));
124+
if (opencdm_is_type_supported(GStreamerEMEUtilities::s_ClearKeyKeySystem, emptyString.c_str()) == ERROR_NONE)
125+
m_supportedKeySystems.append(String::fromLatin1(GStreamerEMEUtilities::s_ClearKeyKeySystem));
126+
if (opencdm_is_type_supported(GStreamerEMEUtilities::s_PlayReadyKeySystems[0], emptyString.c_str()) == ERROR_NONE) {
127+
m_supportedKeySystems.append(String::fromLatin1(GStreamerEMEUtilities::s_PlayReadyKeySystems[0]));
128+
m_supportedKeySystems.append(String::fromLatin1(GStreamerEMEUtilities::s_PlayReadyKeySystems[1]));
133129
}
134-
return supportedKeySystems;
130+
GST_DEBUG("%zu supported key systems", m_supportedKeySystems.size());
131+
}
132+
133+
const Vector<String>& CDMFactoryThunder::supportedKeySystems() const
134+
{
135+
return m_supportedKeySystems;
135136
}
136137

137138
bool CDMFactoryThunder::supportsKeySystem(const String& keySystem)

Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ class CDMFactoryThunder final : public CDMFactory, public CDMProxyFactory {
6666

6767
private:
6868
friend class NeverDestroyed<CDMFactoryThunder>;
69-
CDMFactoryThunder() = default;
69+
CDMFactoryThunder();
70+
Vector<String> m_supportedKeySystems;
7071
};
7172

7273
class CDMPrivateThunder final : public CDMPrivate {

0 commit comments

Comments
 (0)