http-launch on Android

Lee Matthews lma at spaceapplications.com
Wed May 28 08:54:57 PDT 2014


Hi,

I'm trying to do http streaming from an android phone. I'm using the code described here as a reference : https://coaxion.net/blog/2013/10/streaming-gstreamer-pipelines-via-http/

I compile the code using NDK, but during runtime there are some issues, see below :

'pipeline1', GstMessageStateChanged, old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY, pending-state=(GstState)GST_STATE_VOID_PENDING;
D/GStreamer+GST_BUS( 3175): 0:00:00.328679583 0x75a83400 gstbus.c:345:gst_bus_post:<bus3> [msg 0x75c9f018] pushing on async queue
D/GStreamer+GST_BUS( 3175): 0:00:00.328730417 0x75a83400 gstbus.c:348:gst_bus_post:<bus3> [msg 0x75c9f018] pushed on async queue
D/GStreamer+GST_STATES( 3175): 0:00:00.328784896 0x75a83400 gstelement.c:2560:gst_element_set_state_func:<pipeline1> returned SUCCESS
D/VIDEO-SOURCE( 3175): ok3
W/GLib+GLib-GObject( 3175): cannot register existing type 'GCancellable'
W/GLib+GLib-GObject( 3175): cannot add private field to invalid (non-instantiatable) type '<invalid>'
E/GLib+GLib( 3175): g_once_init_leave: assertion 'result != 0' failed
E/GLib+GLib-GObject( 3175): g_object_new: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
D/VIDEO-SOURCE( 3175): ok4
W/GLib+GLib-GObject( 3175): cannot register existing type 'GSocket'
W/GLib+GLib-GObject( 3175): cannot add private field to invalid (non-instantiatable) type '<invalid>'
W/GLib+GLib-GObject( 3175): cannot register existing type 'GInitable'
E/GLib+GLib-GObject( 3175): g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed
E/GLib+GLib( 3175): g_once_init_leave: assertion 'result != 0' failed
E/GLib+GLib-GObject( 3175): g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
E/GLib+GLib( 3175): g_once_init_leave: assertion 'result != 0' failed

It seems to be happening whilst trying to create a socket. Could it be a gio issue ? The code doesn't execute any further than the g_socket_listener_add_inet_port function call.

--
Lee

Here is part of the code :

 DEBUG("gst init");

  gst_init (0, NULL);

  gst_debug_set_default_threshold (GST_LEVEL_DEBUG); 

  bin = gst_parse_launch ("webmmux streamable=true name=stream videotestsrc pattern=ball ! video/x-raw, framerate=30/1, width=320, height=240 ! vp8enc deadline=1 threads=16 cpu-used=15 end-usage=cbr target-bitrate=512000 undershoot=95 max-quantizer=56 ! stream.", &err);
  if (!bin) {
    g_print ("invalid pipeline: %s\n", err->message);
    g_clear_error (&err);
    return -2;
  }
  else
  {
 	DEBUG("Pipeline valid");
  }

  DEBUG("end parse");

  stream = gst_bin_get_by_name (GST_BIN (bin), "stream");
  if (!stream) {
    g_print ("no element with name \"stream\" found\n");
    gst_object_unref (bin);
    return -3;
  }

  DEBUG("ok1");

  srcpad = gst_element_get_static_pad (stream, "src");
  if (!srcpad) {
    g_print ("no \"src\" pad in element \"stream\" found\n");
    gst_object_unref (stream);
    gst_object_unref (bin);
    return -4;
  }

  DEBUG("ok2");

  ghostpad = gst_ghost_pad_new ("src", srcpad);
  gst_element_add_pad (GST_ELEMENT (bin), ghostpad);
  gst_object_unref (srcpad);

  pipeline = gst_pipeline_new (NULL);

  multisocketsink = gst_element_factory_make ("multisocketsink", NULL);
  g_object_set (multisocketsink,
      "unit-format", GST_FORMAT_TIME,
      "units-max", (gint64) 7 * GST_SECOND,
      "units-soft-max", (gint64) 3 * GST_SECOND,
      "recover-policy", 3 /* keyframe */ ,
      "timeout", (guint64) 10 * GST_SECOND,
      "sync-method", 1 /* next-keyframe */ ,
      NULL);

  gst_bin_add_many (GST_BIN (pipeline), bin, multisocketsink, NULL);

  sinkpad = gst_element_get_static_pad (multisocketsink, "sink");
  gst_pad_link (ghostpad, sinkpad);
  gst_object_unref (sinkpad);

  bus = gst_element_get_bus (pipeline);
  gst_bus_add_signal_watch (bus);
  g_signal_connect (bus, "message", G_CALLBACK (on_message), NULL);
  gst_object_unref (bus);

  g_signal_connect (multisocketsink, "client-socket-removed",
      G_CALLBACK (on_client_socket_removed), NULL);

  loop = g_main_loop_new (NULL, FALSE);

  if (gst_element_set_state (pipeline,
          GST_STATE_READY) == GST_STATE_CHANGE_FAILURE) {
    gst_object_unref (pipeline);
    g_main_loop_unref (loop);
    g_print ("Failed to set pipeline to ready\n");
    return -5;
  }

  DEBUG("ok3");

  service = g_socket_service_new ();
  DEBUG("ok4");

  gboolean result = g_socket_listener_add_inet_port (G_SOCKET_LISTENER (service), 8080, NULL, NULL);
 
  DEBUG("ok5");

  if(!result) 
  {
      DEBUG("socket fail");
  }
  else
  {
     DEBUG("socket success");
  } 


More information about the gstreamer-devel mailing list