[Bug 723529] New: glimagesink only draws on buffer push

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Mon Feb 3 05:06:54 PST 2014


https://bugzilla.gnome.org/show_bug.cgi?id=723529
  GStreamer | gst-plugins-gl | git

           Summary: glimagesink only draws on buffer push
    Classification: Platform
           Product: GStreamer
           Version: git
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-gl
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: chris at edesix.com
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


I'm using a recent gst-plugins-gl from git (2afcb176 - 2014-01-17) with
gstreamer 1.2.2.

I'm trying to get glimagesink to update the display in 2 scenarios:

1) The video frame rate is very slow (say 1 fps) and the window manager sends
an expose or configure(resize) event between frames.

2) The pipeline is paused and the the window manager sends an expose or
configure(resize) event.

I managed to get the code to respond to X expose events when the pipeline is
paused by removing the check in gst_gl_window_x11_handle_event() that the
expose event has been sent by the plugin in - with this patch...

---
gst-plugins-gl-git-2afcb176/gst-libs/gst/gl/x11/gstglwindow_x11.c.pre-expose-when-paused
   2014-01-31 17:21:19.851703135 +0000
+++ gst-plugins-gl-git-2afcb176/gst-libs/gst/gl/x11/gstglwindow_x11.c   
2014-01-31 17:22:02.597449630 +0000
@@ -651,12 +651,6 @@
           break;
         }

-        /* just ignore request that does not come from us
-         * they are un-necessary and it overloads the drawer
-         */
-        if (!event.xexpose.send_event)
-          break;
-
         if (window->draw) {
           context = gst_gl_window_get_context (window);
           context_class = GST_GL_CONTEXT_GET_CLASS (context);

However, I think by doing this I've violated the locking assumptions of the
code, because now I can get a deadlock between the gst buffer push thread and
the gl thread when resizing the gl window while the pipeline is running...

When a buffer is pushed, gst_glimage_sink_render() tries to replace the
stored_buffer texture while holding the glimage_sink lock. When the old buffer
is unreferenced, a synchronous call is made to the gl thread using
gst_gl_window_send_message() to delete the texture. This call can deadlock
waiting for completion if an expose event arrives in the gl thread, because
gst_glimage_sink_on_draw() also obtains the glimage_sink lock. Full stack trace
of the deadlocked threads below.

Presumably this wouldn't have happened if I'd left the send_event check in the
X expose event handler, but what should I have done?

So basically my question is whether it is reasonable to try and get glimagesink
to render in the scenarios I mentioned at above, or do I need to come up with
another solution?

Chris.

(gdb) thread 5
[Switching to thread 5 (Thread 0xed8ffb40 (LWP 10995))]
#0  0xf7ffd430 in __kernel_vsyscall ()
(gdb) bt
#0  0xf7ffd430 in __kernel_vsyscall ()
#1  0x495c37ac in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x495143c1 in g_cond_wait () from /lib/libglib-2.0.so.0
#3  0xf752651e in gst_gl_window_default_send_message (window=0x8365010,
callback=0xf750c65a <_gst_gl_context_thread_run_generic>, data=0xed8feb44) at
../../../../../../src/gst-plugins-gl-git-2afcb176/gst-libs/gst/gl/gstglwindow.c:343
#4  0xf75263e6 in gst_gl_window_send_message (window=window at entry=0x8365010,
callback=callback at entry=0xf750c65a <_gst_gl_context_thread_run_generic>,
data=data at entry=0xed8feb44)
    at
