[GStreamer][GTK][WPE] Expose and honor the media content types requiring hardware...
authoreocanha@igalia.com <eocanha@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 May 2020 07:47:05 +0000 (07:47 +0000)
committereocanha@igalia.com <eocanha@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 May 2020 07:47:05 +0000 (07:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=211950

Reviewed by Adrian Perez de Castro.

Source/WebCore:

Provide the needed information about media content types requiring hardware support
when asking the MediaPlayer about what types are supported. This was already being done
from HTMLMediaElement for player selection, but not in MediaSource nor in
MediaSource::addSourceBuffer() when the webpage used the MSE API to check type support.
In order to ask for the mediaContentTypesRequiringHardwareSupport setting we need a
reference to the current Document in all the places where we need to check type support.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::addSourceBuffer): Provide hardware content types extra info.
(WebCore::MediaSource::isTypeSupported): Get hardware content types extra info from
ScriptExecutionContext and provide it to a new refactored private version of
isTypeSupported() which can also be reused from addSourceBuffer().
* Modules/mediasource/MediaSource.h: Changed isTypeSupported() prototype to take
ScriptExecutionContext and added a new overloaded version of the method.
* Modules/mediasource/MediaSource.idl: isTypeSupported() now provides a reference to
ScriptExecutionContext. It's the only way to access the required document settings from a
static method.
* platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::isContentTypeSupported const): Factor ContentType
discrimination logic common to MediaPlayerPrivateGStreamer and
MediaPlayerPrivateGStreamerMSE.
* platform/graphics/gstreamer/GStreamerRegistryScanner.h: Added new method.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::supportsType): Provide hardware content types extra
info when asking for type support.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::supportsType): Ditto.

Source/WebKit:

Expose mediaContentTypesRequiringHardwareSupport as a setting on WPE and WebKitGTK.

* UIProcess/API/glib/WebKitSettings.cpp:
(_WebKitSettingsPrivate::_WebKitSettingsPrivate):
(webKitSettingsSetProperty):
(webKitSettingsGetProperty):
(webkit_settings_class_init):
(webkit_settings_get_media_content_types_requiring_hardware_support):
(webkit_settings_set_media_content_types_requiring_hardware_support):
* UIProcess/API/gtk/WebKitSettings.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
* UIProcess/API/wpe/WebKitSettings.h:
* UIProcess/API/wpe/docs/wpe-1.0-sections.txt:

Tools:

Exercise the new mediaContentTypesRequiringHardwareSupport setting.

* TestWebKitAPI/Tests/WebKitGLib/TestWebKitSettings.cpp:
(testWebKitSettings):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261986 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediasource/MediaSource.cpp
Source/WebCore/Modules/mediasource/MediaSource.h
Source/WebCore/Modules/mediasource/MediaSource.idl
Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp
Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp
Source/WebKit/UIProcess/API/gtk/WebKitSettings.h
Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt
Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml
Source/WebKit/UIProcess/API/wpe/WebKitSettings.h
Source/WebKit/UIProcess/API/wpe/docs/wpe-1.0-sections.txt
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitSettings.cpp

index 1b73d3b..fc05756 100644 (file)
@@ -1,3 +1,38 @@
+2020-05-21  Enrique Ocaña González  <eocanha@igalia.com>
+
+        [GStreamer][GTK][WPE] Expose and honor the media content types requiring hardware support setting
+        https://bugs.webkit.org/show_bug.cgi?id=211950
+
+        Reviewed by Adrian Perez de Castro.
+
+        Provide the needed information about media content types requiring hardware support
+        when asking the MediaPlayer about what types are supported. This was already being done
+        from HTMLMediaElement for player selection, but not in MediaSource nor in
+        MediaSource::addSourceBuffer() when the webpage used the MSE API to check type support.
+        In order to ask for the mediaContentTypesRequiringHardwareSupport setting we need a
+        reference to the current Document in all the places where we need to check type support.
+
+        * Modules/mediasource/MediaSource.cpp:
+        (WebCore::MediaSource::addSourceBuffer): Provide hardware content types extra info.
+        (WebCore::MediaSource::isTypeSupported): Get hardware content types extra info from
+        ScriptExecutionContext and provide it to a new refactored private version of
+        isTypeSupported() which can also be reused from addSourceBuffer().
+        * Modules/mediasource/MediaSource.h: Changed isTypeSupported() prototype to take
+        ScriptExecutionContext and added a new overloaded version of the method.
+        * Modules/mediasource/MediaSource.idl: isTypeSupported() now provides a reference to
+        ScriptExecutionContext. It's the only way to access the required document settings from a
+        static method.
+        * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
+        (WebCore::GStreamerRegistryScanner::isContentTypeSupported const): Factor ContentType
+        discrimination logic common to MediaPlayerPrivateGStreamer and
+        MediaPlayerPrivateGStreamerMSE.
+        * platform/graphics/gstreamer/GStreamerRegistryScanner.h: Added new method.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::supportsType): Provide hardware content types extra
+        info when asking for type support.
+        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType): Ditto.
+
 2020-05-20  Simon Fraser  <simon.fraser@apple.com>
 
         [macOS] Scrolling synchronization part 1: Have the scrolling thread wait half a frame for the main thread to complete the rendering update
