How to get current bandwidth of the network in gstreamer

Tim Müller tim at centricular.com
Mon Jan 18 00:46:57 PST 2016


On Sat, 2016-01-16 at 17:15 -0800, gstreader wrote:

Hi,

> I have tried to get the bandwidth value in
> server side using the following code
> 
> /* give some stats when we receive RTCP */
>   g_signal_connect (rtpbin, "on-ssrc-active", G_CALLBACK
> (on_ssrc_active_cb),
>   NULL);
> 
> static void
> on_ssrc_active_cb (GstElement * rtpbin, guint sessid, guint ssrc,
>     GstElement * pay)
> {
>   GObject *rtpsession, *rtpsource;
>   gdouble bandw;
> 
>   g_print ("\nGot RTCP from session %u, SSRC %u\n", sessid, ssrc);
> 
>   /* get the right session */
>   g_signal_emit_by_name (rtpbin, "get-internal-session", sessid,
> &rtpsession);
>   g_object_get(G_OBJECT(rtpsession),"bandwidth",&bandw,NULL);
>   g_print("Bandwidth of the session:%f\n",bandw);
> ...........
> 
> But, I am getting wrong value of bandwidth which is not matching with
> my system upload speed/bw.

What do you get here, and what do you expect? It's supposed to be in
bits per second according to the property descripton.


You can also check udpsink, it has a "bytes-served" property which you
can read out regularly.

Cheers
 -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com




More information about the gstreamer-devel mailing list