Diff
Modified: trunk/Source/WebCore/ChangeLog (230624 => 230625)
--- trunk/Source/WebCore/ChangeLog 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/ChangeLog 2018-04-13 08:50:42 UTC (rev 230625)
@@ -1,3 +1,54 @@
+2018-04-13 Xabier Rodriguez Calvar <calva...@igalia.com>
+
+ [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
+ https://bugs.webkit.org/show_bug.cgi?id=184533
+
+ Reviewed by Philippe Normand.
+
+ Renamed GStreamerUtilities* files into GStreamerCommon* and
+ modified files including them accordingly. Include
+ GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
+ to avoid problems destroying objects when those files are
+ forgotten to be included.
+
+ * Modules/webaudio/AudioContext.cpp:
+ * platform/GStreamer.cmake:
+ * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
+ * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
+ * platform/graphics/gstreamer/GStreamerCommon.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp.
+ * platform/graphics/gstreamer/GStreamerCommon.h: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h.
+ * platform/graphics/gstreamer/ImageGStreamer.h:
+ * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
+ * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
+ * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+ * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
+ * platform/graphics/gstreamer/MediaSampleGStreamer.h:
+ * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
+ * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
+ * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
+ * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
+ * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
+ * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+ * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
+ * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
+ * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
+ * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
+ * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
+ * platform/graphics/gstreamer/mse/AppendPipeline.h:
+ * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp:
+ * platform/graphics/gstreamer/mse/GStreamerMediaDescription.h:
+ * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
+ * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
+ * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
+ * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
+ * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
+ * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
+ * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
+
2018-04-12 Christopher Reid <chris.r...@sony.com>
[Curl] Fix clang build error in CurlContext.cpp
Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (230624 => 230625)
--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -85,7 +85,7 @@
#endif
#if USE(GSTREAMER)
-#include "GStreamerUtilities.h"
+#include "GStreamerCommon.h"
#endif
#if PLATFORM(IOS)
Modified: trunk/Source/WebCore/platform/GStreamer.cmake (230624 => 230625)
--- trunk/Source/WebCore/platform/GStreamer.cmake 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/GStreamer.cmake 2018-04-13 08:50:42 UTC (rev 230625)
@@ -8,7 +8,7 @@
list(APPEND WebCore_SOURCES
platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp
platform/graphics/gstreamer/GRefPtrGStreamer.cpp
- platform/graphics/gstreamer/GStreamerUtilities.cpp
+ platform/graphics/gstreamer/GStreamerCommon.cpp
platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp
platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp
platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Modified: trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -25,8 +25,7 @@
#include "AudioBus.h"
#include "AudioIOCallback.h"
-#include "GRefPtrGStreamer.h"
-#include "GStreamerUtilities.h"
+#include "GStreamerCommon.h"
#include <gst/app/gstappsrc.h>
#include <gst/audio/audio-info.h>
#include <gst/pbutils/missing-plugins.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -28,7 +28,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK)
#include "AudioTrackPrivate.h"
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "TrackPrivateBaseGStreamer.h"
#include <gst/gst.h>
#include <wtf/WeakPtr.h>
Copied: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp (from rev 230624, trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp) (0 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -0,0 +1,325 @@
+/*
+ * Copyright (C) 2012, 2015, 2016 Igalia S.L
+ * Copyright (C) 2015, 2016 Metrological Group B.V.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "config.h"
+#include "GStreamerCommon.h"
+
+#if USE(GSTREAMER)
+
+#include "GstAllocatorFastMalloc.h"
+#include "IntSize.h"
+#include <gst/audio/audio-info.h>
+#include <gst/gst.h>
+#include <mutex>
+#include <wtf/glib/GLibUtilities.h>
+#include <wtf/glib/GUniquePtr.h>
+
+#if ENABLE(VIDEO_TRACK) && USE(GSTREAMER_MPEGTS)
+#define GST_USE_UNSTABLE_API
+#include <gst/mpegts/mpegts.h>
+#undef GST_USE_UNSTABLE_API
+#endif
+
+namespace WebCore {
+
+const char* webkitGstMapInfoQuarkString = "webkit-gst-map-info";
+
+GstPad* webkitGstGhostPadFromStaticTemplate(GstStaticPadTemplate* staticPadTemplate, const gchar* name, GstPad* target)
+{
+ GstPad* pad;
+ GstPadTemplate* padTemplate = gst_static_pad_template_get(staticPadTemplate);
+
+ if (target)
+ pad = gst_ghost_pad_new_from_template(name, target, padTemplate);
+ else
+ pad = gst_ghost_pad_new_no_target_from_template(name, padTemplate);
+
+ gst_object_unref(padTemplate);
+
+ return pad;
+}
+
+#if ENABLE(VIDEO)
+bool getVideoSizeAndFormatFromCaps(GstCaps* caps, WebCore::IntSize& size, GstVideoFormat& format, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride)
+{
+ if (!doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) {
+ GST_WARNING("Failed to get the video size and format, these are not a video caps");
+ return false;
+ }
+
+ if (areEncryptedCaps(caps)) {
+ GstStructure* structure = gst_caps_get_structure(caps, 0);
+ format = GST_VIDEO_FORMAT_ENCODED;
+ stride = 0;
+ int width = 0, height = 0;
+ gst_structure_get_int(structure, "width", &width);
+ gst_structure_get_int(structure, "height", &height);
+ if (!gst_structure_get_fraction(structure, "pixel-aspect-ratio", &pixelAspectRatioNumerator, &pixelAspectRatioDenominator)) {
+ pixelAspectRatioNumerator = 1;
+ pixelAspectRatioDenominator = 1;
+ }
+
+ size.setWidth(width);
+ size.setHeight(height);
+ } else {
+ GstVideoInfo info;
+ gst_video_info_init(&info);
+ if (!gst_video_info_from_caps(&info, caps))
+ return false;
+
+ format = GST_VIDEO_INFO_FORMAT(&info);
+ size.setWidth(GST_VIDEO_INFO_WIDTH(&info));
+ size.setHeight(GST_VIDEO_INFO_HEIGHT(&info));
+ pixelAspectRatioNumerator = GST_VIDEO_INFO_PAR_N(&info);
+ pixelAspectRatioDenominator = GST_VIDEO_INFO_PAR_D(&info);
+ stride = GST_VIDEO_INFO_PLANE_STRIDE(&info, 0);
+ }
+
+ return true;
+}
+
+std::optional<FloatSize> getVideoResolutionFromCaps(const GstCaps* caps)
+{
+ if (!doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) {
+ GST_WARNING("Failed to get the video resolution, these are not a video caps");
+ return std::nullopt;
+ }
+
+ int width = 0, height = 0;
+ int pixelAspectRatioNumerator = 1, pixelAspectRatioDenominator = 1;
+
+ if (areEncryptedCaps(caps)) {
+ GstStructure* structure = gst_caps_get_structure(caps, 0);
+ gst_structure_get_int(structure, "width", &width);
+ gst_structure_get_int(structure, "height", &height);
+ gst_structure_get_fraction(structure, "pixel-aspect-ratio", &pixelAspectRatioNumerator, &pixelAspectRatioDenominator);
+ } else {
+ GstVideoInfo info;
+ gst_video_info_init(&info);
+ if (!gst_video_info_from_caps(&info, caps))
+ return std::nullopt;
+
+ width = GST_VIDEO_INFO_WIDTH(&info);
+ height = GST_VIDEO_INFO_HEIGHT(&info);
+ pixelAspectRatioNumerator = GST_VIDEO_INFO_PAR_N(&info);
+ pixelAspectRatioDenominator = GST_VIDEO_INFO_PAR_D(&info);
+ }
+
+ return std::make_optional(FloatSize(width, height * (static_cast<float>(pixelAspectRatioNumerator) / static_cast<float>(pixelAspectRatioDenominator))));
+}
+
+bool getSampleVideoInfo(GstSample* sample, GstVideoInfo& videoInfo)
+{
+ if (!GST_IS_SAMPLE(sample))
+ return false;
+
+ GstCaps* caps = gst_sample_get_caps(sample);
+ if (!caps)
+ return false;
+
+ gst_video_info_init(&videoInfo);
+ if (!gst_video_info_from_caps(&videoInfo, caps))
+ return false;
+
+ return true;
+}
+#endif
+
+GstBuffer* createGstBuffer(GstBuffer* buffer)
+{
+ gsize bufferSize = gst_buffer_get_size(buffer);
+ GstBuffer* newBuffer = gst_buffer_new_and_alloc(bufferSize);
+
+ if (!newBuffer)
+ return 0;
+
+ gst_buffer_copy_into(newBuffer, buffer, static_cast<GstBufferCopyFlags>(GST_BUFFER_COPY_METADATA), 0, bufferSize);
+ return newBuffer;
+}
+
+GstBuffer* createGstBufferForData(const char* data, int length)
+{
+ GstBuffer* buffer = gst_buffer_new_and_alloc(length);
+
+ gst_buffer_fill(buffer, 0, data, length);
+
+ return buffer;
+}
+
+const char* capsMediaType(const GstCaps* caps)
+{
+ ASSERT(caps);
+ GstStructure* structure = gst_caps_get_structure(caps, 0);
+ if (!structure) {
+ GST_WARNING("caps are empty");
+ return nullptr;
+ }
+#if ENABLE(ENCRYPTED_MEDIA)
+ if (gst_structure_has_name(structure, "application/x-cenc"))
+ return gst_structure_get_string(structure, "original-media-type");
+#endif
+ return gst_structure_get_name(structure);
+}
+
+bool doCapsHaveType(const GstCaps* caps, const char* type)
+{
+ const char* mediaType = capsMediaType(caps);
+ if (!mediaType) {
+ GST_WARNING("Failed to get MediaType");
+ return false;
+ }
+ return g_str_has_prefix(mediaType, type);
+}
+
+bool areEncryptedCaps(const GstCaps* caps)
+{
+ ASSERT(caps);
+#if ENABLE(ENCRYPTED_MEDIA)
+ GstStructure* structure = gst_caps_get_structure(caps, 0);
+ if (!structure) {
+ GST_WARNING("caps are empty");
+ return false;
+ }
+ return gst_structure_has_name(structure, "application/x-cenc");
+#else
+ UNUSED_PARAM(caps);
+ return false;
+#endif
+}
+
+char* getGstBufferDataPointer(GstBuffer* buffer)
+{
+ GstMiniObject* miniObject = reinterpret_cast<GstMiniObject*>(buffer);
+ GstMapInfo* mapInfo = static_cast<GstMapInfo*>(gst_mini_object_get_qdata(miniObject, g_quark_from_static_string(webkitGstMapInfoQuarkString)));
+ return reinterpret_cast<char*>(mapInfo->data);
+}
+
+void mapGstBuffer(GstBuffer* buffer, uint32_t flags)
+{
+ GstMapInfo* mapInfo = static_cast<GstMapInfo*>(fastMalloc(sizeof(GstMapInfo)));
+ if (!gst_buffer_map(buffer, mapInfo, static_cast<GstMapFlags>(flags))) {
+ fastFree(mapInfo);
+ gst_buffer_unref(buffer);
+ return;
+ }
+
+ GstMiniObject* miniObject = reinterpret_cast<GstMiniObject*>(buffer);
+ gst_mini_object_set_qdata(miniObject, g_quark_from_static_string(webkitGstMapInfoQuarkString), mapInfo, nullptr);
+}
+
+void unmapGstBuffer(GstBuffer* buffer)
+{
+ GstMiniObject* miniObject = reinterpret_cast<GstMiniObject*>(buffer);
+ GstMapInfo* mapInfo = static_cast<GstMapInfo*>(gst_mini_object_steal_qdata(miniObject, g_quark_from_static_string(webkitGstMapInfoQuarkString)));
+
+ if (!mapInfo)
+ return;
+
+ gst_buffer_unmap(buffer, mapInfo);
+ fastFree(mapInfo);
+}
+
+Vector<String> extractGStreamerOptionsFromCommandLine()
+{
+ GUniqueOutPtr<char> contents;
+ gsize length;
+ if (!g_file_get_contents("/proc/self/cmdline", &contents.outPtr(), &length, nullptr))
+ return { };
+
+ Vector<String> options;
+ auto optionsString = String::fromUTF8(contents.get(), length);
+ optionsString.split('\0', false, [&options](StringView item) {
+ if (item.startsWith("--gst"))
+ options.append(item.toString());
+ });
+ return options;
+}
+
+bool initializeGStreamer(std::optional<Vector<String>>&& options)
+{
+ static std::once_flag onceFlag;
+ static bool isGStreamerInitialized;
+ std::call_once(onceFlag, [options = WTFMove(options)] {
+ isGStreamerInitialized = false;
+
+#if ENABLE(VIDEO) || ENABLE(WEB_AUDIO)
+ Vector<String> parameters = options.value_or(extractGStreamerOptionsFromCommandLine());
+ char** argv = g_new0(char*, parameters.size() + 2);
+ int argc = parameters.size() + 1;
+ argv[0] = g_strdup(getCurrentExecutableName().data());
+ for (unsigned i = 0; i < parameters.size(); i++)
+ argv[i + 1] = g_strdup(parameters[i].utf8().data());
+
+ GUniqueOutPtr<GError> error;
+ isGStreamerInitialized = gst_init_check(&argc, &argv, &error.outPtr());
+ ASSERT_WITH_MESSAGE(isGStreamerInitialized, "GStreamer initialization failed: %s", error ? error->message : "unknown error occurred");
+ g_strfreev(argv);
+
+ if (isFastMallocEnabled()) {
+ const char* disableFastMalloc = getenv("WEBKIT_GST_DISABLE_FAST_MALLOC");
+ if (!disableFastMalloc || !strcmp(disableFastMalloc, "0"))
+ gst_allocator_set_default(GST_ALLOCATOR(g_object_new(gst_allocator_fast_malloc_get_type(), nullptr)));
+ }
+
+#if ENABLE(VIDEO_TRACK) && USE(GSTREAMER_MPEGTS)
+ if (isGStreamerInitialized)
+ gst_mpegts_initialize();
+#endif
+#endif
+ });
+ return isGStreamerInitialized;
+}
+
+unsigned getGstPlayFlag(const char* nick)
+{
+ static GFlagsClass* flagsClass = static_cast<GFlagsClass*>(g_type_class_ref(g_type_from_name("GstPlayFlags")));
+ ASSERT(flagsClass);
+
+ GFlagsValue* flag = g_flags_get_value_by_nick(flagsClass, nick);
+ if (!flag)
+ return 0;
+
+ return flag->value;
+}
+
+// Convert a MediaTime in seconds to a GstClockTime. Note that we can get MediaTime objects with a time scale that isn't a GST_SECOND, since they can come to
+// us through the internal testing API, the DOM and internally. It would be nice to assert the format of the incoming time, but all the media APIs assume time
+// is passed around in fractional seconds, so we'll just have to assume the same.
+uint64_t toGstUnsigned64Time(const MediaTime& mediaTime)
+{
+ MediaTime time = mediaTime.toTimeScale(GST_SECOND);
+ if (time.isInvalid())
+ return GST_CLOCK_TIME_NONE;
+ return time.timeValue();
+}
+
+bool gstRegistryHasElementForMediaType(GList* elementFactories, const char* capsString)
+{
+ GRefPtr<GstCaps> caps = adoptGRef(gst_caps_from_string(capsString));
+ GList* candidates = gst_element_factory_list_filter(elementFactories, caps.get(), GST_PAD_SINK, false);
+ bool result = candidates;
+
+ gst_plugin_feature_list_free(candidates);
+ return result;
+}
+
+}
+
+#endif // USE(GSTREAMER)
Copied: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h (from rev 230624, trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h) (0 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2012, 2015, 2016 Igalia S.L
+ * Copyright (C) 2015, 2016 Metrological Group B.V.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#pragma once
+
+#if USE(GSTREAMER)
+#include "FloatSize.h"
+#include "GRefPtrGStreamer.h"
+#include "GUniquePtrGStreamer.h"
+#include <gst/gst.h>
+#include <gst/video/video-format.h>
+#include <gst/video/video-info.h>
+#include <wtf/MediaTime.h>
+
+namespace WebCore {
+
+class IntSize;
+
+inline bool webkitGstCheckVersion(guint major, guint minor, guint micro)
+{
+ guint currentMajor, currentMinor, currentMicro, currentNano;
+ gst_version(¤tMajor, ¤tMinor, ¤tMicro, ¤tNano);
+
+ if (currentMajor < major)
+ return false;
+ if (currentMajor > major)
+ return true;
+
+ if (currentMinor < minor)
+ return false;
+ if (currentMinor > minor)
+ return true;
+
+ if (currentMicro < micro)
+ return false;
+
+ return true;
+}
+
+#define GST_VIDEO_CAPS_TYPE_PREFIX "video/"
+#define GST_AUDIO_CAPS_TYPE_PREFIX "audio/"
+#define GST_TEXT_CAPS_TYPE_PREFIX "text/"
+
+GstPad* webkitGstGhostPadFromStaticTemplate(GstStaticPadTemplate*, const gchar* name, GstPad* target);
+#if ENABLE(VIDEO)
+bool getVideoSizeAndFormatFromCaps(GstCaps*, WebCore::IntSize&, GstVideoFormat&, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride);
+std::optional<FloatSize> getVideoResolutionFromCaps(const GstCaps*);
+bool getSampleVideoInfo(GstSample*, GstVideoInfo&);
+#endif
+GstBuffer* createGstBuffer(GstBuffer*);
+GstBuffer* createGstBufferForData(const char* data, int length);
+char* getGstBufferDataPointer(GstBuffer*);
+const char* capsMediaType(const GstCaps*);
+bool doCapsHaveType(const GstCaps*, const char*);
+bool areEncryptedCaps(const GstCaps*);
+void mapGstBuffer(GstBuffer*, uint32_t);
+void unmapGstBuffer(GstBuffer*);
+Vector<String> extractGStreamerOptionsFromCommandLine();
+bool initializeGStreamer(std::optional<Vector<String>>&& = std::nullopt);
+unsigned getGstPlayFlag(const char* nick);
+uint64_t toGstUnsigned64Time(const MediaTime&);
+
+inline GstClockTime toGstClockTime(const MediaTime &mediaTime)
+{
+ return static_cast<GstClockTime>(toGstUnsigned64Time(mediaTime));
+}
+
+bool gstRegistryHasElementForMediaType(GList* elementFactories, const char* capsString);
+}
+
+#ifndef GST_BUFFER_DTS_OR_PTS
+#define GST_BUFFER_DTS_OR_PTS(buffer) (GST_BUFFER_DTS_IS_VALID(buffer) ? GST_BUFFER_DTS(buffer) : GST_BUFFER_PTS(buffer))
+#endif
+#endif // USE(GSTREAMER)
Deleted: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -1,326 +0,0 @@
-/*
- * Copyright (C) 2012, 2015, 2016 Igalia S.L
- * Copyright (C) 2015, 2016 Metrological Group B.V.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "config.h"
-
-#if USE(GSTREAMER)
-#include "GStreamerUtilities.h"
-
-#include "GRefPtrGStreamer.h"
-#include "GstAllocatorFastMalloc.h"
-#include "IntSize.h"
-#include <gst/audio/audio-info.h>
-#include <gst/gst.h>
-#include <mutex>
-#include <wtf/glib/GLibUtilities.h>
-#include <wtf/glib/GUniquePtr.h>
-
-#if ENABLE(VIDEO_TRACK) && USE(GSTREAMER_MPEGTS)
-#define GST_USE_UNSTABLE_API
-#include <gst/mpegts/mpegts.h>
-#undef GST_USE_UNSTABLE_API
-#endif
-
-namespace WebCore {
-
-const char* webkitGstMapInfoQuarkString = "webkit-gst-map-info";
-
-GstPad* webkitGstGhostPadFromStaticTemplate(GstStaticPadTemplate* staticPadTemplate, const gchar* name, GstPad* target)
-{
- GstPad* pad;
- GstPadTemplate* padTemplate = gst_static_pad_template_get(staticPadTemplate);
-
- if (target)
- pad = gst_ghost_pad_new_from_template(name, target, padTemplate);
- else
- pad = gst_ghost_pad_new_no_target_from_template(name, padTemplate);
-
- gst_object_unref(padTemplate);
-
- return pad;
-}
-
-#if ENABLE(VIDEO)
-bool getVideoSizeAndFormatFromCaps(GstCaps* caps, WebCore::IntSize& size, GstVideoFormat& format, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride)
-{
- if (!doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) {
- GST_WARNING("Failed to get the video size and format, these are not a video caps");
- return false;
- }
-
- if (areEncryptedCaps(caps)) {
- GstStructure* structure = gst_caps_get_structure(caps, 0);
- format = GST_VIDEO_FORMAT_ENCODED;
- stride = 0;
- int width = 0, height = 0;
- gst_structure_get_int(structure, "width", &width);
- gst_structure_get_int(structure, "height", &height);
- if (!gst_structure_get_fraction(structure, "pixel-aspect-ratio", &pixelAspectRatioNumerator, &pixelAspectRatioDenominator)) {
- pixelAspectRatioNumerator = 1;
- pixelAspectRatioDenominator = 1;
- }
-
- size.setWidth(width);
- size.setHeight(height);
- } else {
- GstVideoInfo info;
- gst_video_info_init(&info);
- if (!gst_video_info_from_caps(&info, caps))
- return false;
-
- format = GST_VIDEO_INFO_FORMAT(&info);
- size.setWidth(GST_VIDEO_INFO_WIDTH(&info));
- size.setHeight(GST_VIDEO_INFO_HEIGHT(&info));
- pixelAspectRatioNumerator = GST_VIDEO_INFO_PAR_N(&info);
- pixelAspectRatioDenominator = GST_VIDEO_INFO_PAR_D(&info);
- stride = GST_VIDEO_INFO_PLANE_STRIDE(&info, 0);
- }
-
- return true;
-}
-
-std::optional<FloatSize> getVideoResolutionFromCaps(const GstCaps* caps)
-{
- if (!doCapsHaveType(caps, GST_VIDEO_CAPS_TYPE_PREFIX)) {
- GST_WARNING("Failed to get the video resolution, these are not a video caps");
- return std::nullopt;
- }
-
- int width = 0, height = 0;
- int pixelAspectRatioNumerator = 1, pixelAspectRatioDenominator = 1;
-
- if (areEncryptedCaps(caps)) {
- GstStructure* structure = gst_caps_get_structure(caps, 0);
- gst_structure_get_int(structure, "width", &width);
- gst_structure_get_int(structure, "height", &height);
- gst_structure_get_fraction(structure, "pixel-aspect-ratio", &pixelAspectRatioNumerator, &pixelAspectRatioDenominator);
- } else {
- GstVideoInfo info;
- gst_video_info_init(&info);
- if (!gst_video_info_from_caps(&info, caps))
- return std::nullopt;
-
- width = GST_VIDEO_INFO_WIDTH(&info);
- height = GST_VIDEO_INFO_HEIGHT(&info);
- pixelAspectRatioNumerator = GST_VIDEO_INFO_PAR_N(&info);
- pixelAspectRatioDenominator = GST_VIDEO_INFO_PAR_D(&info);
- }
-
- return std::make_optional(FloatSize(width, height * (static_cast<float>(pixelAspectRatioNumerator) / static_cast<float>(pixelAspectRatioDenominator))));
-}
-
-bool getSampleVideoInfo(GstSample* sample, GstVideoInfo& videoInfo)
-{
- if (!GST_IS_SAMPLE(sample))
- return false;
-
- GstCaps* caps = gst_sample_get_caps(sample);
- if (!caps)
- return false;
-
- gst_video_info_init(&videoInfo);
- if (!gst_video_info_from_caps(&videoInfo, caps))
- return false;
-
- return true;
-}
-#endif
-
-GstBuffer* createGstBuffer(GstBuffer* buffer)
-{
- gsize bufferSize = gst_buffer_get_size(buffer);
- GstBuffer* newBuffer = gst_buffer_new_and_alloc(bufferSize);
-
- if (!newBuffer)
- return 0;
-
- gst_buffer_copy_into(newBuffer, buffer, static_cast<GstBufferCopyFlags>(GST_BUFFER_COPY_METADATA), 0, bufferSize);
- return newBuffer;
-}
-
-GstBuffer* createGstBufferForData(const char* data, int length)
-{
- GstBuffer* buffer = gst_buffer_new_and_alloc(length);
-
- gst_buffer_fill(buffer, 0, data, length);
-
- return buffer;
-}
-
-const char* capsMediaType(const GstCaps* caps)
-{
- ASSERT(caps);
- GstStructure* structure = gst_caps_get_structure(caps, 0);
- if (!structure) {
- GST_WARNING("caps are empty");
- return nullptr;
- }
-#if ENABLE(ENCRYPTED_MEDIA)
- if (gst_structure_has_name(structure, "application/x-cenc"))
- return gst_structure_get_string(structure, "original-media-type");
-#endif
- return gst_structure_get_name(structure);
-}
-
-bool doCapsHaveType(const GstCaps* caps, const char* type)
-{
- const char* mediaType = capsMediaType(caps);
- if (!mediaType) {
- GST_WARNING("Failed to get MediaType");
- return false;
- }
- return g_str_has_prefix(mediaType, type);
-}
-
-bool areEncryptedCaps(const GstCaps* caps)
-{
- ASSERT(caps);
-#if ENABLE(ENCRYPTED_MEDIA)
- GstStructure* structure = gst_caps_get_structure(caps, 0);
- if (!structure) {
- GST_WARNING("caps are empty");
- return false;
- }
- return gst_structure_has_name(structure, "application/x-cenc");
-#else
- UNUSED_PARAM(caps);
- return false;
-#endif
-}
-
-char* getGstBufferDataPointer(GstBuffer* buffer)
-{
- GstMiniObject* miniObject = reinterpret_cast<GstMiniObject*>(buffer);
- GstMapInfo* mapInfo = static_cast<GstMapInfo*>(gst_mini_object_get_qdata(miniObject, g_quark_from_static_string(webkitGstMapInfoQuarkString)));
- return reinterpret_cast<char*>(mapInfo->data);
-}
-
-void mapGstBuffer(GstBuffer* buffer, uint32_t flags)
-{
- GstMapInfo* mapInfo = static_cast<GstMapInfo*>(fastMalloc(sizeof(GstMapInfo)));
- if (!gst_buffer_map(buffer, mapInfo, static_cast<GstMapFlags>(flags))) {
- fastFree(mapInfo);
- gst_buffer_unref(buffer);
- return;
- }
-
- GstMiniObject* miniObject = reinterpret_cast<GstMiniObject*>(buffer);
- gst_mini_object_set_qdata(miniObject, g_quark_from_static_string(webkitGstMapInfoQuarkString), mapInfo, nullptr);
-}
-
-void unmapGstBuffer(GstBuffer* buffer)
-{
- GstMiniObject* miniObject = reinterpret_cast<GstMiniObject*>(buffer);
- GstMapInfo* mapInfo = static_cast<GstMapInfo*>(gst_mini_object_steal_qdata(miniObject, g_quark_from_static_string(webkitGstMapInfoQuarkString)));
-
- if (!mapInfo)
- return;
-
- gst_buffer_unmap(buffer, mapInfo);
- fastFree(mapInfo);
-}
-
-Vector<String> extractGStreamerOptionsFromCommandLine()
-{
- GUniqueOutPtr<char> contents;
- gsize length;
- if (!g_file_get_contents("/proc/self/cmdline", &contents.outPtr(), &length, nullptr))
- return { };
-
- Vector<String> options;
- auto optionsString = String::fromUTF8(contents.get(), length);
- optionsString.split('\0', false, [&options](StringView item) {
- if (item.startsWith("--gst"))
- options.append(item.toString());
- });
- return options;
-}
-
-bool initializeGStreamer(std::optional<Vector<String>>&& options)
-{
- static std::once_flag onceFlag;
- static bool isGStreamerInitialized;
- std::call_once(onceFlag, [options = WTFMove(options)] {
- isGStreamerInitialized = false;
-
-#if ENABLE(VIDEO) || ENABLE(WEB_AUDIO)
- Vector<String> parameters = options.value_or(extractGStreamerOptionsFromCommandLine());
- char** argv = g_new0(char*, parameters.size() + 2);
- int argc = parameters.size() + 1;
- argv[0] = g_strdup(getCurrentExecutableName().data());
- for (unsigned i = 0; i < parameters.size(); i++)
- argv[i + 1] = g_strdup(parameters[i].utf8().data());
-
- GUniqueOutPtr<GError> error;
- isGStreamerInitialized = gst_init_check(&argc, &argv, &error.outPtr());
- ASSERT_WITH_MESSAGE(isGStreamerInitialized, "GStreamer initialization failed: %s", error ? error->message : "unknown error occurred");
- g_strfreev(argv);
-
- if (isFastMallocEnabled()) {
- const char* disableFastMalloc = getenv("WEBKIT_GST_DISABLE_FAST_MALLOC");
- if (!disableFastMalloc || !strcmp(disableFastMalloc, "0"))
- gst_allocator_set_default(GST_ALLOCATOR(g_object_new(gst_allocator_fast_malloc_get_type(), nullptr)));
- }
-
-#if ENABLE(VIDEO_TRACK) && USE(GSTREAMER_MPEGTS)
- if (isGStreamerInitialized)
- gst_mpegts_initialize();
-#endif
-#endif
- });
- return isGStreamerInitialized;
-}
-
-unsigned getGstPlayFlag(const char* nick)
-{
- static GFlagsClass* flagsClass = static_cast<GFlagsClass*>(g_type_class_ref(g_type_from_name("GstPlayFlags")));
- ASSERT(flagsClass);
-
- GFlagsValue* flag = g_flags_get_value_by_nick(flagsClass, nick);
- if (!flag)
- return 0;
-
- return flag->value;
-}
-
-// Convert a MediaTime in seconds to a GstClockTime. Note that we can get MediaTime objects with a time scale that isn't a GST_SECOND, since they can come to
-// us through the internal testing API, the DOM and internally. It would be nice to assert the format of the incoming time, but all the media APIs assume time
-// is passed around in fractional seconds, so we'll just have to assume the same.
-uint64_t toGstUnsigned64Time(const MediaTime& mediaTime)
-{
- MediaTime time = mediaTime.toTimeScale(GST_SECOND);
- if (time.isInvalid())
- return GST_CLOCK_TIME_NONE;
- return time.timeValue();
-}
-
-bool gstRegistryHasElementForMediaType(GList* elementFactories, const char* capsString)
-{
- GRefPtr<GstCaps> caps = adoptGRef(gst_caps_from_string(capsString));
- GList* candidates = gst_element_factory_list_filter(elementFactories, caps.get(), GST_PAD_SINK, false);
- bool result = candidates;
-
- gst_plugin_feature_list_free(candidates);
- return result;
-}
-
-}
-
-#endif // USE(GSTREAMER)
Deleted: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2012, 2015, 2016 Igalia S.L
- * Copyright (C) 2015, 2016 Metrological Group B.V.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#pragma once
-
-
-#if USE(GSTREAMER)
-#include "FloatSize.h"
-#include <gst/gst.h>
-#include <gst/video/video-format.h>
-#include <gst/video/video-info.h>
-#include <wtf/MediaTime.h>
-
-namespace WebCore {
-
-class IntSize;
-
-inline bool webkitGstCheckVersion(guint major, guint minor, guint micro)
-{
- guint currentMajor, currentMinor, currentMicro, currentNano;
- gst_version(¤tMajor, ¤tMinor, ¤tMicro, ¤tNano);
-
- if (currentMajor < major)
- return false;
- if (currentMajor > major)
- return true;
-
- if (currentMinor < minor)
- return false;
- if (currentMinor > minor)
- return true;
-
- if (currentMicro < micro)
- return false;
-
- return true;
-}
-
-#define GST_VIDEO_CAPS_TYPE_PREFIX "video/"
-#define GST_AUDIO_CAPS_TYPE_PREFIX "audio/"
-#define GST_TEXT_CAPS_TYPE_PREFIX "text/"
-
-GstPad* webkitGstGhostPadFromStaticTemplate(GstStaticPadTemplate*, const gchar* name, GstPad* target);
-#if ENABLE(VIDEO)
-bool getVideoSizeAndFormatFromCaps(GstCaps*, WebCore::IntSize&, GstVideoFormat&, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride);
-std::optional<FloatSize> getVideoResolutionFromCaps(const GstCaps*);
-bool getSampleVideoInfo(GstSample*, GstVideoInfo&);
-#endif
-GstBuffer* createGstBuffer(GstBuffer*);
-GstBuffer* createGstBufferForData(const char* data, int length);
-char* getGstBufferDataPointer(GstBuffer*);
-const char* capsMediaType(const GstCaps*);
-bool doCapsHaveType(const GstCaps*, const char*);
-bool areEncryptedCaps(const GstCaps*);
-void mapGstBuffer(GstBuffer*, uint32_t);
-void unmapGstBuffer(GstBuffer*);
-Vector<String> extractGStreamerOptionsFromCommandLine();
-bool initializeGStreamer(std::optional<Vector<String>>&& = std::nullopt);
-unsigned getGstPlayFlag(const char* nick);
-uint64_t toGstUnsigned64Time(const MediaTime&);
-
-inline GstClockTime toGstClockTime(const MediaTime &mediaTime)
-{
- return static_cast<GstClockTime>(toGstUnsigned64Time(mediaTime));
-}
-
-bool gstRegistryHasElementForMediaType(GList* elementFactories, const char* capsString);
-}
-
-#ifndef GST_BUFFER_DTS_OR_PTS
-#define GST_BUFFER_DTS_OR_PTS(buffer) (GST_BUFFER_DTS_IS_VALID(buffer) ? GST_BUFFER_DTS(buffer) : GST_BUFFER_PTS(buffer))
-#endif
-#endif // USE(GSTREAMER)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -24,7 +24,7 @@
#include "BitmapImage.h"
#include "FloatRect.h"
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include <gst/gst.h>
#include <gst/video/video-frame.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -22,7 +22,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER)
-#include "GStreamerUtilities.h"
+#include "GStreamerCommon.h"
#include <cairo.h>
#include <gst/gst.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -29,7 +29,7 @@
#include "InbandTextTrackPrivateGStreamer.h"
-#include "GStreamerUtilities.h"
+#include "GStreamerCommon.h"
#include "Logging.h"
#include <glib-object.h>
#include <gst/gst.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -27,7 +27,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK)
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "InbandTextTrackPrivate.h"
#include "TrackPrivateBaseGStreamer.h"
#include <gst/gst.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -29,7 +29,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER)
#include "FileSystem.h"
-#include "GStreamerUtilities.h"
+#include "GStreamerCommon.h"
#include "HTTPHeaderNames.h"
#include "MIMETypeRegistry.h"
#include "MediaPlayer.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -26,7 +26,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER)
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "MediaPlayerPrivateGStreamerBase.h"
#include <glib.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -27,7 +27,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER)
-#include "GStreamerUtilities.h"
+#include "GStreamerCommon.h"
#include "GraphicsContext.h"
#include "ImageGStreamer.h"
#include "ImageOrientation.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -25,7 +25,7 @@
#define MediaPlayerPrivateGStreamerBase_h
#if ENABLE(VIDEO) && USE(GSTREAMER)
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "MainThreadNotifier.h"
#include "MediaPlayerPrivate.h"
#include "PlatformLayer.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -21,7 +21,7 @@
#include "config.h"
#include "MediaSampleGStreamer.h"
-#include "GStreamerUtilities.h"
+#include "GStreamerCommon.h"
#if ENABLE(VIDEO) && USE(GSTREAMER)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -23,7 +23,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER)
#include "FloatSize.h"
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "MediaSample.h"
#include <wtf/text/AtomicString.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -28,7 +28,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK)
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
static GstStaticPadTemplate sinkTemplate =
GST_STATIC_PAD_TEMPLATE("sink_%u", GST_PAD_SINK, GST_PAD_REQUEST,
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -29,7 +29,7 @@
#include "TrackPrivateBaseGStreamer.h"
-#include "GStreamerUtilities.h"
+#include "GStreamerCommon.h"
#include "Logging.h"
#include "TrackPrivateBase.h"
#include <glib-object.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -27,7 +27,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK)
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "MainThreadNotifier.h"
#include <gst/gst.h>
#include <wtf/Lock.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -30,8 +30,7 @@
#include "VideoSinkGStreamer.h"
#if ENABLE(VIDEO) && USE(GSTREAMER)
-#include "GRefPtrGStreamer.h"
-#include "GStreamerUtilities.h"
+#include "GStreamerCommon.h"
#include "IntSize.h"
#include <glib.h>
#include <gst/gst.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -27,7 +27,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK)
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "TrackPrivateBaseGStreamer.h"
#include "VideoTrackPrivate.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -22,9 +22,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER)
-#include "GRefPtrGStreamer.h"
-#include "GStreamerUtilities.h"
-#include "GUniquePtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "HTTPHeaderNames.h"
#include "MainThreadNotifier.h"
#include "MediaPlayer.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -22,8 +22,6 @@
#include "config.h"
#include "GStreamerEMEUtilities.h"
-#include "GRefPtrGStreamer.h"
-
#if ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
GST_DEBUG_CATEGORY_EXTERN(webkit_media_player_debug);
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -23,6 +23,7 @@
#if ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
+#include "GStreamerCommon.h"
#include <gst/gst.h>
#include <wtf/text/WTFString.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -24,7 +24,6 @@
#if ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
-#include "GRefPtrGStreamer.h"
#include "GStreamerEMEUtilities.h"
#include <gcrypt.h>
#include <gst/base/gstbytereader.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -25,8 +25,7 @@
#if ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
-#include "GRefPtrGStreamer.h"
-#include "GUniquePtrGStreamer.h"
+#include "GStreamerCommon.h"
#include <wtf/Condition.h>
#include <wtf/RunLoop.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -24,10 +24,9 @@
#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE)
#include "AudioTrackPrivateGStreamer.h"
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "GStreamerEMEUtilities.h"
#include "GStreamerMediaDescription.h"
-#include "GStreamerUtilities.h"
#include "MediaSampleGStreamer.h"
#include "InbandTextTrackPrivateGStreamer.h"
#include "MediaDescription.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -22,8 +22,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE)
-#include "GRefPtrGStreamer.h"
-#include "GUniquePtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "MediaPlayerPrivateGStreamerMSE.h"
#include "MediaSourceClientGStreamerMSE.h"
#include "SourceBufferPrivateGStreamer.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -20,8 +20,7 @@
#include "config.h"
#include "GStreamerMediaDescription.h"
-#include "GStreamerUtilities.h"
-#include "GUniquePtrGStreamer.h"
+#include "GStreamerCommon.h"
#include <gst/pbutils/pbutils.h>
#include <wtf/text/AtomicString.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaDescription.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaDescription.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaDescription.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -22,7 +22,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE)
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "MediaDescription.h"
#include <gst/gst.h>
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -30,7 +30,7 @@
#include "AppendPipeline.h"
#include "AudioTrackPrivateGStreamer.h"
-#include "GStreamerUtilities.h"
+#include "GStreamerCommon.h"
#include "InbandTextTrackPrivateGStreamer.h"
#include "MIMETypeRegistry.h"
#include "MediaDescription.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -26,7 +26,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE)
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "MediaPlayerPrivateGStreamer.h"
#include "MediaSample.h"
#include "MediaSourceGStreamer.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -22,7 +22,7 @@
#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE)
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "MediaSourcePrivate.h"
#include "MediaSourcePrivateClient.h"
#include "WebKitMediaSourceGStreamer.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -25,9 +25,8 @@
#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE)
#include "AudioTrackPrivateGStreamer.h"
+#include "GStreamerCommon.h"
#include "MediaSampleGStreamer.h"
-#include "GStreamerUtilities.h"
-#include "GUniquePtrGStreamer.h"
#include "MediaSample.h"
#include "SourceBufferPrivateGStreamer.h"
#include "VideoTrackPrivateGStreamer.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -38,7 +38,7 @@
#if ENABLE(MEDIA_SOURCE) && USE(GSTREAMER)
#include "ContentType.h"
-#include "GStreamerUtilities.h"
+#include "GStreamerCommon.h"
#include "MediaPlayerPrivateGStreamerMSE.h"
#include "MediaSample.h"
#include "MediaSourceClientGStreamerMSE.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -29,7 +29,7 @@
#if ENABLE(VIDEO) && ENABLE(MEDIA_SOURCE) && USE(GSTREAMER)
#include "AudioTrackPrivateGStreamer.h"
-#include "GStreamerUtilities.h"
+#include "GStreamerCommon.h"
#include "MediaDescription.h"
#include "MediaPlayerPrivateGStreamerMSE.h"
#include "MediaSample.h"
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h (230624 => 230625)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h 2018-04-13 08:50:42 UTC (rev 230625)
@@ -25,7 +25,7 @@
#if ENABLE(VIDEO) && ENABLE(MEDIA_SOURCE) && USE(GSTREAMER)
-#include "GRefPtrGStreamer.h"
+#include "GStreamerCommon.h"
#include "MediaPlayer.h"
#include "MediaSource.h"
#include "MediaSourcePrivate.h"
Modified: trunk/Source/WebKit/ChangeLog (230624 => 230625)
--- trunk/Source/WebKit/ChangeLog 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebKit/ChangeLog 2018-04-13 08:50:42 UTC (rev 230625)
@@ -1,3 +1,20 @@
+2018-04-13 Xabier Rodriguez Calvar <calva...@igalia.com>
+
+ [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
+ https://bugs.webkit.org/show_bug.cgi?id=184533
+
+ Reviewed by Philippe Normand.
+
+ Renamed GStreamerUtilities* files into GStreamerCommon* and
+ modified files including them accordingly. Include
+ GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
+ to avoid problems destroying objects when those files are
+ forgotten to be included.
+
+ * UIProcess/gtk/WebProcessPoolGtk.cpp:
+ * UIProcess/wpe/WebProcessPoolWPE.cpp:
+ * WebProcess/soup/WebProcessSoup.cpp:
+
2018-04-12 Beth Dakin <bda...@apple.com>
Fix the MOBILE_WIFI build
Modified: trunk/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp (230624 => 230625)
--- trunk/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -35,7 +35,7 @@
#include "WebProcessMessages.h"
#include <_javascript_Core/RemoteInspectorServer.h>
#include <WebCore/FileSystem.h>
-#include <WebCore/GStreamerUtilities.h>
+#include <WebCore/GStreamerCommon.h>
#include <WebCore/NotImplemented.h>
#include <WebCore/SchemeRegistry.h>
#include <wtf/glib/GUniquePtr.h>
Modified: trunk/Source/WebKit/UIProcess/wpe/WebProcessPoolWPE.cpp (230624 => 230625)
--- trunk/Source/WebKit/UIProcess/wpe/WebProcessPoolWPE.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebKit/UIProcess/wpe/WebProcessPoolWPE.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -36,7 +36,7 @@
#include "WebProcessMessages.h"
#include <_javascript_Core/RemoteInspectorServer.h>
#include <WebCore/FileSystem.h>
-#include <WebCore/GStreamerUtilities.h>
+#include <WebCore/GStreamerCommon.h>
#include <WebCore/NotImplemented.h>
#include <WebCore/SchemeRegistry.h>
#include <cstdlib>
Modified: trunk/Source/WebKit/WebProcess/soup/WebProcessSoup.cpp (230624 => 230625)
--- trunk/Source/WebKit/WebProcess/soup/WebProcessSoup.cpp 2018-04-13 07:26:59 UTC (rev 230624)
+++ trunk/Source/WebKit/WebProcess/soup/WebProcessSoup.cpp 2018-04-13 08:50:42 UTC (rev 230625)
@@ -28,7 +28,7 @@
#include "WebProcess.h"
#include "WebProcessCreationParameters.h"
-#include <WebCore/GStreamerUtilities.h>
+#include <WebCore/GStreamerCommon.h>
#include <WebCore/MemoryCache.h>
#include <WebCore/NetworkStorageSession.h>
#include <WebCore/SoupNetworkSession.h>