/* this function is called every second and dumps the RTP manager stats */ static gboolean print_stats (GstElement * rtpbin) { GObject *session; GValueArray *arr; GValue *val; guint i; g_print ("***********************************\n"); /* get session 0 */ g_signal_emit_by_name (rtpbin, "get-internal-session", 0, &session); /* print all the sources in the session, this includes the internal source */ g_object_get (session, "sources", &arr, NULL); for (i = 0; i < arr->n_values; i++) { GObject *source; val = g_value_array_get_nth (arr, i); source = g_value_get_object (val); print_source_stats (source); } g_value_array_free (arr); g_object_unref (session); return TRUE; }
/* will be called when gstrtpbin signals on-ssrc-active. It means that an RTCP * packet was received from another source. */ static void on_ssrc_active_cb (GstElement * rtpbin, guint sessid, guint ssrc, GstElement * depay) { GObject *session, *isrc, *osrc; g_print ("got RTCP from session %u, SSRC %u\n", sessid, ssrc); /* get the right session */ g_signal_emit_by_name (rtpbin, "get-internal-session", sessid, &session); /* get the internal source (the SSRC allocated to us, the receiver */ g_object_get (session, "internal-source", &isrc, NULL); print_source_stats (isrc); /* get the remote source that sent us RTCP */ g_signal_emit_by_name (session, "get-source-by-ssrc", ssrc, &osrc); print_source_stats (osrc); }