Changeset 114269 in webkit


Ignore:
Timestamp:
Apr 16, 2012 10:14:12 AM (12 years ago)
Author:
Philippe Normand
Message:

[GStreamer] HRTFDatabaseLoader conflicts with AudioFileReader
https://bugs.webkit.org/show_bug.cgi?id=78095

Reviewed by Martin Robinson.

Moved the GStreamer initialization logic to a new
GStreamerUtilities module, used by the MediaPlayer and the
AudioContext. I also removed the static variables as
gst_init_check already handles cases where it's called multiple
times.

  • GNUmakefile.list.am:
  • Modules/webaudio/AudioContext.cpp:

(WebCore::AudioContext::constructCommon):

  • platform/audio/gstreamer/AudioDestinationGStreamer.cpp:

(WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):

  • platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:

(WebCore::AudioFileReader::createBus):

  • platform/graphics/gstreamer/GRefPtrGStreamer.cpp:

(WTF::adoptGRef):
(WTF):
(WTF::GstElementFactory):

  • platform/graphics/gstreamer/GRefPtrGStreamer.h:

(WTF):

  • platform/graphics/gstreamer/GStreamerUtilities.cpp: Added.

(WebCore):
(WebCore::initializeGStreamer):

  • platform/graphics/gstreamer/GStreamerUtilities.h: Added.

(WebCore):

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:

(WebCore::doGstInit):

