Crashes on gst_bus_add_watch

Duzy Chan geek at duzy.info
Fri Jan 25 01:44:33 PST 2013


Greeting, all

I'm currently working on a app. But I'm now confronting a crash
while repeatedly creating a pipeline very quickly. And I found that it was
caused by a gst_bus_add_watch (http://pastebin.com/b2DVmHnQ). The code in *
gst_bus_add_watch_full_unlocked* was trying to creating a new GSource by
calling *gst_bus_create_watch*, yet it turned out a NULL source. This is
the final end point of the cause. And the code in *gstbus.c* looks like
this:

static guint
*gst_bus_add_watch_full_unlocked* (GstBus * bus, gint priority,
    GstBusFunc func, gpointer user_data, GDestroyNotify notify)
{
  GMainContext *ctx;
  guint id;
  GSource *source;

  if (bus->priv->watch_id) {
    GST_ERROR_OBJECT (bus,
        "Tried to add new watch while one was already there");
    return 0;
  }

  *source* = *gst_bus_create_watch* (bus);

  if (priority != G_PRIORITY_DEFAULT)
    g_source_set_priority (*source*, priority);

  g_source_set_callback (*source*, (GSourceFunc) func, user_data, notify);

  ctx = g_main_context_get_thread_default ();
  id = g_source_attach (source, ctx);
  g_source_unref (source);

  if (id) {
    bus->priv->watch_id = source;
  }

  GST_DEBUG_OBJECT (bus, "New source %p with id %u", source, id);
  return id;
}


And the client code from my app looks like this:

  worker->pipeline = workerclass->create_pipeline (worker);
  if (!worker->pipeline)
    goto error_create_pipeline;

  gst_pipeline_set_auto_flush_bus (GST_PIPELINE (worker->pipeline), FALSE);

  worker->bus = gst_pipeline_get_bus (GST_PIPELINE (worker->pipeline));
  worker->watch = *gst_bus_add_watch* (worker->bus, gst_worker_message,
worker);


Part of the stack when it crashed is like this:

#0  0x00007ffff728ef56 in *g_source_attach* () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007ffff7b1e228 in
*gst_bus_add_watch_full_unlocked*(notify=<optimized out>,
user_data=0x7fffc801a0c0, func=0x403d50
<gst_worker_message>, priority=<optimized out>, bus=<optimized out>) at
gstbus.c:867
#2  gst_bus_add_watch_full_unlocked (bus=<optimized out>,
priority=<optimized out>, func=0x403d50 <gst_worker_message>,
user_data=0x7fffc801a0c0, notify=<optimized out>) at gstbus.c:846
#3  0x00007ffff7b1e367 in gst_bus_add_watch_full (bus=0x991c10,
priority=priority at entry=0, func=func at entry=0x403d50 <gst_worker_message>,
user_data=user_data at entry=0x7fffc801a0c0, notify=notify at entry=0x0) at
gstbus.c:916
#4  0x00007ffff7b1e390 in *gst_bus_add_watch* (bus=<optimized out>,
func=func at entry=0x403d50 <gst_worker_message>,
user_data=user_data at entry=0x7fffc801a0c0)
at gstbus.c:948
#5  0x00000000004041b1 in gst_worker_prepare (worker=0x7fffc801a0c0) at
gstworker.c:480


Do you have any ideas about this? I've been tracking on it for long time,
still have no lucks.

Regards
Duzy Chan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130125/80afd7c7/attachment.html>


More information about the gstreamer-devel mailing list