gstreamer & libnotify

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

gstreamer & libnotify

Stas Gurtovoy
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.6

Here'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.



------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer & libnotify

Edward Hervey
Administrator
On Thu, 2010-08-05 at 09:55 +0300, Stas Gurtovoy wrote:

> 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:
>

  Please, don't USE MASSIVELY HUGE FONTS ! In fact, drop the html if
possible.

>
> ______________________________________________________________________
> 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

  this backtrace is useless. Please install debug symbol packages (or
build with debugging symbols enabled and don't strip).

>
> ______________________________________________________________________
>
> 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.6
> Here's the code of the video initialisation:

  Same useless backtrace. We don't know what dbus is doing.

  Also, I don't see any usage of GStreamer in those backtraces. How
certain are you the problem is in gstreamer ?

>
> ******
>
> 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.
>
>
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel