Title: [228869] trunk/Source/WebCore
Revision
228869
Author
[email protected]
Date
2018-02-21 05:25:26 -0800 (Wed, 21 Feb 2018)

Log Message

[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: trunk/Source/WebCore/ChangeLog (228868 => 228869)


--- trunk/Source/WebCore/ChangeLog	2018-02-21 11:42:05 UTC (rev 228868)
+++ trunk/Source/WebCore/ChangeLog	2018-02-21 13:25:26 UTC (rev 228869)
@@ -1,3 +1,15 @@
+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-20  Philippe Normand  <[email protected]>
 
         [GTK] Layout test media/track/track-in-band-duplicate-tracks-when-source-changes.html failing since r228617

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (228868 => 228869)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-02-21 11:42:05 UTC (rev 228868)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-02-21 13:25:26 UTC (rev 228869)
@@ -438,17 +438,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
@@ -456,7 +464,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
 
@@ -463,7 +474,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);
@@ -485,7 +499,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