Bug 29038 - Add API to get the bitrate
Summary: Add API to get the bitrate
Status: RESOLVED MOVED
Alias: None
Product: Farstream
Classification: Unclassified
Component: Core (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: Olivier Crête
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-13 00:39 UTC by Guillaume Desmottes
Modified: 2018-08-21 12:16 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Guillaume Desmottes 2010-07-13 00:39:58 UTC
From https://bugzilla.gnome.org/show_bug.cgi?id=599166

"""
> > We may also want to extract other kinds of stats from rtpbin, like the average
> > bitrate, jitter, packet loss, etc. Farsight2 doesn't have an API for that, but
> > I can either add one or just fish it out of rtpbin directly.
> 
> I think the bitrate at least is worth displaying. How can I get it? Do you
> think it should be exposed in the FS2 API?

It's a bit annoying to get it out of Farsight2, I'll add apis for that.. To the
FsStream.
"""
Comment 1 Olivier Crête 2011-01-03 18:37:09 UTC
api exists in the tfrc branch
Comment 2 Olivier Crête 2011-04-19 08:46:56 UTC
forget my last comment, the api in the tfrc branch is to SET the bitrate..
Comment 3 Olivier Crête 2011-04-25 17:21:46 UTC
You can get it in a hackish way right now...

FsConference *rtpconf = ...;
FsSession *rtpsession = ...;
FsStream *rtpstream = ....;
guint my_ssrc;

g_object_get(rtpsession, "ssrc", &my_ssrc, NULL);

mybitrate = get_bitrate_for_ssrc (rtpcon, rtpsession, my_ssrc);

You can get the ssrcs for the receiving side from the src pad names from a FsStream.. Yes, it's all pretty complicated...



static guint64
get_bitrate_for_ssrc(FsConference *rtpconf, FsSession *rtpsession, guint ssrc)
{
GstElement *rtpbin = gst_bin_get_by_name(GST_BIN(rtpconf), "rtpbin");
GObject *session;
guint64 bitrate = 0;

g_signal_emit_by_name(rtpbin, "get-internal-session", ssrc, &session);

if (session)
{
 GObject *source;
 g_signal_emit_by_name(session, "get-source-by-ssrc", ssrc, &source) 

 if (source)
 {
  GstStructure *stats;
  gbooolean is_sender = FALSE;

  g_object_get (source, "stats", &stats, NULL);

  gst_structure_get_boolean (stats, "is-sender", &is_sender);

  if (is_sender)
    gst_structure_get(stats, "bitrate", G_TYPE_UINT64, &bitrate, NULL);
  // there are a lot more stats in there.. 
  
  gst_structure_free(stats);
  g_object_unref(source);
 }
 g_object_unref(session);
}
gst_object_unref(rtpbin);
}
Comment 4 GitLab Migration User 2018-08-21 12:16:31 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/farstream/farstream/issues/8.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.