Title: [229009] releases/WebKitGTK/webkit-2.20/Source/WebCore
Revision
229009
Author
[email protected]
Date
2018-02-26 05:22:04 -0800 (Mon, 26 Feb 2018)

Log Message

Merge r228869 - [GStreamer] We need to adopt GstGlDisplays after GStreamer 1.13.1
https://bugs.webkit.org/show_bug.cgi?id=182996

Reviewed by Xabier Rodriguez-Calvar.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
Adopt references when running with GStreamer 1.13.1 to avoid
memory leaks.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog (229008 => 229009)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-02-26 13:14:27 UTC (rev 229008)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-02-26 13:22:04 UTC (rev 229009)
@@ -1,5 +1,17 @@
 2018-02-21  Philippe Normand  <[email protected]>
 
+        [GStreamer] We need to adopt GstGlDisplays after GStreamer 1.13.1
+        https://bugs.webkit.org/show_bug.cgi?id=182996
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
+        Adopt references when running with GStreamer 1.13.1 to avoid
+        memory leaks.
+
+2018-02-21  Philippe Normand  <[email protected]>
+
         [GStreamer] Create a Wayland GL display instead of EGL
         https://bugs.webkit.org/show_bug.cgi?id=182968
 

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (229008 => 229009)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-02-26 13:14:27 UTC (rev 229008)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-02-26 13:22:04 UTC (rev 229009)
@@ -441,17 +441,25 @@
 
     auto& sharedDisplay = PlatformDisplay::sharedDisplayForCompositing();
 
+    // The floating ref removal support was added in https://bugzilla.gnome.org/show_bug.cgi?id=743062.
+    bool shouldAdoptRef = webkitGstCheckVersion(1, 13, 1);
     if (!m_glDisplay) {
 #if PLATFORM(X11)
 #if USE(GLX)
         if (is<PlatformDisplayX11>(sharedDisplay)) {
             GST_DEBUG("Creating X11 shared GL display");
-            m_glDisplay = GST_GL_DISPLAY(gst_gl_display_x11_new_with_display(downcast<PlatformDisplayX11>(sharedDisplay).native()));
+            if (shouldAdoptRef)
+                m_glDisplay = adoptGRef(GST_GL_DISPLAY(gst_gl_display_x11_new_with_display(downcast<PlatformDisplayX11>(sharedDisplay).native())));
+            else
+                m_glDisplay = GST_GL_DISPLAY(gst_gl_display_x11_new_with_display(downcast<PlatformDisplayX11>(sharedDisplay).native()));
         }
 #elif USE(EGL)
         if (is<PlatformDisplayX11>(sharedDisplay)) {
             GST_DEBUG("Creating X11 shared EGL display");
-            m_glDisplay = GST_GL_DISPLAY(gst_gl_display_egl_new_with_egl_display(downcast<PlatformDisplayX11>(sharedDisplay).eglDisplay()));
+            if (shouldAdoptRef)
+                m_glDisplay = adoptGRef(GST_GL_DISPLAY(gst_gl_display_egl_new_with_egl_display(downcast<PlatformDisplayX11>(sharedDisplay).eglDisplay())));
+            else
+                m_glDisplay = GST_GL_DISPLAY(gst_gl_display_egl_new_with_egl_display(downcast<PlatformDisplayX11>(sharedDisplay).eglDisplay()));
         }
 #endif
 #endif
@@ -459,7 +467,10 @@
 #if PLATFORM(WAYLAND)
         if (is<PlatformDisplayWayland>(sharedDisplay)) {
             GST_DEBUG("Creating Wayland shared display");
-            m_glDisplay = GST_GL_DISPLAY(gst_gl_display_wayland_new_with_display(downcast<PlatformDisplayWayland>(sharedDisplay).native()));
+            if (shouldAdoptRef)
+                m_glDisplay = adoptGRef(GST_GL_DISPLAY(gst_gl_display_wayland_new_with_display(downcast<PlatformDisplayWayland>(sharedDisplay).native())));
+            else
+                m_glDisplay = GST_GL_DISPLAY(gst_gl_display_wayland_new_with_display(downcast<PlatformDisplayWayland>(sharedDisplay).native()));
         }
 #endif
 
@@ -466,7 +477,10 @@
 #if PLATFORM(WPE)
         ASSERT(is<PlatformDisplayWPE>(sharedDisplay));
         GST_DEBUG("Creating WPE shared EGL display");
-        m_glDisplay = GST_GL_DISPLAY(gst_gl_display_egl_new_with_egl_display(downcast<PlatformDisplayWPE>(sharedDisplay).eglDisplay()));
+        if (shouldAdoptRef)
+            m_glDisplay = adoptGRef(GST_GL_DISPLAY(gst_gl_display_egl_new_with_egl_display(downcast<PlatformDisplayWPE>(sharedDisplay).eglDisplay())));
+        else
+            m_glDisplay = GST_GL_DISPLAY(gst_gl_display_egl_new_with_egl_display(downcast<PlatformDisplayWPE>(sharedDisplay).eglDisplay()));
 #endif
 
         ASSERT(m_glDisplay);
@@ -488,7 +502,10 @@
     if (!contextHandle)
         return false;
 
-    m_glContext = gst_gl_context_new_wrapped(m_glDisplay.get(), reinterpret_cast<guintptr>(contextHandle), glPlatform, glAPI);
+    if (shouldAdoptRef)
+        m_glContext = adoptGRef(gst_gl_context_new_wrapped(m_glDisplay.get(), reinterpret_cast<guintptr>(contextHandle), glPlatform, glAPI));
+    else
+        m_glContext = gst_gl_context_new_wrapped(m_glDisplay.get(), reinterpret_cast<guintptr>(contextHandle), glPlatform, glAPI);
 
     return true;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to