index 99f7fd0..0a1b3ba 100644 (file)
@@ -42,6 +42,7 @@
 #include "Logging.h"
 #include "MediaSourcePrivate.h"
 #include "MediaSourceRegistry.h"
+#include "Settings.h"
 #include "SourceBuffer.h"
 #include "SourceBufferList.h"
 #include "SourceBufferPrivate.h"
@@ -677,7 +678,11 @@ ExceptionOr<Ref<SourceBuffer>> MediaSource::addSourceBuffer(const String& type)
 
     // 2. If type contains a MIME type that is not supported ..., then throw a
     // NotSupportedError exception and abort these steps.
-    if (!isTypeSupported(type))
+    Vector<ContentType> mediaContentTypesRequiringHardwareSupport;
+    if (m_mediaElement)
+        mediaContentTypesRequiringHardwareSupport.appendVector(m_mediaElement->document().settings().mediaContentTypesRequiringHardwareSupport());
+
+    if (!isTypeSupported(type, WTFMove(mediaContentTypesRequiringHardwareSupport)))
         return Exception { NotSupportedError };
 
     // 4. If the readyState attribute is not in the "open" state then throw an
@@ -869,7 +874,18 @@ ExceptionOr<void> MediaSource::removeSourceBuffer(SourceBuffer& buffer)
     return { };
 }
 