Location:
trunk/Source/WebCore
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r114268 r114269  
     12012-04-11  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] HRTFDatabaseLoader conflicts with AudioFileReader
     4        https://bugs.webkit.org/show_bug.cgi?id=78095
     5
     6        Reviewed by Martin Robinson.
     7
     8        Moved the GStreamer initialization logic to a new
     9        GStreamerUtilities module, used by the MediaPlayer and the
     10        AudioContext. I also removed the static variables as
     11        gst_init_check already handles cases where it's called multiple
     12        times.
     13
     14        * GNUmakefile.list.am:
     15        * Modules/webaudio/AudioContext.cpp:
     16        (WebCore::AudioContext::constructCommon):
     17        * platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
     18        (WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):
     19        * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
     20        (WebCore::AudioFileReader::createBus):
     21        * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
     22        (WTF::adoptGRef):
     23        (WTF):
     24        (WTF::GstElementFactory):
     25        * platform/graphics/gstreamer/GRefPtrGStreamer.h:
     26        (WTF):
     27        * platform/graphics/gstreamer/GStreamerUtilities.cpp: Added.
     28        (WebCore):
     29        (WebCore::initializeGStreamer):
     30        * platform/graphics/gstreamer/GStreamerUtilities.h: Added.
     31        (WebCore):
     32        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
     33        (WebCore::doGstInit):
     34
    1352012-04-16  ChangSeok Oh  <shivamidow@gmail.com>
    236
  • trunk/Source/WebCore/GNUmakefile.list.am

    r114220 r114269  
    46384638        Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp \
    46394639        Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h \
    4640         Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp \
    4641         Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h \
    46424640        Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp \
    46434641        Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h \
    4644         Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp \
    4645         Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h \
    46464642        Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp \
    46474643        Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h \
     
    56745670endif
    56755671
     5672if USE_GSTREAMER
     5673webcore_sources += \
     5674        Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp \
     5675        Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h \
     5676        Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp \
     5677        Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h \
     5678        Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp \
     5679        Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h
     5680endif
    56765681
    56775682# ----
  • trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp

    r114193 r114269  
    6969#endif
    7070
     71#if USE(GSTREAMER)
     72#include "GStreamerUtilities.h"
     73#endif
     74
    7175#include <wtf/ArrayBuffer.h>
    7276#include <wtf/Atomics.h>
     
    179183void AudioContext::constructCommon()
    180184{
     185#if USE(GSTREAMER)
     186    initializeGStreamer();
     187#endif
     188
    181189    FFTFrame::initialize();
    182190   
  • trunk/Source/WebCore/PlatformEfl.cmake

    r114113 r114269  
    189189    platform/graphics/gstreamer/GRefPtrGStreamer.cpp
    190190    platform/graphics/gstreamer/GStreamerGWorld.cpp
     191    platform/graphics/gstreamer/GStreamerUtilities.cpp
    191192    platform/graphics/gstreamer/GStreamerVersioning.cpp
    192193    platform/graphics/gstreamer/ImageGStreamerCairo.cpp
  • trunk/Source/WebCore/Target.pri

    r114220 r114269  
    32693269            platform/graphics/gstreamer/GRefPtrGStreamer.h \
    32703270            platform/graphics/gstreamer/GStreamerGWorld.h \
     3271            platform/graphics/gstreamer/GStreamerUtilities.h \
    32713272            platform/graphics/gstreamer/GStreamerVersioning.h \
    32723273            platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h \
     
    32793280            platform/graphics/gstreamer/GRefPtrGStreamer.cpp \
    32803281            platform/graphics/gstreamer/GStreamerGWorld.cpp \
     3282            platform/graphics/gstreamer/GStreamerUtilities.cpp \
    32813283            platform/graphics/gstreamer/GStreamerVersioning.cpp \
    32823284            platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp \
  • trunk/Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.cpp

    r111354 r114269  
    5858    , m_isPlaying(false)
    5959{
    60     static bool gstInitialized = false;
    61     if (!gstInitialized)
    62         gstInitialized = gst_init_check(0, 0, 0);
    63     ASSERT_WITH_MESSAGE(gstInitialized, "GStreamer initialization failed");
    64 
    6560    m_pipeline = gst_pipeline_new("play");
    6661
  • trunk/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp

    r112646 r114269  
    325325    m_sampleRate = sampleRate;
    326326
    327     static bool gstInitialized = false;
    328     if (!gstInitialized)
    329         gstInitialized = gst_init_check(0, 0, 0);
    330 
    331     if (!gstInitialized)
    332         return nullptr;
    333 
    334327    m_frontLeftBuffers = gst_buffer_list_new();
    335328    m_frontLeftBuffersIterator = gst_buffer_list_iterate(m_frontLeftBuffers);
  • trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp

    r111119 r114269  
    141141}
    142142
     143template <> GRefPtr<GstElementFactory> adoptGRef(GstElementFactory* ptr)
     144{
     145    ASSERT(!GST_OBJECT_IS_FLOATING(GST_OBJECT(ptr)));
     146    return GRefPtr<GstElementFactory>(ptr, GRefPtrAdopt);
     147}
     148
     149template <> GstElementFactory* refGPtr<GstElementFactory>(GstElementFactory* ptr)
     150{
     151    if (ptr)
     152        webkitGstObjectRefSink(GST_OBJECT(ptr));
     153
     154    return ptr;
     155}
     156
     157template <> void derefGPtr<GstElementFactory>(GstElementFactory* ptr)
     158{
     159    if (ptr)
     160        gst_object_unref(ptr);
     161}
     162
    143163}
    144164#endif // USE(GSTREAMER)
  • trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h

    r111354 r114269  
    3030typedef struct _GstTask GstTask;
    3131typedef struct _GstBus GstBus;
     32typedef struct _GstElementFactory GstElementFactory;
    3233
    3334namespace WTF {
     
    5657template<> void derefGPtr<GstBus>(GstBus* ptr);
    5758
     59template<> GRefPtr<GstElementFactory> adoptGRef(GstElementFactory* ptr);
     60template<> GstElementFactory* refGPtr<GstElementFactory>(GstElementFactory* ptr);
     61template<> void derefGPtr<GstElementFactory>(GstElementFactory* ptr);
     62
    5863}
    5964
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r113849 r114269  
    3232#include "FrameView.h"
    3333#include "GStreamerGWorld.h"
     34#include "GStreamerUtilities.h"
    3435#include "GStreamerVersioning.h"
    3536#include "GraphicsContext.h"
     
    176177}
    177178
    178 static bool gstInitialized = false;
    179 
    180 static bool doGstInit()
    181 {
    182     // FIXME: We should pass the arguments from the command line
    183     if (!gstInitialized) {
    184         GOwnPtr<GError> error;
    185         gstInitialized = gst_init_check(0, 0, &error.outPtr());
    186         if (!gstInitialized)
    187             LOG_VERBOSE(Media, "Could not initialize GStreamer: %s",
    188                         error ? error->message : "unknown error occurred");
    189         else
    190             gst_element_register(0, "webkitwebsrc", GST_RANK_PRIMARY + 100,
    191                                  WEBKIT_TYPE_WEB_SRC);
    192     }
    193     return gstInitialized;
     179bool initializeGStreamerAndRegisterWebKitElements()
     180{
     181    if (!initializeGStreamer())
     182        return false;
     183
     184    GRefPtr<GstElementFactory> srcFactory = gst_element_factory_find("webkitwebsrc");
     185    if (!srcFactory)
     186        return gst_element_register(0, "webkitwebsrc", GST_RANK_PRIMARY + 100, WEBKIT_TYPE_WEB_SRC);
     187
     188    return true;
    194189}
    195190
    196191bool MediaPlayerPrivateGStreamer::isAvailable()
    197192{
    198     if (!doGstInit())
     193    if (!initializeGStreamerAndRegisterWebKitElements())
    199194        return false;
    200195
    201     GstElementFactory* factory = gst_element_factory_find(gPlaybinName);
    202     if (factory) {
    203         gst_object_unref(GST_OBJECT(factory));
    204         return true;
    205     }
    206     return false;
     196    GRefPtr<GstElementFactory> factory = gst_element_factory_find(gPlaybinName);
     197    return factory;
    207198}
    208199
     
    245236    , m_webkitAudioSink(0)
    246237{
    247     if (doGstInit())
     238    if (initializeGStreamerAndRegisterWebKitElements())
    248239        createGSTPlayBin();
    249240}
     
    15051496{
    15061497
    1507     doGstInit();
     1498    initializeGStreamerAndRegisterWebKitElements();
    15081499
    15091500    DEFINE_STATIC_LOCAL(HashSet<String>, cache, ());
Note: See TracChangeset for help on using the changeset viewer.