../../../../../../src/gst-plugins-gl-git-2afcb176/gst-libs/gst/gl/gstglwindow.c:370
#5  0xf750de98 in gst_gl_context_thread_add (context=context at entry=0x82329a0,
func=func at entry=0xf7527354 <_del_texture>, data=data at entry=0xe74b5950) at
../../../../../../src/gst-plugins-gl-git-2afcb176/gst-libs/gst/gl/gstglcontext.c:858
#6  0xf7527865 in gst_gl_context_del_texture (context=0x82329a0,
pTexture=pTexture at entry=0xe74b5950) at
../../../../../../src/gst-plugins-gl-git-2afcb176/gst-libs/gst/gl/gstglutils.c:142
#7  0xf750e68e in _gl_mem_free (allocator=0x80c60a0, mem=0xe74b5910) at
../../../../../../src/gst-plugins-gl-git-2afcb176/gst-libs/gst/gl/gstglmemory.c:378
#8  0xf7e787f0 in gst_allocator_free (allocator=allocator at entry=0x80c60a0,
memory=memory at entry=0xe74b5910) at
../../../../src/gstreamer-1.2.2/gst/gstallocator.c:337
#9  0xf7eac0f3 in _gst_memory_free (mem=0xe74b5910) at
../../../../src/gstreamer-1.2.2/gst/gstmemory.c:97
#10 0xf7ead08d in gst_mini_object_unref (mini_object=0xe74b5910) at
../../../../src/gstreamer-1.2.2/gst/gstminiobject.c:467
#11 0xf7e81dda in gst_memory_unref (memory=<optimized out>) at
../../../../src/gstreamer-1.2.2/gst/gstmemory.h:325
#12 _gst_buffer_free (buffer=0xe6eec800) at
../../../../src/gstreamer-1.2.2/gst/gstbuffer.c:578
#13 0xf7ead08d in gst_mini_object_unref
(mini_object=mini_object at entry=0xe6eec800) at
../../../../src/gstreamer-1.2.2/gst/gstminiobject.c:467
#14 0xf7ead24f in gst_mini_object_replace (olddata=olddata at entry=0x815bd60,
newdata=newdata at entry=0xe756ac00) at
../../../../src/gstreamer-1.2.2/gst/gstminiobject.c:513
#15 0xf7541ac8 in gst_buffer_replace (nbuf=0xe756ac00, obuf=0x815bd60) at
/home/chris/pss.wifi/gst/build/i686-linux/install/opt/pss/usr/include/gstreamer-1.0/gst/gstbuffer.h:475
#16 gst_glimage_sink_render (bsink=0x815bad8, buf=0xe756ac00) at
../../../../../src/gst-plugins-gl-git-2afcb176/gst/gl/gstglimagesink.c:765
#17 0xf7f7d745 in gst_base_sink_chain_unlocked
(basesink=basesink at entry=0x815bad8, obj=obj at entry=0xe756ac00,
is_list=is_list at entry=0, pad=<optimized out>) at
../../../../../../src/gstreamer-1.2.2/libs/gst/base/gstbasesink.c:3378
#18 0xf7f7f54c in gst_base_sink_chain_main (basesink=0x815bad8, pad=<optimized
out>, obj=0xe756ac00, is_list=0) at
../../../../../../src/gstreamer-1.2.2/libs/gst/base/gstbasesink.c:3486
#19 0xf7eb0e41 in gst_pad_chain_data_unchecked (data=0xe756ac00,
type=<optimized out>, pad=0x813ed80) at
../../../../src/gstreamer-1.2.2/gst/gstpad.c:3711
#20 gst_pad_push_data (pad=0x813ec48, type=type at entry=4112, data=0xe756ac00) at
../../../../src/gstreamer-1.2.2/gst/gstpad.c:3941
#21 0xf7eb7fea in gst_pad_push (pad=0xe756ac00, buffer=buffer at entry=0xe756ac00)
at ../../../../src/gstreamer-1.2.2/gst/gstpad.c:4044
#22 0xf7a11b44 in gst_queue_push_one (queue=0x814a278) at
../../../../../src/gstreamer-1.2.2/plugins/elements/gstqueue.c:1115
#23 gst_queue_loop (pad=0x813ec48) at
../../../../../src/gstreamer-1.2.2/plugins/elements/gstqueue.c:1244
#24 0xf7edfe22 in gst_task_func (task=task at entry=0x8365858) at
../../../../src/gstreamer-1.2.2/gst/gsttask.c:316
#25 0xf7ee0da2 in default_func (tdata=0x8210e60, pool=0x80c35b0) at
../../../../src/gstreamer-1.2.2/gst/gsttaskpool.c:70
#26 0x494f6a05 in g_thread_pool_thread_proxy () from /lib/libglib-2.0.so.0
#27 0x494f5ebb in g_thread_proxy () from /lib/libglib-2.0.so.0
#28 0x495bfd8a in start_thread () from /lib/libpthread.so.0
#29 0x493bd9be in clone () from /lib/libc.so.6


(gdb) thread 3
[Switching to thread 3 (Thread 0xf0cfeb40 (LWP 10993))]
#0  0xf7ffd430 in __kernel_vsyscall ()
(gdb) bt
#0  0xf7ffd430 in __kernel_vsyscall ()
#1  0x495c6322 in __lll_lock_wait () from /lib/libpthread.so.0
#2  0x495c1def in _L_lock_992 () from /lib/libpthread.so.0
#3  0x495c1daf in pthread_mutex_lock () from /lib/libpthread.so.0
#4  0x49513ff1 in g_mutex_lock () from /lib/libglib-2.0.so.0
#5  0xf7542c8f in gst_glimage_sink_on_draw (gl_sink=0x815bad8) at
../../../../../src/gst-plugins-gl-git-2afcb176/gst/gl/gstglimagesink.c:1029
#6  0xf752aa7b in gst_gl_window_x11_handle_event (window_x11=0x8365010) at
../../../../../../../src/gst-plugins-gl-git-2afcb176/gst-libs/gst/gl/x11/gstglwindow_x11.c:658
#7  0xf752ac75 in x11_event_source_dispatch (base=0xf031b6a0, callback=0x0,
data=0x0) at
../../../../../../../src/gst-plugins-gl-git-2afcb176/gst-libs/gst/gl/x11/x11_event_source.c:69
#8  0x494ce556 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#9  0x494ce920 in g_main_context_iterate.isra.23 () from /lib/libglib-2.0.so.0
#10 0x494cedc3 in g_main_loop_run () from /lib/libglib-2.0.so.0
#11 0xf752a140 in gst_gl_window_x11_run (window=0x8365010) at
../../../../../../../src/gst-plugins-gl-git-2afcb176/gst-libs/gst/gl/x11/gstglwindow_x11.c:554
#12 0xf7526240 in gst_gl_window_run (window=0x8365010) at
../../../../../../src/gst-plugins-gl-git-2afcb176/gst-libs/gst/gl/gstglwindow.c:272
#13 0xf750dba5 in gst_gl_context_create_thread (context=0x82329a0) at
../../../../../../src/gst-plugins-gl-git-2afcb176/gst-libs/gst/gl/gstglcontext.c:747
#14 0x494f5ebb in g_thread_proxy () from /lib/libglib-2.0.so.0
#15 0x495bfd8a in start_thread () from /lib/libpthread.so.0
#16 0x493bd9be in clone () from /lib/libc.so.6

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list