Changeset 246537 in webkit


Ignore:
Timestamp:
Jun 18, 2019 7:47:41 AM (5 years ago)
Author:
Philippe Normand
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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246536 r246537  
     12019-06-18  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] Identify elements with monotonically increasing counters
     4        https://bugs.webkit.org/show_bug.cgi?id=198916
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        Those ids tend to be shorter, easier to read for humans and for
     9        diff tools :) Underscores were also replaced by dashes, for
     10        consistency with the usual GStreamer element naming untold
     11        conventions.
     12
     13        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
     14        (WebCore::MediaPlayerPrivateGStreamer::load):
     15        (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
     16        * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
     17        (WebCore::GStreamerVideoEncoder::makeElement):
     18        (WebCore::GStreamerVideoEncoder::InitEncode):
     19
    1202019-06-18  Zan Dobersek  <zdobersek@igalia.com>
    221
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r246490 r246537  
    4444#include <limits>
    4545#include <wtf/FileSystem.h>
    46 #include <wtf/HexNumber.h>
    4746#include <wtf/MediaTime.h>
    4847#include <wtf/NeverDestroyed.h>
     
    328327#if GST_CHECK_VERSION(1, 10, 0)
    329328    m_streamPrivate = &stream;
    330     auto pipelineName = makeString("mediastream_",
    331         (stream.hasCaptureVideoSource() || stream.hasCaptureAudioSource()) ? "Local" : "Remote",
    332         "_0x", hex(reinterpret_cast<uintptr_t>(this), Lowercase));
     329    static Atomic<uint32_t> pipelineId;
     330    auto pipelineName = makeString("mediastream-",
     331        (stream.hasCaptureVideoSource() || stream.hasCaptureAudioSource()) ? "local" : "remote",
     332        "-", pipelineId.exchangeAdd(1));
    333333
    334334    loadFull(String("mediastream://") + stream.id(), pipelineName);
     
    23872387    // gst_element_factory_make() returns a floating reference so
    23882388    // we should not adopt.
     2389    static Atomic<uint32_t> pipelineId;
    23892390    setPipeline(gst_element_factory_make(playbinName,
    2390         (pipelineName.isEmpty() ? makeString("play_0x", hex(reinterpret_cast<uintptr_t>(this), Lowercase)) : pipelineName).utf8().data()));
     2391        (pipelineName.isEmpty() ? makeString("media-player-", pipelineId.exchangeAdd(1)) : pipelineName).utf8().data()));
    23912392    setStreamVolumeElement(GST_STREAM_VOLUME(m_pipeline.get()));
    23922393
  • trunk/Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp

    r243196 r246537  
    4242#include <gst/pbutils/encoding-profile.h>
    4343#include <gst/video/video.h>
     44#include <wtf/Atomics.h>
    4445#include <wtf/HashMap.h>
    45 #include <wtf/HexNumber.h>
    4646#include <wtf/Lock.h>
    4747#include <wtf/StdMap.h>
     48#include <wtf/text/StringConcatenateNumbers.h>
    4849
    4950// Required for unified builds
     
    9697    GstElement* makeElement(const gchar* factoryName)
    9798    {
    98         auto name = makeString(Name(), "_enc_", factoryName, "_0x", hex(reinterpret_cast<uintptr_t>(this)));
     99        static Atomic<uint32_t> elementId;
     100        auto name = makeString(Name(), "-enc-", factoryName, "-", elementId.exchangeAdd(1));
    99101        auto elem = gst_element_factory_make(factoryName, name.utf8().data());
    100102
     
    137139        g_object_set(m_sink, "sync", FALSE, nullptr);
    138140
    139         auto name = makeString(Name(), "_enc_rawcapsfilter_0x", hex(reinterpret_cast<uintptr_t>(this)));
    140         m_capsFilter = gst_element_factory_make("capsfilter", name.utf8().data());
     141        m_capsFilter = makeElement("capsfilter");
    141142        if (m_restrictionCaps)
    142143            g_object_set(m_capsFilter, "caps", m_restrictionCaps.get(), nullptr);
Note: See TracChangeset for help on using the changeset viewer.