- Revision
- 246537
- Author
- ph...@webkit.org
- Date
- 2019-06-18 07:47:41 -0700 (Tue, 18 Jun 2019)
Log Message
[GStreamer] Identify elements with monotonically increasing counters
https://bugs.webkit.org/show_bug.cgi?id=198916
Reviewed by Xabier Rodriguez-Calvar.
Those ids tend to be shorter, easier to read for humans and for
diff tools :) Underscores were also replaced by dashes, for
consistency with the usual GStreamer element naming untold
conventions.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::load):
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
* platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
(WebCore::GStreamerVideoEncoder::makeElement):
(WebCore::GStreamerVideoEncoder::InitEncode):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (246536 => 246537)
--- trunk/Source/WebCore/ChangeLog 2019-06-18 10:52:05 UTC (rev 246536)
+++ trunk/Source/WebCore/ChangeLog 2019-06-18 14:47:41 UTC (rev 246537)
@@ -1,3 +1,22 @@
+2019-06-18 Philippe Normand <pnorm...@igalia.com>
+
+ [GStreamer] Identify elements with monotonically increasing counters
+ https://bugs.webkit.org/show_bug.cgi?id=198916
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ Those ids tend to be shorter, easier to read for humans and for
+ diff tools :) Underscores were also replaced by dashes, for
+ consistency with the usual GStreamer element naming untold
+ conventions.
+
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::MediaPlayerPrivateGStreamer::load):
+ (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
+ * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
+ (WebCore::GStreamerVideoEncoder::makeElement):
+ (WebCore::GStreamerVideoEncoder::InitEncode):
+
2019-06-18 Zan Dobersek <zdober...@igalia.com>
[WebGL] Extensions3DOpenGLES::bindVertexArrayOES() should allow zero array object
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (246536 => 246537)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2019-06-18 10:52:05 UTC (rev 246536)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2019-06-18 14:47:41 UTC (rev 246537)
@@ -43,7 +43,6 @@
#include <gst/pbutils/missing-plugins.h>
#include <limits>
#include <wtf/FileSystem.h>
-#include <wtf/HexNumber.h>
#include <wtf/MediaTime.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/StringPrintStream.h>
@@ -327,9 +326,10 @@
{
#if GST_CHECK_VERSION(1, 10, 0)
m_streamPrivate = &stream;
- auto pipelineName = makeString("mediastream_",
- (stream.hasCaptureVideoSource() || stream.hasCaptureAudioSource()) ? "Local" : "Remote",
- "_0x", hex(reinterpret_cast<uintptr_t>(this), Lowercase));
+ static Atomic<uint32_t> pipelineId;
+ auto pipelineName = makeString("mediastream-",
+ (stream.hasCaptureVideoSource() || stream.hasCaptureAudioSource()) ? "local" : "remote",
+ "-", pipelineId.exchangeAdd(1));
loadFull(String("mediastream://") + stream.id(), pipelineName);
syncOnClock(false);
@@ -2386,8 +2386,9 @@
// gst_element_factory_make() returns a floating reference so
// we should not adopt.
+ static Atomic<uint32_t> pipelineId;
setPipeline(gst_element_factory_make(playbinName,
- (pipelineName.isEmpty() ? makeString("play_0x", hex(reinterpret_cast<uintptr_t>(this), Lowercase)) : pipelineName).utf8().data()));
+ (pipelineName.isEmpty() ? makeString("media-player-", pipelineId.exchangeAdd(1)) : pipelineName).utf8().data()));
setStreamVolumeElement(GST_STREAM_VOLUME(m_pipeline.get()));
GST_INFO_OBJECT(pipeline(), "Using legacy playbin element: %s", boolForPrinting(m_isLegacyPlaybin));
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp (246536 => 246537)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp 2019-06-18 10:52:05 UTC (rev 246536)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp 2019-06-18 14:47:41 UTC (rev 246537)
@@ -41,10 +41,11 @@
#undef GST_USE_UNSTABLE_API
#include <gst/pbutils/encoding-profile.h>
#include <gst/video/video.h>
+#include <wtf/Atomics.h>
#include <wtf/HashMap.h>
-#include <wtf/HexNumber.h>
#include <wtf/Lock.h>
#include <wtf/StdMap.h>
+#include <wtf/text/StringConcatenateNumbers.h>
// Required for unified builds
#ifdef GST_CAT_DEFAULT
@@ -95,7 +96,8 @@
GstElement* makeElement(const gchar* factoryName)
{
- auto name = makeString(Name(), "_enc_", factoryName, "_0x", hex(reinterpret_cast<uintptr_t>(this)));
+ static Atomic<uint32_t> elementId;
+ auto name = makeString(Name(), "-enc-", factoryName, "-", elementId.exchangeAdd(1));
auto elem = gst_element_factory_make(factoryName, name.utf8().data());
return elem;
@@ -136,8 +138,7 @@
m_sink = makeElement("appsink");
g_object_set(m_sink, "sync", FALSE, nullptr);
- auto name = makeString(Name(), "_enc_rawcapsfilter_0x", hex(reinterpret_cast<uintptr_t>(this)));
- m_capsFilter = gst_element_factory_make("capsfilter", name.utf8().data());
+ m_capsFilter = makeElement("capsfilter");
if (m_restrictionCaps)
g_object_set(m_capsFilter, "caps", m_restrictionCaps.get(), nullptr);