Changeset 181499 in webkit
- Timestamp:
- Mar 14, 2015 11:25:57 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r181496 r181499 1 2015-03-14 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> 2 3 [GStreamer] share GL context in pipeline 4 https://bugs.webkit.org/show_bug.cgi?id=142693 5 6 Reviewed by Philippe Normand. 7 8 Add search of gstreamer-gl library in the GStreamer installation. If 9 it is found, WTF_USE_GSTREAMER_GL macro is defined. 10 11 * Source/cmake/FindGStreamer.cmake: 12 * Source/cmake/OptionsGTK.cmake: 13 1 14 2015-03-13 Alex Christensen <achristensen@webkit.org> 2 15 -
trunk/Source/WebCore/ChangeLog
r181496 r181499 1 2015-03-14 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> 2 3 [GStreamer] share GL context in pipeline 4 https://bugs.webkit.org/show_bug.cgi?id=142693 5 6 Reviewed by Philippe Normand. 7 8 GstGL elements in a pipeline need to be aware of the application's 9 display and its GL context. This information is shared through context 10 messages between the pipeline and the browser. 11 12 This patch shares this context through a GStreamer's synchronous 13 message, using the GL information held in the web process. 14 15 This patch is based on the work of Philippe Normand for Bug 138562. 16 17 No new tests because this is platform specific and it depends in the 18 run-time availability and configurations of GstGL elements. 19 20 * PlatformGTK.cmake: appends the GstGL header files in the include 21 directories. Also its library directory is appended. 22 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: 23 (WebCore::mediaPlayerPrivateSyncMessageCallback): New callback function. 24 (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): 25 Initialize the new class attributes. 26 (WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage): New method 27 for handling synchronous messages from the pipeline. This method 28 currently only handles the GL context sharing. 29 (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Configures 30 the pipeline's bus to handle the synchronous messages. 31 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Add new 32 class methods and attributes. 33 1 34 2015-03-13 Alex Christensen <achristensen@webkit.org> 2 35 -
trunk/Source/WebCore/PlatformGTK.cmake
r181468 r181499 344 344 list(APPEND WebCore_LIBRARIES 345 345 ${GSTREAMER_MPEGTS_LIBRARIES} 346 ) 347 endif () 348 349 if (USE_GSTREAMER_GL) 350 list(APPEND WebCore_INCLUDE_DIRECTORIES 351 ${GSTREAMER_GL_INCLUDE_DIRS} 352 ) 353 354 list(APPEND WebCore_LIBRARIES 355 ${GSTREAMER_GL_LIBRARIES} 346 356 ) 347 357 endif () -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
r181274 r181499 69 69 #endif 70 70 71 #if USE(GSTREAMER_GL) 72 #include "GLContext.h" 73 74 #define GST_USE_UNSTABLE_API 75 #include <gst/gl/gl.h> 76 #undef GST_USE_UNSTABLE_API 77 78 #if USE(GLX) 79 #include "GLContextGLX.h" 80 #include <gst/gl/x11/gstgldisplay_x11.h> 81 #elif USE(EGL) 82 #include "GLContextEGL.h" 83 #include <gst/gl/egl/gstgldisplay_egl.h> 84 #endif 85 86 // gstglapi.h may include eglplatform.h and it includes X.h, which 87 // defines None, breaking MediaPlayer::None enum 88 #if PLATFORM(X11) && GST_GL_HAVE_PLATFORM_EGL 89 #undef None 90 #endif 91 #endif // USE(GSTREAMER_GL) 92 71 93 // Max interval in seconds to stay in the READY state on manual 72 94 // state change requests. … … 83 105 { 84 106 return player->handleMessage(message); 107 } 108 109 static gboolean mediaPlayerPrivateSyncMessageCallback(GstBus*, GstMessage* message, MediaPlayerPrivateGStreamer* player) 110 { 111 return player->handleSyncMessage(message); 85 112 } 86 113 … … 218 245 , m_requestedState(GST_STATE_VOID_PENDING) 219 246 , m_missingPlugins(false) 247 #if USE(GSTREAMER_GL) 248 , m_glContext(nullptr) 249 , m_glDisplay(nullptr) 250 #endif 220 251 { 221 252 } … … 903 934 904 935 return timeRanges; 936 } 937 938 gboolean MediaPlayerPrivateGStreamer::handleSyncMessage(GstMessage* message) 939 { 940 switch (GST_MESSAGE_TYPE(message)) { 941 #if USE(GSTREAMER_GL) 942 case GST_MESSAGE_NEED_CONTEXT: { 943 const gchar* contextType; 944 gst_message_parse_context_type(message, &contextType); 945 946 if (!m_glDisplay) { 947 #if PLATFORM(X11) 948 Display* display = GLContext::sharedX11Display(); 949 GstGLDisplayX11* gstGLDisplay = gst_gl_display_x11_new_with_display(display); 950 #elif PLATFORM(WAYLAND) 951 EGLDisplay display = WaylandDisplay::instance()->eglDisplay(); 952 GstGLDisplayEGL* gstGLDisplay = gst_gl_display_egl_new_with_egl_display(display); 953 #else 954 return FALSE; 955 #endif 956 957 m_glDisplay = reinterpret_cast<GstGLDisplay*>(gstGLDisplay); 958 GLContext* webkitContext = GLContext::sharingContext(); 959 #if USE(GLX) 960 GLXContext* glxSharingContext = reinterpret_cast<GLXContext*>(webkitContext->platformContext()); 961 if (glxSharingContext && !m_glContext) 962 m_glContext = gst_gl_context_new_wrapped(GST_GL_DISPLAY(gstGLDisplay), reinterpret_cast<guintptr>(glxSharingContext), GST_GL_PLATFORM_GLX, GST_GL_API_OPENGL); 963 #elif USE(EGL) 964 EGLContext* eglSharingContext = reinterpret_cast<EGLContext*>(webkitContext->platformContext()); 965 if (eglSharingContext && !m_glContext) 966 m_glContext = gst_gl_context_new_wrapped(GST_GL_DISPLAY(gstGLDisplay), reinterpret_cast<guintptr>(eglSharingContext), GST_GL_PLATFORM_EGL, GST_GL_API_GLES2); 967 #endif 968 } 969 970 if (!g_strcmp0(contextType, GST_GL_DISPLAY_CONTEXT_TYPE)) { 971 GstContext* displayContext = gst_context_new(GST_GL_DISPLAY_CONTEXT_TYPE, TRUE); 972 gst_context_set_gl_display(displayContext, m_glDisplay); 973 gst_element_set_context(GST_ELEMENT(message->src), displayContext); 974 return TRUE; 975 } 976 if (!g_strcmp0(contextType, "gst.gl.app_context")) { 977 GstContext* appContext = gst_context_new("gst.gl.app_context", TRUE); 978 GstStructure* structure = gst_context_writable_structure(appContext); 979 gst_structure_set(structure, "context", GST_GL_TYPE_CONTEXT, m_glContext, nullptr); 980 gst_element_set_context(GST_ELEMENT(message->src), appContext); 981 return TRUE; 982 } 983 break; 984 } 985 #endif // USE(GSTREAMER_GL) 986 default: 987 break; 988 } 989 return FALSE; 905 990 } 906 991 … … 1936 2021 gst_bus_add_signal_watch(bus.get()); 1937 2022 g_signal_connect(bus.get(), "message", G_CALLBACK(mediaPlayerPrivateMessageCallback), this); 2023 gst_bus_enable_sync_message_emission(bus.get()); 2024 g_signal_connect(bus.get(), "sync-message", G_CALLBACK(mediaPlayerPrivateSyncMessageCallback), this); 1938 2025 1939 2026 g_object_set(m_playBin.get(), "mute", m_player->muted(), NULL); -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
r181153 r181499 48 48 typedef struct _GstElement GstElement; 49 49 typedef struct _GstMpegtsSection GstMpegtsSection; 50 typedef struct _GstGLContext GstGLContext; 51 typedef struct _GstGLDisplay GstGLDisplay; 50 52 51 53 namespace WebCore { … … 67 69 68 70 static void registerMediaEngine(MediaEngineRegistrar); 71 gboolean handleSyncMessage(GstMessage*); 69 72 gboolean handleMessage(GstMessage*); 70 73 void handlePluginInstallerResult(GstInstallPluginsReturn); … … 252 255 bool isMediaSource() const { return false; } 253 256 #endif 257 #if USE(GSTREAMER_GL) 258 GstGLContext* m_glContext; 259 GstGLDisplay* m_glDisplay; 260 #endif 254 261 }; 255 262 } -
trunk/Source/WebKit2/ChangeLog
r181496 r181499 1 2015-03-14 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> 2 3 [GStreamer] share GL context in pipeline 4 https://bugs.webkit.org/show_bug.cgi?id=142693 5 6 Reviewed by Philippe Normand. 7 8 * WebProcess/gtk/WebProcessMainGtk.cpp: Enable XInitThreads() if 9 GSTREAMER_GL is used, since GstGL elements use another thread for 10 queuing GL operations. 11 1 12 2015-03-13 Alex Christensen <achristensen@webkit.org> 2 13 -
trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
r178095 r181499 52 52 #endif 53 53 54 #if USE(COORDINATED_GRAPHICS_THREADED) && PLATFORM(X11)54 #if (USE(COORDINATED_GRAPHICS_THREADED) || USE(GSTREAMER_GL)) && PLATFORM(X11) 55 55 XInitThreads(); 56 56 #endif -
trunk/Source/cmake/FindGStreamer.cmake
r176565 r181499 20 20 # gstreamer-audio: GSTREAMER_AUDIO_INCLUDE_DIRS and GSTREAMER_AUDIO_LIBRARIES 21 21 # gstreamer-fft: GSTREAMER_FFT_INCLUDE_DIRS and GSTREAMER_FFT_LIBRARIES 22 # gstreamer-gl: GSTREAMER_GL_INCLUDE_DIRS and GSTREAMER_GL_LIBRARIES 22 23 # gstreamer-mpegts: GSTREAMER_MPEGTS_INCLUDE_DIRS and GSTREAMER_MPEGTS_LIBRARIES 23 24 # gstreamer-pbutils: GSTREAMER_PBUTILS_INCLUDE_DIRS and GSTREAMER_PBUTILS_LIBRARIES … … 85 86 FIND_GSTREAMER_COMPONENT(GSTREAMER_AUDIO gstreamer-audio-1.0 gstaudio-1.0) 86 87 FIND_GSTREAMER_COMPONENT(GSTREAMER_FFT gstreamer-fft-1.0 gstfft-1.0) 88 FIND_GSTREAMER_COMPONENT(GSTREAMER_GL gstreamer-gl-1.0>=1.5.0 gstgl-1.0) 87 89 FIND_GSTREAMER_COMPONENT(GSTREAMER_MPEGTS gstreamer-mpegts-1.0>=1.4.0 gstmpegts-1.0) 88 90 FIND_GSTREAMER_COMPONENT(GSTREAMER_PBUTILS gstreamer-pbutils-1.0 gstpbutils-1.0) … … 115 117 GSTREAMER_FFT_INCLUDE_DIRS 116 118 GSTREAMER_FFT_LIBRARIES 119 GSTREAMER_GL_INCLUDE_DIRS 120 GSTREAMER_GL_LIBRARIES 117 121 GSTREAMER_INCLUDE_DIRS 118 122 GSTREAMER_LIBRARIES -
trunk/Source/cmake/OptionsGTK.cmake
r181395 r181499 258 258 add_definitions(-DWTF_USE_GSTREAMER) 259 259 if (ENABLE_VIDEO) 260 list(APPEND GSTREAMER_COMPONENTS video mpegts tag )260 list(APPEND GSTREAMER_COMPONENTS video mpegts tag gl) 261 261 endif () 262 262 … … 271 271 add_definitions(-DWTF_USE_GSTREAMER_MPEGTS) 272 272 set(USE_GSTREAMER_MPEGTS TRUE) 273 endif () 274 275 if (PC_GSTREAMER_GL_FOUND) 276 add_definitions(-DWTF_USE_GSTREAMER_GL) 277 set(USE_GSTREAMER_GL TRUE) 273 278 endif () 274 279 endif ()
Note: See TracChangeset
for help on using the changeset viewer.