streamer inside thread
d
dudi017 at gmail.com
Fri Jan 31 11:06:19 PST 2014
Hi,
Im trying to transmit video from thread.
the program works perfectly if I put it outside the thread, but once I put
it inside the thread, im getting this error:
(program:14481): GStreamer-CRITICAL **: gst_mini_object_unref: assertion
`GST_IS_MINI_OBJECT (mini_object)' failed
(program:14481): GLib-GObject-CRITICAL **: g_object_unref: assertion
`G_IS_OBJECT (object)' failed
this is the content of the thread: (im kind of sure that the problem is with
---> gst_init (&rcvStruct.argc, &rcvStruct.argv); )
void *RTPfun(void * rcv) //rcv is struct that contain argc, argv, and
some IP address
{
struct multiple_var rcvStruct =*(struct multiple_var *) rcv;
char *IP= (char*)rcvStruct.client_addr;
GstElement *pipeline, *src, *encoder, *parse, *rtp, *sink;
GstBus *bus;
GstMessage *msg;
GstStateChangeReturn ret;
GMainLoop *loop;
printf("argc: %d\n",rcvStruct.argc);
//gst_init (&argc, &argv);
gst_init (&rcvStruct.argc, &rcvStruct.argv);
printf("RTPthread: client IP: %s\n",IP);
free (rcv);
src = gst_element_factory_make ("videotestsrc", "src"); //v4l2src
encoder = gst_element_factory_make ("x264enc","encoder");
rtp = gst_element_factory_make ("rtph264pay", "rtp");
sink = gst_element_factory_make ("udpsink", "sink");
pipeline = gst_pipeline_new ("test-pipeline");
if (!pipeline) g_printerr ("Not pipeline.\n");
if (!src) g_printerr ("Not src.\n");
if (!encoder) g_printerr ("Not encoder.\n");
if (!rtp) g_printerr ("Not rtp.\n");
if (!sink) g_printerr ("Not sink.\n");
g_object_set(G_OBJECT(sink),"host",IP,NULL);
g_object_set(G_OBJECT(sink),"port",5000,NULL);
// Build the pipeline
gst_bin_add_many (GST_BIN (pipeline), src, encoder, rtp, sink, NULL);
if (gst_element_link_many (src, encoder, rtp, sink, NULL) != TRUE) {
g_printerr ("Elements could not be linked.\n");
gst_object_unref (pipeline);
return 0;//-1
}
// Start playing
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
if (ret == GST_STATE_CHANGE_FAILURE) {
g_printerr ("Unable to set the pipeline to the playing state.\n");
gst_object_unref (pipeline);
return 0;//-1
}
// Parse message
if (msg != NULL) {
GError *err;
gchar *debug_info;
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_ERROR:
gst_message_parse_error (msg, &err, &debug_info);
g_printerr ("Error received from element %s: %s\n", GST_OBJECT_NAME
(msg->src), err->message);
g_printerr ("Debugging information: %s\n", debug_info ? debug_info :
"none");
g_clear_error (&err);
g_free (debug_info);
break;
case GST_MESSAGE_EOS:
g_print ("End-Of-Stream reached.\n");
break;
default:
//We should not reach here because we only asked for ERRORs and EOS
g_printerr ("Unexpected message received.\n");
break;
}
gst_message_unref (msg);
}
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
g_printerr("finished\n");
return 0;
}
If someone know what to do it will be great!
thanks.
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/streamer-inside-thread-tp4665006.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list