-bool MediaSource::isTypeSupported(const String& type)
+bool MediaSource::isTypeSupported(ScriptExecutionContext& context, const String& type)
+{
+    Vector<ContentType> mediaContentTypesRequiringHardwareSupport;
+    if (context.isDocument()) {
+        auto& document = downcast<Document>(context);
+        mediaContentTypesRequiringHardwareSupport.appendVector(document.settings().mediaContentTypesRequiringHardwareSupport());
+    }
+
+    return isTypeSupported(type, WTFMove(mediaContentTypesRequiringHardwareSupport));
+}
+
+bool MediaSource::isTypeSupported(const String& type, Vector<ContentType>&& contentTypesRequiringHardwareSupport)
 {
     // Section 2.2 isTypeSupported() method steps.
     // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#widl-MediaSource-isTypeSupported-boolean-DOMString-type
@@ -891,6 +907,8 @@ bool MediaSource::isTypeSupported(const String& type)
     MediaEngineSupportParameters parameters;
     parameters.type = contentType;
     parameters.isMediaSource = true;
+    parameters.contentTypesRequiringHardwareSupport = WTFMove(contentTypesRequiringHardwareSupport);
+
     MediaPlayer::SupportsType supported = MediaPlayer::supportsType(parameters);
 
     if (codecs.isEmpty())
index 71dc06c..f23e3f3 100644 (file)
@@ -104,7 +104,7 @@ public:
     SourceBufferList* activeSourceBuffers() { return m_activeSourceBuffers.get(); }
     ExceptionOr<Ref<SourceBuffer>> addSourceBuffer(const String& type);
     ExceptionOr<void> removeSourceBuffer(SourceBuffer&);
-    static bool isTypeSupported(const String& type);
+    static bool isTypeSupported(ScriptExecutionContext&, const String& type);
 
     ScriptExecutionContext* scriptExecutionContext() const final;
 
@@ -131,6 +131,7 @@ private:
     void stop() final;
     const char* activeDOMObjectName() const final;
     bool virtualHasPendingActivity() const final;
+    static bool isTypeSupported(const String& type, Vector<ContentType>&& contentTypesRequiringHardwareSupport);
 
     void setPrivateAndOpen(Ref<MediaSourcePrivate>&&) final;
     void seekToTime(const MediaTime&) final;
index 9698969..8479eef 100644 (file)
@@ -61,7 +61,7 @@ enum ReadyState {
     
     [MayThrowException] void endOfStream(optional EndOfStreamError error);
 
-    static boolean isTypeSupported (DOMString type);
+    [CallWith=ScriptExecutionContext] static boolean isTypeSupported (DOMString type);
 
     [MayThrowException] void setLiveSeekableRange(double start, double end);
     [MayThrowException] void clearLiveSeekableRange();
index 7922b33..3ff9d19 100644 (file)
@@ -298,6 +298,39 @@ bool GStreamerRegistryScanner::isCodecSupported(String codec, bool shouldCheckFo
     return supported;
 }
 
+MediaPlayerEnums::SupportsType GStreamerRegistryScanner::isContentTypeSupported(const ContentType& contentType, const Vector<ContentType>& contentTypesRequiringHardwareSupport) const
+{
+    using SupportsType = MediaPlayerEnums::SupportsType;
+
+    const auto& containerType = contentType.containerType();
+    if (!isContainerTypeSupported(containerType))
+        return SupportsType::IsNotSupported;
+
+    const auto& codecs = contentType.codecs();
+
+    // Spec says we should not return "probably" if the codecs string is empty.
+    if (codecs.isEmpty())
+        return SupportsType::MayBeSupported;
+
+    for (const auto& codec : codecs) {
+        bool requiresHardwareSupport = contentTypesRequiringHardwareSupport
+            .findMatching([containerType, codec](auto& hardwareContentType) -> bool {
+            auto hardwareContainer = hardwareContentType.containerType();
+            if (!hardwareContainer.isEmpty()
+                && fnmatch(hardwareContainer.utf8().data(), containerType.utf8().data(), 0))
+                return false;
+            auto hardwareCodecs = hardwareContentType.codecs();
+            return hardwareCodecs.isEmpty()
+                || hardwareCodecs.findMatching([codec](auto& hardwareCodec) -> bool {
+                    return !fnmatch(hardwareCodec.utf8().data(), codec.utf8().data(), 0);
+            }) != notFound;
+        }) != notFound;
+        if (!isCodecSupported(codec, requiresHardwareSupport))
+            return SupportsType::IsNotSupported;
+    }
+    return SupportsType::IsSupported;
+}
+
 bool GStreamerRegistryScanner::areAllCodecsSupported(const Vector<String>& codecs, bool shouldCheckForHardwareUse) const
 {
     for (String codec : codecs) {
index 2ddaec6..c2de1ff 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "MediaConfiguration.h"
 
+#include "MediaPlayerEnums.h"
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
@@ -51,6 +52,7 @@ public:
     RegistryLookupResult isDecodingSupported(MediaConfiguration&) const;
 
     bool isCodecSupported(String codec, bool usingHardware = false) const;
+    MediaPlayerEnums::SupportsType isContentTypeSupported(const ContentType&, const Vector<ContentType>& contentTypesRequiringHardwareSupport) const;
     bool areAllCodecsSupported(const Vector<String>& codecs, bool shouldCheckForHardwareUse = false) const;
 
 protected:
index 8b49c83..b8238d7 100644 (file)
@@ -2701,13 +2701,8 @@ MediaPlayer::SupportsType MediaPlayerPrivateGStreamer::supportsType(const MediaE
         return result;
 
     GST_DEBUG("Checking mime-type \"%s\"", parameters.type.raw().utf8().data());
-    auto containerType = parameters.type.containerType();
     auto& gstRegistryScanner = GStreamerRegistryScanner::singleton();
-    if (gstRegistryScanner.isContainerTypeSupported(containerType)) {
-        // Spec says we should not return "probably" if the codecs string is empty.
-        Vector<String> codecs = parameters.type.codecs();
-        result = codecs.isEmpty() ? MediaPlayer::SupportsType::MayBeSupported : (gstRegistryScanner.areAllCodecsSupported(codecs) ? MediaPlayer::SupportsType::IsSupported : MediaPlayer::SupportsType::IsNotSupported);
-    }
+    result = gstRegistryScanner.isContentTypeSupported(parameters.type, parameters.contentTypesRequiringHardwareSupport);
 
     auto finalResult = extendedSupportsType(parameters, result);
     GST_DEBUG("Supported: %s", convertEnumerationToString(finalResult).utf8().data());
index 23d6bbf..6d9a4ac 100644 (file)
@@ -754,11 +754,7 @@ MediaPlayer::SupportsType MediaPlayerPrivateGStreamerMSE::supportsType(const Med
 
     GST_DEBUG("Checking mime-type \"%s\"", parameters.type.raw().utf8().data());
     auto& gstRegistryScanner = GStreamerRegistryScannerMSE::singleton();
-    // Spec says we should not return "probably" if the codecs string is empty.
-    if (gstRegistryScanner.isContainerTypeSupported(containerType)) {
-        Vector<String> codecs = parameters.type.codecs();
-        result = codecs.isEmpty() ? MediaPlayer::SupportsType::MayBeSupported : (gstRegistryScanner.areAllCodecsSupported(codecs) ? MediaPlayer::SupportsType::IsSupported : MediaPlayer::SupportsType::IsNotSupported);
-    }
+    result = gstRegistryScanner.isContentTypeSupported(parameters.type, parameters.contentTypesRequiringHardwareSupport);
 
     auto finalResult = extendedSupportsType(parameters, result);
     GST_DEBUG("Supported: %s", convertEnumerationToString(finalResult).utf8().data());
index af8edb9..8fe6c4a 100644 (file)
@@ -1,3 +1,25 @@
+2020-05-21  Enrique Ocaña González  <eocanha@igalia.com>
+
+        [GStreamer][GTK][WPE] Expose and honor the media content types requiring hardware support setting
+        https://bugs.webkit.org/show_bug.cgi?id=211950
+
+        Reviewed by Adrian Perez de Castro.
+
+        Expose mediaContentTypesRequiringHardwareSupport as a setting on WPE and WebKitGTK.
+
+        * UIProcess/API/glib/WebKitSettings.cpp:
+        (_WebKitSettingsPrivate::_WebKitSettingsPrivate):
+        (webKitSettingsSetProperty):
+        (webKitSettingsGetProperty):
+        (webkit_settings_class_init):
+        (webkit_settings_get_media_content_types_requiring_hardware_support):
+        (webkit_settings_set_media_content_types_requiring_hardware_support):
+        * UIProcess/API/gtk/WebKitSettings.h:
+        * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
+        * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
+        * UIProcess/API/wpe/WebKitSettings.h:
+        * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
+
 2020-05-20  Darin Adler  <darin@apple.com>
 
         Dictation context should be an object identifier, not a type-punned pointer
index f336df7..fd16831 100644 (file)
@@ -78,6 +78,7 @@ struct _WebKitSettingsPrivate {
     CString pictographFontFamily;
     CString defaultCharset;
     CString userAgent;
+    CString mediaContentTypesRequiringHardwareSupport;
     bool allowModalDialogs { false };
     bool zoomTextOnly { false };
     double screenDpi { 96 };
@@ -170,6 +171,7 @@ enum {
 #endif
     PROP_ENABLE_JAVASCRIPT_MARKUP,
     PROP_ENABLE_MEDIA,
+    PROP_MEDIA_CONTENT_TYPES_REQUIRING_HARDWARE_SUPPORT,
 };
 
 static void webKitSettingsDispose(GObject* object)
@@ -400,6 +402,9 @@ static void webKitSettingsSetProperty(GObject* object, guint propId, const GValu
     case PROP_ENABLE_MEDIA:
         webkit_settings_set_enable_media(settings, g_value_get_boolean(value));
         break;
+    case PROP_MEDIA_CONTENT_TYPES_REQUIRING_HARDWARE_SUPPORT:
+        webkit_settings_set_media_content_types_requiring_hardware_support(settings, g_value_get_string(value));
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
         break;
@@ -591,6 +596,9 @@ static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* val
     case PROP_ENABLE_MEDIA:
         g_value_set_boolean(value, webkit_settings_get_enable_media(settings));
         break;
+    case PROP_MEDIA_CONTENT_TYPES_REQUIRING_HARDWARE_SUPPORT:
+        g_value_set_string(value, webkit_settings_get_media_content_types_requiring_hardware_support(settings));
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
         break;
@@ -1538,6 +1546,21 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass)
             TRUE,
             readWriteConstructParamFlags));
 
+    /**
+     * WebKitSettings:media-content-types-requiring-hardware-support:
+     *
+     * List of media content types requiring hardware support, split by semicolons (:).
+     * For example: 'video/webm; codecs="vp*":video/mp4; codecs="avc*":video/*; codecs="av1*"'.
+     *
+     * Since: 2.30
+     */
+    g_object_class_install_property(gObjectClass,
+        PROP_MEDIA_CONTENT_TYPES_REQUIRING_HARDWARE_SUPPORT,
+        g_param_spec_string("media-content-types-requiring-hardware-support",
+            _("Media content types requiring hardware support"),
+            _("List of media content types requiring hardware support."),
+            nullptr, // A null string forces the default value.
+            readWriteConstructParamFlags));
 }
 
 WebPreferences* webkitSettingsGetPreferences(WebKitSettings* settings)
@@ -3808,3 +3831,46 @@ void webkitSettingsSetMediaCaptureRequiresSecureConnection(WebKitSettings* setti
     WebKitSettingsPrivate* priv = settings->priv;
     priv->preferences->setMediaCaptureRequiresSecureConnection(required);
 }
+
+/**
+ * webkit_settings_get_media_content_types_requiring_hardware_support:
+ * @settings: a #WebKitSettings
+ *
+ * Gets the #WebKitSettings:media-content-types-requiring-hardware-support property.
+ *
+ * Returns: Media content types requiring hardware support, or %NULL.
+ *
+ * Since: 2.30
+ */
+const gchar* webkit_settings_get_media_content_types_requiring_hardware_support(WebKitSettings* settings)
+{
+    g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
+
+    const auto& mediaContentTypesRequiringHardwareSupport = settings->priv->mediaContentTypesRequiringHardwareSupport;
+    if (!mediaContentTypesRequiringHardwareSupport.length())
+        return nullptr;
+    return mediaContentTypesRequiringHardwareSupport.data();
+}
+
+/**
+ * webkit_settings_set_media_content_types_requiring_hardware_support:
+ * @settings: a #WebKitSettings
+ * @content_types: (allow-none) list of media content types requiring hardware support split by semicolons (:) or %NULL to use the default value.
+ *
+ * Set the #WebKitSettings:media-content-types-requiring-hardware-support property.
+ *
+ * Since: 2.30
+ */
+void webkit_settings_set_media_content_types_requiring_hardware_support(WebKitSettings* settings, const gchar* mediaContentTypesRequiringHardwareSupport)
+{
+    g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
+
+    WebKitSettingsPrivate* priv = settings->priv;
+    if (!g_strcmp0(priv->mediaContentTypesRequiringHardwareSupport.data(), mediaContentTypesRequiringHardwareSupport))
+        return;
+
+    String mediaContentTypesRequiringHardwareSupportString = String::fromUTF8(mediaContentTypesRequiringHardwareSupport);
+    priv->preferences->setMediaContentTypesRequiringHardwareSupport(mediaContentTypesRequiringHardwareSupportString);
+    priv->mediaContentTypesRequiringHardwareSupport = mediaContentTypesRequiringHardwareSupportString.utf8();
+    g_object_notify(G_OBJECT(settings), "media-content-types-requiring-hardware-support");
+}
index 01cb4f5..63aa8bb 100644 (file)
@@ -506,6 +506,13 @@ WEBKIT_API void
 webkit_settings_set_enable_media                               (WebKitSettings *settings,
                                                                 gboolean        enabled);
 
+WEBKIT_API const gchar *
+webkit_settings_get_media_content_types_requiring_hardware_support (WebKitSettings *settings);
+
+WEBKIT_API void
+webkit_settings_set_media_content_types_requiring_hardware_support (WebKitSettings *settings,
+                                                                    const gchar *content_types);
+
 G_END_DECLS
 
 #endif /* WebKitSettings_h */
index 52095b5..7c269af 100644 (file)
@@ -549,6 +549,8 @@ webkit_settings_font_size_to_points
 webkit_settings_font_size_to_pixels
 webkit_settings_get_enable_media
 webkit_settings_set_enable_media
+webkit_settings_get_media_content_types_requiring_hardware_support
+webkit_settings_set_media_content_types_requiring_hardware_support
 
 <SUBSECTION Standard>
 WebKitSettingsClass
index ab84d1f..8692cc5 100644 (file)
     <xi:include href="xml/api-index-2.28.xml"><xi:fallback /></xi:include>
   </index>
 
+  <index id="api-index-2-30" role="2.30">
+    <title>Index of new symbols in 2.30</title>
+    <xi:include href="xml/api-index-2.30.xml"><xi:fallback /></xi:include>
+  </index>
+
   <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
 </book>
index 9830049..f549779 100644 (file)
@@ -463,6 +463,13 @@ WEBKIT_API void
 webkit_settings_set_enable_media                               (WebKitSettings *settings,
                                                                 gboolean        enabled);
 
+WEBKIT_API const gchar *
+webkit_settings_get_media_content_types_requiring_hardware_support (WebKitSettings *settings);
+
+WEBKIT_API void
+webkit_settings_set_media_content_types_requiring_hardware_support (WebKitSettings *settings,
+                                                                    const gchar *content_types);
+
 G_END_DECLS
 
 #endif /* WebKitSettings_h */
index 385438b..709bf6b 100644 (file)
@@ -543,6 +543,8 @@ webkit_settings_get_allow_top_navigation_to_data_urls
 webkit_settings_set_allow_top_navigation_to_data_urls
 webkit_settings_get_enable_media
 webkit_settings_set_enable_media
+webkit_settings_get_media_content_types_requiring_hardware_support
+webkit_settings_set_media_content_types_requiring_hardware_support
 
 <SUBSECTION Standard>
 WebKitSettingsClass
index 3fcb2cc..db7a458 100644 (file)
@@ -1,3 +1,15 @@
+2020-05-21  Enrique Ocaña González  <eocanha@igalia.com>
+
+        [GStreamer][GTK][WPE] Expose and honor the media content types requiring hardware support setting
+        https://bugs.webkit.org/show_bug.cgi?id=211950
+
+        Reviewed by Adrian Perez de Castro.
+
+        Exercise the new mediaContentTypesRequiringHardwareSupport setting.
+
+        * TestWebKitAPI/Tests/WebKitGLib/TestWebKitSettings.cpp:
+        (testWebKitSettings):
+
 2020-05-20  Simon Fraser  <simon.fraser@apple.com>
 
         [macOS] Scrolling synchronization part 1: Have the scrolling thread wait half a frame for the main thread to complete the rendering update
index 1b46967..da04725 100644 (file)
@@ -341,6 +341,13 @@ static void testWebKitSettings(Test*, gconstpointer)
     webkit_settings_set_enable_media(settings, FALSE);
     g_assert_false(webkit_settings_get_enable_media(settings));
 
+    // Default media content types requiring hardware support is nullptr.
+    g_assert_cmpstr(nullptr, ==, webkit_settings_get_media_content_types_requiring_hardware_support(settings));
+    webkit_settings_set_media_content_types_requiring_hardware_support(settings, "video/*; codecs=\"*\"");
+    g_assert_cmpstr("video/*; codecs=\"*\"", ==, webkit_settings_get_media_content_types_requiring_hardware_support(settings));
+    webkit_settings_set_media_content_types_requiring_hardware_support(settings, nullptr);
+    g_assert_cmpstr(nullptr, ==, webkit_settings_get_media_content_types_requiring_hardware_support(settings));
+
 #if PLATFORM(GTK)
     // Ondemand is the default hardware acceleration policy.
     g_assert_cmpuint(webkit_settings_get_hardware_acceleration_policy(settings), ==, WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND);