[gst-devel] gstreamer & libnotify

Stas Gurtovoy stas at graphtech.co.il
Thu Aug 5 08:55:14 CEST 2010


Hi,

I'm new to gstreamer, so maybe I'm doing something totally wrong here.
I have an SDL application (using SDL for  window, rendering and event
handling), and I have a thread which uses gstreamer to play a video stream.
In that thread I initialise the pipeline, create the main loop and run it.
The video is playing fine on my SDL created window.
The problem starts when I get libnotify involved. I use libnotify to post
some kinds of notifications from the application. The notifications are
posted from a different thread (not the video player thread), and also use
glib and libdbus. As soon as a notification is shown, the video thread exits
(or sometime crashes).

 Probably there's some collision between libnotify & gstreamer. They do have
the same context, but the libnotify thread doesn't run his own main loop.
Here's the trace for the relevant threads:

The exiting thread, which run the video main loop:
------------------------------
0 0xb6bcac34 in _exit () from /lib/tls/i686/cmov/libc.so.6 1 0xb691504d in
?? () from /lib/libdbus-1.so.3 2 0xb68f5e73 in ?? () from
/lib/libdbus-1.so.3 3 0xb68f827b in ?? () from /lib/libdbus-1.so.3 4
0xb68f82fd in dbus_connection_send () from /lib/libdbus-1.so.3 5 0xb68f162c
in ?? () from /lib/libdbus-1.so.3 6 0xb68f16a9 in dbus_bus_remove_match ()
from /lib/libdbus-1.so.3 7 0xb692f5db in ?? () from
/usr/lib/libdbus-glib-1.so.2 8 0xb69311f9 in ?? () from
/usr/lib/libdbus-glib-1.so.2 9 0xb6fd329f in g_object_run_dispose () from
/usr/lib/libgobject-2.0.so.0 10 0xb693157b in ?? () from
/usr/lib/libdbus-glib-1.so.2 11 0xb68f70d5 in dbus_connection_dispatch ()
from /lib/libdbus-1.so.3 12 0xb69286bd in ?? () from
/usr/lib/libdbus-glib-1.so.2 13 0xb6f41b88 in g_main_context_dispatch ()
from /usr/lib/libglib-2.0.so.0 14 0xb6f450eb in ?? () from
/usr/lib/libglib-2.0.so.0 15 0xb6f455ba in g_main_loop_run () from
/usr/lib/libglib-2.0.so.0 16 0x0805135b in vp_thread_func
(userdata=0x81b3948) at video_player/video_player.c:874 17 0xb6c944ff in
start_thread () from /lib/tls/i686/cmov/libpthread.so.0 18 0xb6c0f5ee in
clone () from /lib/tls/i686/cmov/libc.so.6
------------------------------

The frame thread, which calls notify_notification_show:
------------------------------
0 0xb690e6b6 in ?? () from /lib/libdbus-1.so.3 1 0xb690e09a in ?? () from
/lib/libdbus-1.so.3 2 0xb690e111 in ?? () from /lib/libdbus-1.so.3 3
0xb690bd39 in ?? () from /lib/libdbus-1.so.3 4 0xb690c92e in ?? () from
/lib/libdbus-1.so.3 5 0xb68f6bf8 in ?? () from /lib/libdbus-1.so.3 6
0xb68f8d98 in ?? () from /lib/libdbus-1.so.3 7 0xb68f8ef2 in ?? () from
/lib/libdbus-1.so.3 8 0xb69061f1 in dbus_pending_call_block () from
/lib/libdbus-1.so.3 9 0xb692e1cf in ?? () from /usr/lib/libdbus-glib-1.so.2 10
0xb692ec0e in dbus_g_proxy_call () from /usr/lib/libdbus-glib-1.so.2 11
0xb77cdb98 in notify_notification_show () from /usr/lib/libnotify.so.1 12
0x0804b91d in post_tray_notification (msg=0xb5409008 "Test!") at
unix_utils.c:277 13 0x0804c3a7 in handle_event_msg (msg=0xb46132b4, len=6)
at scremote_client.c:504 14 0x0804ca5e in handle_msg (sock=7) at
scremote_client.c:639 15 0x0804cb1f in wait_for_msg (sock=7) at
scremote_client.c:657 16 0x0804dfb5 in frame_thread_func (dummy=0x0) at
scremote_client.c:1466 17 0xb6c944ff in start_thread () from
/lib/tls/i686/cmov/libpthread.so.0 18 0xb6c0f5ee in clone () from
/lib/tls/i686/cmov/libc.so.6Here's the code of the video initialisation:

******

static void* vp_thread_func(void* userdata)
{

    vp_t* vp = (vp_t*)userdata;

    vp->thread_state = VP_THREAD_INITIALIZING;

    if(vp_init(vp)) {
        vp->thread_state = VP_THREAD_INITIALIZED;

        vp->loop = g_main_loop_new (NULL , FALSE);

        // Call our timer function every 500ms - this will be used to hide
the cursor
        // when there is no input.
        g_timeout_add_full(G_PRIORITY_LOW, 500, &vp_timer, (gpointer)vp,
NULL);

        syslog(LOG_INFO, "Video player subsystem running.\n");

        g_main_loop_run(vp->loop);

        vp_remove(vp);

        vp->thread_state = VP_THREAD_UNINITIALIZED;

        if(vp->remove_request) {
            g_free(vp);
            // Don't use vp beyond this point.
        }
    } else {
        syslog(LOG_ERR, "Failed to initialize the video player
subsystem.\n");
        vp->thread_state = VP_THREAD_INIT_ERROR;
    }

    return NULL;
}

*****

Does anyone have an idea what causes the collision? Any suggestions?

Thanks,
Stas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20100805/54be6dfd/attachment.htm>


More information about the gstreamer-devel mailing list