udpsink "client-added" and "client-removed" signals don't seem to work (or I am using it incorrectly!)

enthusiastic geek enthusiasticgeek at gmail.com
Wed Apr 10 22:07:11 PDT 2013


A part of my code looks like


app->launch_string_[0] = "videotestsrc ! x264enc pass=qual quantizer=20
tune=zerolatency ! rtph264pay ! udpsink name=udpsink0 host=127.0.0.1
port=1234";
    app->launch_string_[1] = "videotestsrc ! x264enc pass=qual quantizer=20
tune=zerolatency ! rtph264pay ! udpsink name=udpsink0 host=127.0.0.1
port=5678";

...
...
...

g_signal_connect
(app->pipeline_[index]->Gst::Bin::get_element("udpsink0")->gobj(),
"client-added",  G_CALLBACK(&VideoBroadcast::client_added), NULL);//
(gpointer) &index);
    //Experimental
    g_signal_connect
(app->pipeline_[index]->Gst::Bin::get_element("udpsink0")->gobj(),
"client-removed",  G_CALLBACK(&VideoBroadcast::client_removed), NULL);//
(gpointer) &index);

g_signal_connect
(app->pipeline_[index]->Gst::Bin::get_element("udpsink0")->gobj(),
"client-added",  G_CALLBACK(&VideoBroadcast::on_client_added), NULL);//
(gpointer) &index);
    //Experimental
    g_signal_connect
(app->pipeline_[index]->Gst::Bin::get_element("udpsink0")->gobj(),
"client-removed",  G_CALLBACK(&VideoBroadcast::on_client_removed), NULL);//
(gpointer) &index);

...
...
...

void VideoBroadcast::client_added(GstElement* sink, gint fd, gpointer data)
{
  gint num_fds;
  g_object_get(G_OBJECT(sink), "num_fds", &num_fds, NULL);
  g_print("fdsink: successfully added client %d (sink has now %d fds)", fd,
num_fds);
}


void VideoBroadcast::client_removed(GstElement* sink, gint fd, gpointer
data)
{
  gint num_fds;
  g_object_get(G_OBJECT(sink), "num_fds", &num_fds, NULL);
  g_print("fdsink: successfully removed client %d (sink has now %d fds)",
fd, num_fds);
}


void VideoBroadcast::on_client_added (GstElement *multiudpsink, gchar *host,
gint port, gpointer user_data)
{
   g_print("[added]\n");
}

void VideoBroadcast::on_client_removed (GstElement *multiudpsink, gchar
*host, gint port, gpointer user_data)
{
   g_print("[removed]\n");
}


I tried both the variants of the add/remove function above and was expecting
to see the clients added/removed events as soon as I start decoding the
pipeline. 

If I run my binary with

 GST_DEBUG=*added*:5 ./udpencode 


and start my decoding pipeline

 gst-launch udpsrc port=1234 ! "application/x-rtp, payload=96" !
rtph264depay ! ffdec_h264 ! xvimagesink sync=false


I clearly see the debug statements where clients are connected. It also
appears that udpsink inherits properties from udpmultisink


Starting program: /home/virgo/rtsptest/udpencode 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
 Initializing Broadcast
0:00:00.376603243  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1061:gst_multiudpsink_add_internal:<GstUDPSink at 0x8428010>
adding client on host localhost, port 4951
0:00:00.385241637  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1089:gst_multiudpsink_add_internal:<GstUDPSink at 0x8428010>
add client with host localhost, port 4951
0:00:00.385335665  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1099:gst_multiudpsink_add_internal:<GstUDPSink at 0x8428010>
added client on host localhost, port 4951
0:00:00.385513588  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1141:gst_multiudpsink_remove:<udpsink0> found 1 clients
with host localhost, port 4951
0:00:00.385569414  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1145:gst_multiudpsink_remove:<udpsink0> remove client with
host localhost, port 4951
0:00:00.385620154  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1061:gst_multiudpsink_add_internal:<udpsink0> adding
client on host 127.0.0.1, port 4951
0:00:00.385677584  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1089:gst_multiudpsink_add_internal:<udpsink0> add client
with host 127.0.0.1, port 4951
0:00:00.385746937  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1099:gst_multiudpsink_add_internal:<udpsink0> added client
on host 127.0.0.1, port 4951
0:00:00.385825239  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1141:gst_multiudpsink_remove:<udpsink0> found 1 clients
with host 127.0.0.1, port 4951
0:00:00.385882764  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1145:gst_multiudpsink_remove:<udpsink0> remove client with
host 127.0.0.1, port 4951
0:00:00.385930357  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1061:gst_multiudpsink_add_internal:<udpsink0> adding
client on host 127.0.0.1, port 1234
0:00:00.385981052  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1089:gst_multiudpsink_add_internal:<udpsink0> add client
with host 127.0.0.1, port 1234
0:00:00.386023699  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1099:gst_multiudpsink_add_internal:<udpsink0> added client
on host 127.0.0.1, port 1234
State = NULL
0:00:00.387784474  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:936:gst_multiudpsink_init_send:<udpsink0> creating sockets
0:00:00.387847873  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:945:gst_multiudpsink_init_send:<udpsink0> have socket
0:00:00.387952219  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:988:gst_multiudpsink_init_send:<udpsink0> could not get
udp buffer size
0:00:00.388011564  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:868:gst_multiudpsink_configure_client:<udpsink0>
configuring client 0x842a1a8
0:00:00.388053845  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:885:gst_multiudpsink_configure_client:<udpsink0> setting
unicast ttl to 64
[New Thread 0xb63e4b40 (LWP 5826)]
0:00:00.393963527  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1061:gst_multiudpsink_add_internal:<GstUDPSink at 0x84283a0>
adding client on host localhost, port 4951
0:00:00.394302912  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1089:gst_multiudpsink_add_internal:<GstUDPSink at 0x84283a0>
add client with host localhost, port 4951
0:00:00.394388170  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1099:gst_multiudpsink_add_internal:<GstUDPSink at 0x84283a0>
added client on host localhost, port 4951
0:00:00.394497939  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1141:gst_multiudpsink_remove:<udpsink0> found 1 clients
with host localhost, port 4951
0:00:00.394547867  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1145:gst_multiudpsink_remove:<udpsink0> remove client with
host localhost, port 4951
0:00:00.394627071  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1061:gst_multiudpsink_add_internal:<udpsink0> adding
client on host 127.0.0.1, port 4951
0:00:00.394698533  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1089:gst_multiudpsink_add_internal:<udpsink0> add client
with host 127.0.0.1, port 4951
0:00:00.394755793  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1099:gst_multiudpsink_add_internal:<udpsink0> added client
on host 127.0.0.1, port 4951
0:00:00.394821757  5823  0x83f7560 DEBUG           multiudpsink
gstmultiudpsink.c:1141:gst_multiudpsink_remove:<udpsink0> found 1 clients
with host 127.0.0.1, port 4951



Any ideas what is the issue?



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/udpsink-client-added-and-client-removed-signals-don-t-seem-to-work-or-I-am-using-it-incorrectly-tp4659470.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list